[PATCH] git-submodule - possibly use remote branch to describe a module
- From
Mark Levedahl <mlevedahl@gmail.com>
- Date
- Apr 15, 2008, 02:19 UTC
- Message-ID
- <1208225951-1560-1-git-send-email-mlevedahl@gmail.com>
- 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