# [PATCH] submodule: remove redundant check for the_index.initialized

3 messages from 2013-06-09 to 2013-06-09. Participants: René Scharfe, Felipe Contreras.
Thread: https://gitlist.dev/t/34074

## René Scharfe, 2013-06-09 16:33

Subject: [PATCH] submodule: remove redundant check for the_index.initialized
Message-ID: <1370795625-10506-1-git-send-email-rene.scharfe@lsrfire.ath.cx>
URL: https://gitlist.dev/e/1370795625-10506-1-git-send-email-rene.scharfe%40lsrfire.ath.cx

```
read_cache already performs the same check and returns immediately if
the cache has already been loaded.

Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 submodule.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/submodule.c b/submodule.c
index e728025..1821a5b 100644
--- a/submodule.c
+++ b/submodule.c
@@ -603,9 +603,8 @@ int fetch_populated_submodules(const struct argv_array *options,
 	if (!work_tree)
 		goto out;
 
-	if (!the_index.initialized)
-		if (read_cache() < 0)
-			die("index file corrupt");
+	if (read_cache() < 0)
+		die("index file corrupt");
 
 	argv_array_push(&argv, "fetch");
 	for (i = 0; i < options->argc; i++)
-- 
1.8.3

```

## Felipe Contreras, 2013-06-09 16:44

Subject: Re: [PATCH] submodule: remove redundant check for the_index.initialized
Message-ID: <CAMP44s2cidZt6YWx-f5VMO3uhcTbV-SA-ze6xojHn2y_Pi1=NA@mail.gmail.com>
URL: https://gitlist.dev/e/CAMP44s2cidZt6YWx-f5VMO3uhcTbV-SA-ze6xojHn2y_Pi1%3DNA%40mail.gmail.com
In-Reply-To: <1370795625-10506-1-git-send-email-rene.scharfe@lsrfire.ath.cx>

```
On Sun, Jun 9, 2013 at 11:33 AM, René Scharfe
<rene.scharfe@lsrfire.ath.cx> wrote:
> read_cache already performs the same check and returns immediately if
> the cache has already been loaded.

This time I beat you to it first ;)
http://article.gmane.org/gmane.comp.version-control.git/226701

-- 
Felipe Contreras

```

## René Scharfe, 2013-06-09 17:41

Subject: Re: [PATCH] submodule: remove redundant check for the_index.initialized
Message-ID: <51B4BE2F.6060700@lsrfire.ath.cx>
URL: https://gitlist.dev/e/51B4BE2F.6060700%40lsrfire.ath.cx
In-Reply-To: <CAMP44s2cidZt6YWx-f5VMO3uhcTbV-SA-ze6xojHn2y_Pi1=NA@mail.gmail.com>

```
Am 09.06.2013 18:44, schrieb Felipe Contreras:
> On Sun, Jun 9, 2013 at 11:33 AM, René Scharfe
> <rene.scharfe@lsrfire.ath.cx> wrote:
>> read_cache already performs the same check and returns immediately if
>> the cache has already been loaded.
>
> This time I beat you to it first ;)
> http://article.gmane.org/gmane.comp.version-control.git/226701

Good to see we're agreeing on something for once. ;)

René

```
