git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] submodule: prevent warning in summary output

From
Jens Lehmann <jens.lehmann@web.de>
Date
Aug 19, 2013, 21:17 UTC
Message-ID
<52128B6B.6090604@web.de>
In-Reply-To
<5211D3AA.6060403@gmail.com>
Am 19.08.2013 10:13, schrieb Chris Packham:
Show 41 quoted lines
> Hi Brian,
> On 19/08/13 05:31, brian m. carlson wrote:
>> When git submodule summary is run and there is a deleted submodule, there is an
>> warning from git rev-parse:
>>
>>   fatal: Not a git repository: '.vim/pathogen/.git'
>>
>> Silence this warning, since it is fully expected that a deleted submodule will
>> not be a git repository.
>>
>> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
>> ---
>>  git-submodule.sh | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/git-submodule.sh b/git-submodule.sh
>> index 2979197..66ee621 100755
>> --- a/git-submodule.sh
>> +++ b/git-submodule.sh
>> @@ -1071,7 +1071,7 @@ cmd_summary() {
>>  		missing_dst=
>>  
>>  		test $mod_src = 160000 &&
>> -		! GIT_DIR="$name/.git" git-rev-parse -q --verify $sha1_src^0 >/dev/null &&
>> +		! GIT_DIR="$name/.git" git-rev-parse -q --verify $sha1_src^0 >/dev/null 2>&1 &&
>>  		missing_src=t
>>  
>>  		test $mod_dst = 160000 &&
>>
> 
> I wonder if there are other useful errors this will silence
> unintentionally. Perhaps this would be better (untested)
> 
>  test $mod_src = 160000 &&
>  test -e "$name/.git" &&
>  ! GIT_DIR="$name/.git" git-rev-parse -q --verify $sha1_src^0 /dev/null &&
>   missing_src=t
> 
> Having said that there are precedents for both in git-submodule.sh. If
> there aren't any errors worth catching here then your way is probably
> cleaner than mine.

I'd prefer a way to not drop all errors too. We should be able to use the status variable to see if the submodule is deleted and then skip the rev-parse all together, or am I missing something here?

Previous: Chris Packham
Message 3 of 3 in “submodule: prevent warning in summary output”
  1. submodule: prevent warning in summary outputbrian m. carlson, Aug 18, 2013
  2. Chris PackhamAug 19, 2013
  3. Jens LehmannAug 19, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.