Skip to content

Commit

Permalink
git-submodule - possibly use branch name to describe a module
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Levedahl authored and Junio C Hamano committed Apr 15, 2008
1 parent 02604e2 commit f669ac0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion git-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down

0 comments on commit f669ac0

Please sign in to comment.