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

Re: [PATCH] git-submodule - possibly use remote branch to describe a module

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 15, 2008, 00:39 UTC
Message-ID
<7viqyk6je7.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1208217154-992-1-git-send-email-mlevedahl@gmail.com>
Mark Levedahl <mlevedahl@gmail.com> writes:
Show 24 quoted lines
> Absent user intervention, git-submodule will maintain submodules as
> headless checkouts of remote branches: such checkouts cannot be described
> with reference to any local branch. So, allow describing the submodule
> using remote branches before falling back on just using the commit id.
>
> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
> ---
>  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)"

I think the new fallback sequence makes sense, but your explanation made sense for me only after reading it two and half times.

 - The original sequence ended with "--contains --always" which always
   succeeded but with an abbrevated object name.  You removed --always
   from it so that you can add a better last-ditch effort that uses remote
   references.
   Side note.  Removal of --tags from it is not justified in your log
   message.  It is sort of obvious if you think about it, though...
 - The new one at the end uses --all because the HEAD is likely to be
   describable with remote references, and without --all remote reference
   namespace is not searched for a match.
Previous: Mark LevedahlNext: Mark Levedahl
Message 2 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.