git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Emil Medve <Emilian.Medve@Freescale.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-submodule: Try harder to describe the status of a submodule
Date: Wed, 27 Jun 2007 21:24:53 -0700	[thread overview]
Message-ID: <7v1wfwpuy2.fsf@assigned-by-dhcp.pobox.com> (raw)
In-Reply-To: <118297160163-git-send-email-Emilian.Medve@Freescale.com> (Emil Medve's message of "Wed, 27 Jun 2007 14:13:21 -0500")

Emil Medve <Emilian.Medve@Freescale.com> writes:

> 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...

> +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
> +	fi

I 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.

> @@ -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"

  reply	other threads:[~2007-06-28  4:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-27 19:13 [PATCH] git-submodule: Try harder to describe the status of a submodule Emil Medve
2007-06-28  4:24 ` Junio C Hamano [this message]
2007-06-28 13:01   ` Medve Emilian-EMMEDVE1
2007-07-02 15:44     ` Medve Emilian-EMMEDVE1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v1wfwpuy2.fsf@assigned-by-dhcp.pobox.com \
    --to=gitster@pobox.com \
    --cc=Emilian.Medve@Freescale.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).