git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] submodule: prevent warning in summary output
@ 2013-08-18 17:31 brian m. carlson
  2013-08-19  8:13 ` Chris Packham
  0 siblings, 1 reply; 3+ messages in thread
From: brian m. carlson @ 2013-08-18 17:31 UTC (permalink / raw)
  To: git; +Cc: judge.packham, gitster

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 &&
-- 
1.8.4.rc2.564.g10ce5ae

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] submodule: prevent warning in summary output
  2013-08-18 17:31 [PATCH] submodule: prevent warning in summary output brian m. carlson
@ 2013-08-19  8:13 ` Chris Packham
  2013-08-19 21:17   ` Jens Lehmann
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Packham @ 2013-08-19  8:13 UTC (permalink / raw)
  To: brian m. carlson; +Cc: git, gitster, Jens Lehmann

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.

- C

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] submodule: prevent warning in summary output
  2013-08-19  8:13 ` Chris Packham
@ 2013-08-19 21:17   ` Jens Lehmann
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Lehmann @ 2013-08-19 21:17 UTC (permalink / raw)
  To: Chris Packham; +Cc: brian m. carlson, git, gitster

Am 19.08.2013 10:13, schrieb Chris Packham:
> 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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-19 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-18 17:31 [PATCH] submodule: prevent warning in summary output brian m. carlson
2013-08-19  8:13 ` Chris Packham
2013-08-19 21:17   ` Jens Lehmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).