Skip to content

Commit f669ac0

Browse files
mark987gitster
authored andcommitted
git-submodule - possibly use branch name to describe a module
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 02604e2 commit f669ac0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git-submodule.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ set_name_rev () {
327327
cd "$1" && {
328328
git describe "$2" 2>/dev/null ||
329329
git describe --tags "$2" 2>/dev/null ||
330-
git describe --contains --tags --always "$2"
330+
git describe --contains "$2" 2>/dev/null ||
331+
git describe --all --always "$2"
331332
}
332333
) )
333334
test -z "$revname" || revname=" ($revname)"

0 commit comments

Comments
 (0)