Re: [PATCH] git-submodule: Try harder to describe the status of a submodule
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 28, 2007, 04:24 UTC
- Message-ID
- <7v1wfwpuy2.fsf@assigned-by-dhcp.pobox.com>
- In-Reply-To
- <118297160163-git-send-email-Emilian.Medve@Freescale.com>
Emil Medve <Emilian.Medve@Freescale.com> writes:
Show 6 quoted lines
> Some repositories might not use/have annotated tags (for example repositories created with > git-cvsimport) or might not have tags at all and could cause git-submodule status to fail because > git-describe might fail. > > This change makes git-submodule status try harder in displaying the status of a module by > considering lightweight tags, subsequent tags and branches.
Why are we suddenly seeing these loooooooong lines...
Show 8 quoted lines
> +get_revname()
> +{
> + _revname=$(git-describe --tags "$1" 2>/dev/null || git-describe --contains "$1" 2>/dev/null)
> + if test -z "$_revname" -o "$_revname" = "undefined"
> + then
> + _revname=$(git-describe --all "$1" 2>/dev/null | cut -d / -f2-)
> + test -z "$_revname" && _revname=undefined
> + fiI really do not think using --all is useful. If you do not have a tag and the rev cannot be described, what damage does it incur?
We still say "$sha1 $path" in the output anyway, and ($revname) is only "it makes it nicer" appendix.
Show 9 quoted lines
> @@ -155,7 +174,7 @@ modules_list() > say "-$sha1 $path" > continue; > fi > - revname=$(unset GIT_DIR && cd "$path" && git-describe $sha1) > + revname=$(unset GIT_DIR && cd "$path" && get_revname $sha1) > if git diff-files --quiet -- "$path" > then > say " $sha1 $path ($revname)"
In that sense, I would prefer mine much better. If a rev is indescribable, your version would say:
" dddddddddddddddddddddddddddddddddddddddd subdir (undefined)"
while mine would have said:
" dddddddddddddddddddddddddddddddddddddddd subdir"