git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-submodule - possibly use remote branch to describe a module
@ 2008-04-14 23:52 Mark Levedahl
  2008-04-15  0:39 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Levedahl @ 2008-04-14 23:52 UTC (permalink / raw)
  To: git; +Cc: Mark Levedahl

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] git-submodule - possibly use remote branch to describe a module
  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
  0 siblings, 2 replies; 5+ messages in thread
From: Junio C Hamano @ 2008-04-15  0:39 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: git

Mark Levedahl <mlevedahl@gmail.com> writes:

> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] git-submodule - possibly use remote branch to describe a module
  2008-04-15  0:39 ` Junio C Hamano
@ 2008-04-15  1:55   ` Mark Levedahl
  2008-04-15  2:19   ` Mark Levedahl
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Levedahl @ 2008-04-15  1:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
>
> I think the new fallback sequence makes sense, but your explanation made
> sense for me only after reading it two and half times.
>
>   
So, would you like for me to attempt a better log message?

Mark

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] git-submodule - possibly use remote branch to describe a module
  2008-04-15  0:39 ` Junio C Hamano
  2008-04-15  1:55   ` Mark Levedahl
@ 2008-04-15  2:19   ` Mark Levedahl
  2008-04-15  2:48     ` [PATCH] git-submodule - possibly use branch name " Mark Levedahl
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Levedahl @ 2008-04-15  2:19 UTC (permalink / raw)
  To: gitster; +Cc: git, Mark Levedahl

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] git-submodule - possibly use branch name to describe a module
  2008-04-15  2:19   ` Mark Levedahl
@ 2008-04-15  2:48     ` Mark Levedahl
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Levedahl @ 2008-04-15  2:48 UTC (permalink / raw)
  To: gitster; +Cc: git, Mark Levedahl

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-15  2:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2008-04-15  2:48     ` [PATCH] git-submodule - possibly use branch name " Mark Levedahl

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).