diff options
author | Emil Medve <Emilian.Medve@Freescale.com> | 2007-06-26 18:40:58 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-07-02 01:33:44 -0700 |
commit | bffe71f4cd44b8050e7561b9f9245febb8b21f0a (patch) | |
tree | 7b8e25a5ae721a2ac55c173aa800bad423197c1d /git-submodule.sh | |
parent | ecda072380e54084d5160d7b6a9cdb23369da804 (diff) | |
download | git-bffe71f4cd44b8050e7561b9f9245febb8b21f0a.tar.gz git-bffe71f4cd44b8050e7561b9f9245febb8b21f0a.tar.xz |
git-submodule: Instead of using only annotated tags, use any tags.
Some repositories might not use/have annotated tags (for example the
ones created with git-cvsimport) and git-submodule status might fail
because git-describe might fail to find a tag. This change allows the
status of a submodule to be described/displayed relative to lightweight
tags as well.
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index 67c78f2d3..c29e2c3c9 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -199,6 +199,18 @@ modules_update() done } +set_name_rev () { + revname=$( ( + unset GIT_DIR && + cd "$1" && { + git-describe "$2" 2>/dev/null || + git-describe --tags "$2" 2>/dev/null || + git-describe --contains --tags "$2" + } + ) ) + test -z "$revname" || revname=" ($revname)" +} + # # List all submodules, prefixed with: # - submodule not initialized @@ -221,17 +233,18 @@ modules_list() say "-$sha1 $path" continue; fi - revname=$(unset GIT_DIR && cd "$path" && git-describe $sha1) + revname=$(unset GIT_DIR && cd "$path" && git-describe --tags $sha1) + set_name_rev "$path" $"sha1" if git diff-files --quiet -- "$path" then - say " $sha1 $path ($revname)" + say " $sha1 $path$revname" else 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) + set_name_rev "$path" $"sha1" fi - say "+$sha1 $path ($revname)" + say "+$sha1 $path$revname" fi done } |