git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-submodule - possibly use branch name to describe a module

From
Mark Levedahl <mlevedahl@gmail.com>
Date
Apr 15, 2008, 02:48 UTC
Message-ID
<1208227686-696-1-git-send-email-mlevedahl@gmail.com>
In-Reply-To
<1208225951-1560-1-git-send-email-mlevedahl@gmail.com>
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>
---
One more try - I mistakenly thought bare describe allowed
local branches, not just tags, so the logic IS different.W Oops.
 git-submodule.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 28509ea..af195a7 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -389,7 +389,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)"
--
1.5.5.65.gf482
Previous: Mark Levedahl
Message 5 of 5 in “git-submodule - possibly use remote branch to describe a module”
  1. git-submodule - possibly use remote branch to describe a moduleMark Levedahl, Apr 14, 2008
  2. Junio C HamanoApr 15, 2008
  3. Mark LevedahlApr 15, 2008
  4. git-submodule - possibly use remote branch to describe a moduleMark Levedahl, Apr 15, 2008
  5. git-submodule - possibly use branch name to describe a moduleMark Levedahl, Apr 15, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.