* [PATCH] git-submodule: Try harder to describe the status of a submodule
@ 2007-06-27 19:13 Emil Medve
2007-06-28 4:24 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Emil Medve @ 2007-06-27 19:13 UTC (permalink / raw)
To: git; +Cc: Emil Medve
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.
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
---
git-submodule.sh | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 89a3885..7429ce3 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -134,6 +134,25 @@ modules_update()
}
#
+# Identify and display the most specific name describing an object specified by a SHA1 key
+#
+# First try to locate a tag that predates the commit. If that fails try to locate a tag that comes
+# after the commit. If that fails too (e.g. undefined), try to locate the branch of the commit. If
+# that fails too just display "undefined"
+#
+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
+ echo $_revname
+ unset _revname
+}
+
+#
# List all submodules, prefixed with:
# - submodule not initialized
# + different revision checked out
@@ -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)"
@@ -163,7 +182,7 @@ modules_list()
if test -z "$cached"
then
sha1=$(unset GIT_DIR && cd "$path" && git-rev-parse --verify HEAD)
- revname=$(unset GIT_DIR && cd "$path" && git-describe $sha1)
+ revname=$(unset GIT_DIR && cd "$path" && get_revname $sha1)
fi
say "+$sha1 $path ($revname)"
fi
--
1.5.2.2.549.gaeb59
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] git-submodule: Try harder to describe the status of a submodule
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
2007-06-28 13:01 ` Medve Emilian-EMMEDVE1
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2007-06-28 4:24 UTC (permalink / raw)
To: Emil Medve; +Cc: git
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"
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] git-submodule: Try harder to describe the status of a submodule
2007-06-28 4:24 ` Junio C Hamano
@ 2007-06-28 13:01 ` Medve Emilian-EMMEDVE1
2007-07-02 15:44 ` Medve Emilian-EMMEDVE1
0 siblings, 1 reply; 4+ messages in thread
From: Medve Emilian-EMMEDVE1 @ 2007-06-28 13:01 UTC (permalink / raw)
To: git
Hello Junio,
Alright, let's go with your patch.
Cheers,
Emil.
This e-mail, and any associated attachments have been classified as:
--------------------------------------------------------------------
[x] Public
[ ] Freescale Semiconductor Internal Use Only
[ ] Freescale Semiconductor Confidential Proprietary
-----Original Message-----
From: Junio C Hamano [mailto:gitster@pobox.com]
Sent: Wednesday, June 27, 2007 11:25 PM
To: Medve Emilian-EMMEDVE1
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-submodule: Try harder to describe the status of
a submodule
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"
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] git-submodule: Try harder to describe the status of a submodule
2007-06-28 13:01 ` Medve Emilian-EMMEDVE1
@ 2007-07-02 15:44 ` Medve Emilian-EMMEDVE1
0 siblings, 0 replies; 4+ messages in thread
From: Medve Emilian-EMMEDVE1 @ 2007-07-02 15:44 UTC (permalink / raw)
To: git
Hello Junio,
I noticed the 1.5.2.3 tag and the plans for 1.5.3-rc1 and I was
wondering when do you think you'll apply your submodule patch? Is there
any way I can help with it?
Thanks,
Emil.
This e-mail, and any associated attachments have been classified as:
--------------------------------------------------------------------
[x] Public
[ ] Freescale Semiconductor Internal Use Only
[ ] Freescale Semiconductor Confidential Proprietary
-----Original Message-----
From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
Behalf Of Medve Emilian-EMMEDVE1
Sent: Thursday, June 28, 2007 8:01 AM
To: git@vger.kernel.org
Subject: RE: [PATCH] git-submodule: Try harder to describe the status of
a submodule
Hello Junio,
Alright, let's go with your patch.
Cheers,
Emil.
This e-mail, and any associated attachments have been classified as:
--------------------------------------------------------------------
[x] Public
[ ] Freescale Semiconductor Internal Use Only
[ ] Freescale Semiconductor Confidential Proprietary
-----Original Message-----
From: Junio C Hamano [mailto:gitster@pobox.com]
Sent: Wednesday, June 27, 2007 11:25 PM
To: Medve Emilian-EMMEDVE1
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-submodule: Try harder to describe the status of
a submodule
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"
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-02 15:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-06-28 13:01 ` Medve Emilian-EMMEDVE1
2007-07-02 15:44 ` Medve Emilian-EMMEDVE1
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).