]> Pileus Git - ~andy/git/commitdiff
git-submodule - possibly use branch name to describe a module
authorMark Levedahl <mlevedahl@gmail.com>
Tue, 15 Apr 2008 02:48:06 +0000 (22:48 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Apr 2008 06:14:08 +0000 (23:14 -0700)
This changes the search logic for describing a submodule from:
- annotated tag
- any tag
- tag on a subsequent commit
- commit id

to

- annotated tag
- any tag
- tag on a subsequent commit
- local or remote branch
- commit id

The change is describing with respect to a branch before falling
back to the commit id. By itself, git-submodule will maintain submodules
as headless checkouts without ever making a local branch. In
general, such heads can always be described relative to the remote branch
regardless of existence of tags, and so provides a better fallback
summary than just the commit id.

This requires inserting an extra describe step as --contains is
incompatible with --all, but the latter can be used with --always
to fall back to a commit ID. Also, --contains implies --tags, so the
latter is not needed.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-submodule.sh

index 7674346c8d9525b0d8928f48354bdbe0af8b8e23..a745e42bf7b19d6b813ff8e1e60e8b0ba41aaa14 100755 (executable)
@@ -327,7 +327,8 @@ set_name_rev () {
                cd "$1" && {
                        git describe "$2" 2>/dev/null ||
                        git describe --tags "$2" 2>/dev/null ||
-                       git describe --contains --tags --always "$2"
+                       git describe --contains "$2" 2>/dev/null ||
+                       git describe --all --always "$2"
                }
        ) )
        test -z "$revname" || revname=" ($revname)"