git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Levedahl <mlevedahl@gmail.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Mark Levedahl <mlevedahl@gmail.com>
Subject: [PATCH] git-submodule - possibly use remote branch to describe a module
Date: Mon, 14 Apr 2008 22:19:11 -0400	[thread overview]
Message-ID: <1208225951-1560-1-git-send-email-mlevedahl@gmail.com> (raw)
In-Reply-To: <7viqyk6je7.fsf@gitster.siamese.dyndns.org>

This changes the search logic for describing a submodule from:
- local branch
- tag
- tag on a later commit
- commit id

to

- local branch
- tag
- tag on a subsequent commit
- remote branch
- commit id

The change is describing with respect to a remote 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 cannot be described relative to a local branch but
can always be described relative to the remote branch.

This requires two describe steps in place of one: the first with
"--contains" (and no "--tags" as that is implied by "--contains"), and
a new final step having "--all --always". The split is needed as
"--contains" is incompatible with "--all".

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)"
-- 
1.5.5.65.gf482

  parent reply	other threads:[~2008-04-15  2:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-14 23:52 [PATCH] git-submodule - possibly use remote branch to describe a module Mark Levedahl
2008-04-15  0:39 ` Junio C Hamano
2008-04-15  1:55   ` Mark Levedahl
2008-04-15  2:19   ` Mark Levedahl [this message]
2008-04-15  2:48     ` [PATCH] git-submodule - possibly use branch name " Mark Levedahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1208225951-1560-1-git-send-email-mlevedahl@gmail.com \
    --to=mlevedahl@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).