git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG: git pull --rebase on detatched head prints a lot of usage warnings
@ 2010-12-03 18:38 Sverre Rabbelier
  2010-12-03 19:00 ` Jonathan Nieder
  0 siblings, 1 reply; 8+ messages in thread
From: Sverre Rabbelier @ 2010-12-03 18:38 UTC (permalink / raw)
  To: Git List

Heya,

sverre@laptop-sverre:~/code/Melange
$ git pull --rebase
usage: git merge-base [-a|--all] [--octopus] <commit> <commit>...
   or: git merge-base --independent <commit>...

    -a, --all             output all common ancestors
    --octopus             find ancestors for a single n-way merge
    --independent         list revs not reachable from others

usage: git merge-base [-a|--all] [--octopus] <commit> <commit>...
   or: git merge-base --independent <commit>...

    -a, --all             output all common ancestors
    --octopus             find ancestors for a single n-way merge
    --independent         list revs not reachable from others

usage: git merge-base [-a|--all] [--octopus] <commit> <commit>...
   or: git merge-base --independent <commit>...

    -a, --all             output all common ancestors
    --octopus             find ancestors for a single n-way merge
    --independent         list revs not reachable from others


[... many more snipped ...]

You are not currently on a branch, so I cannot use any
'branch.<branchname>.merge' in your configuration file.
Please specify which remote branch you want to use on the command
line and try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.


There are 127 helpful messages in total.

Output with GIT_TRACE set:

trace: exec: 'git-pull' '--rebase'
trace: run_command: 'git-pull' '--rebase'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--is-inside-work-tree'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'ls-files' '-u'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'config' '--bool' 'branch..rebase'
trace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'update-index' '-q' '--ignore-submodules' '--refresh'
trace: built-in: git 'diff-files' '--quiet' '--ignore-submodules'
trace: built-in: git 'diff-index' '--cached' '--quiet'
'--ignore-submodules' 'HEAD' '--'
trace: built-in: git 'rev-parse' '-q' '--git-dir'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'config' '--get' 'branch..remote'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'for-each-ref' '--format=%(upstream)'
trace: built-in: git 'rev-parse' '-q' '--verify' 'refs/remotes/origin/tip'
trace: built-in: git 'rev-list' '-g' 'refs/remotes/origin/tip'
trace: built-in: git 'merge-base' '927b640697cf707a8d3d26b39c926be052c3aa7c'
trace: built-in: git 'merge-base' '8281385d7b5132a51ae1f3ad515f0220478c7f40'

Tested on current next.

-- 
Cheers,

Sverre Rabbelier

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

* Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings
  2010-12-03 18:38 BUG: git pull --rebase on detatched head prints a lot of usage warnings Sverre Rabbelier
@ 2010-12-03 19:00 ` Jonathan Nieder
  2010-12-03 19:05   ` Sverre Rabbelier
  0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Nieder @ 2010-12-03 19:00 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Git List, Johannes Schindelin, Santi Béjar

Sverre Rabbelier wrote:

> $ git pull --rebase
> usage: git merge-base [-a|--all] [--octopus] <commit> <commit>...
[...]
> [... many more snipped ...]
>
> You are not currently on a branch, so I cannot use any
> 'branch.<branchname>.merge' in your configuration file.
> Please specify which remote branch you want to use on the command
> line and try again (e.g. 'git pull <repository> <refspec>').
> See git-pull(1) for details.
>
>
> There are 127 helpful messages in total.

Does the following take care of it?

cc-ing Santi, author of the very nice v1.6.4.1~6^2 (pull: support
rebased upstream + fetch + pull --rebase, 2009-07-19).  Maybe we
should make merge-base more tolerant.

diff --git a/git-pull.sh b/git-pull.sh
index 8eb74d4..bbc369d 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -212,7 +212,7 @@ test true = "$rebase" && {
 	oldremoteref="$(git rev-parse -q --verify "$remoteref")" &&
 	for reflog in $(git rev-list -g $remoteref 2>/dev/null)
 	do
-		if test "$reflog" = "$(git merge-base $reflog $curr_branch)"
+		if test "$reflog" = "$(git show-branch --merge-base $reflog $curr_branch)"
 		then
 			oldremoteref="$reflog"
 			break

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

* Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings
  2010-12-03 19:00 ` Jonathan Nieder
@ 2010-12-03 19:05   ` Sverre Rabbelier
  2010-12-03 20:23     ` Santi Béjar
  0 siblings, 1 reply; 8+ messages in thread
From: Sverre Rabbelier @ 2010-12-03 19:05 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Git List, Johannes Schindelin, Santi Béjar

Heya,

On Fri, Dec 3, 2010 at 20:00, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Does the following take care of it?

Yes.

Tested-by: Sverre Rabbelier <srabbelier@gmail.com>

-- 
Cheers,

Sverre Rabbelier

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

* Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings
  2010-12-03 19:05   ` Sverre Rabbelier
@ 2010-12-03 20:23     ` Santi Béjar
  2010-12-03 20:45       ` Sverre Rabbelier
  2010-12-03 21:06       ` Junio C Hamano
  0 siblings, 2 replies; 8+ messages in thread
From: Santi Béjar @ 2010-12-03 20:23 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Jonathan Nieder, Git List, Johannes Schindelin

On Fri, Dec 3, 2010 at 8:05 PM, Sverre Rabbelier <srabbelier@gmail.com> wrote:
> Heya,
>
> On Fri, Dec 3, 2010 at 20:00, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> Does the following take care of it?
>
> Yes.

I also think it fixes, but I wonder if it's the best fix. One thing is
that show-branch is an ancillary command, and not a plumbing command
(but there is already a call to show-branch, but it should probably be
change to merge-base now that it handles three commit as arguments).

The problem is that many parts of git-pull.sh/git-parse-remote.sh
assume that you are not in a detached HEAD. Can you confirm that the
following patch fixes it?

diff --git i/git-parse-remote.sh w/git-parse-remote.sh
index 5f47b18..6d0a5de 100644
--- i/git-parse-remote.sh
+++ w/git-parse-remote.sh
@@ -68,7 +68,7 @@ get_remote_merge_branch () {
            test -z "$origin" && origin=$default
            curr_branch=$(git symbolic-ref -q HEAD)
            [ "$origin" = "$default" ] &&
-           echo $(git for-each-ref --format='%(upstream)' $curr_branch)
+           echo $(git for-each-ref --format='%(upstream)' HEAD)
            ;;
        *)
            repo=$1

I'm wondering if most of $curr_branch should be changed to HEAD, I'll check it.

HTH,
Santi

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

* Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings
  2010-12-03 20:23     ` Santi Béjar
@ 2010-12-03 20:45       ` Sverre Rabbelier
  2010-12-03 21:06       ` Junio C Hamano
  1 sibling, 0 replies; 8+ messages in thread
From: Sverre Rabbelier @ 2010-12-03 20:45 UTC (permalink / raw)
  To: Santi Béjar; +Cc: Jonathan Nieder, Git List, Johannes Schindelin

Heya,

On Fri, Dec 3, 2010 at 21:23, Santi Béjar <santi@agolina.net> wrote:
> The problem is that many parts of git-pull.sh/git-parse-remote.sh
> assume that you are not in a detached HEAD. Can you confirm that the
> following patch fixes it?

Yes.

Tested-by: Sverre Rabbelier <srabbelier@gmail.com>

-- 
Cheers,

Sverre Rabbelier

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

* Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings
  2010-12-03 20:23     ` Santi Béjar
  2010-12-03 20:45       ` Sverre Rabbelier
@ 2010-12-03 21:06       ` Junio C Hamano
  2010-12-03 22:16         ` Santi Béjar
  1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2010-12-03 21:06 UTC (permalink / raw)
  To: Santi Béjar
  Cc: Sverre Rabbelier, Jonathan Nieder, Git List, Johannes Schindelin

Santi Béjar <santi@agolina.net> writes:

> I also think it fixes, but I wonder if it's the best fix. One thing is
> that show-branch is an ancillary command, and not a plumbing command
> (but there is already a call to show-branch, but it should probably be
> change to merge-base now that it handles three commit as arguments).

Are you sure "show-branch --merge-base A B C" and "merge-base A B C" are
meant to compute the same thing?

I do not think ancillary necessarily means Porcelain, but that is a
separate issue.

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

* Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings
  2010-12-03 21:06       ` Junio C Hamano
@ 2010-12-03 22:16         ` Santi Béjar
  2010-12-03 22:31           ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Santi Béjar @ 2010-12-03 22:16 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Sverre Rabbelier, Jonathan Nieder, Git List, Johannes Schindelin

On Fri, Dec 3, 2010 at 10:06 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Santi Béjar <santi@agolina.net> writes:
>
>> I also think it fixes, but I wonder if it's the best fix. One thing is
>> that show-branch is an ancillary command, and not a plumbing command
>> (but there is already a call to show-branch, but it should probably be
>> change to merge-base now that it handles three commit as arguments).
>
> Are you sure "show-branch --merge-base A B C" and "merge-base A B C" are
> meant to compute the same thing?

No, I'm not sure. In fact the documentation explicit says that they
are different. But I fail to see when it matters, and more
specifically (now that I've reread the docs), what is the point of
"merge-base A B C".

Just a data point, show-branch --merge-base is only used once in the
code, in git-pull.sh, but "git merge-base A B C" is not used (at least
using my grep).

Or the equivalent is the undocumented "git merge-base --octopus A B C"?

>
> I do not think ancillary necessarily means Porcelain, but that is a
> separate issue.

Me neither. But is the promise to not change the behavior/output as
hard as with plumbing?

Santi

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

* Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings
  2010-12-03 22:16         ` Santi Béjar
@ 2010-12-03 22:31           ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2010-12-03 22:31 UTC (permalink / raw)
  To: Santi Béjar
  Cc: Sverre Rabbelier, Jonathan Nieder, Git List, Johannes Schindelin

Santi Béjar <santi@agolina.net> writes:

> No, I'm not sure. In fact the documentation explicit says that they
> are different. But I fail to see when it matters, and more
> specifically (now that I've reread the docs), what is the point of
> "merge-base A B C".

See c5dc9a2 (git-merge-octopus: use (merge-base A (merge B C D E...)) for
stepwise merge, 2008-07-27), not the patch but the explanation.

> Just a data point, show-branch --merge-base is only used once in the
> code, in git-pull.sh, but "git merge-base A B C" is not used (at least
> using my grep).

Your grep skill needs honing ;-)  The variable MRC in git-merge-octopus is
a space separated list of commit object names, split at $IFS when
merge-base is called.

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

end of thread, other threads:[~2010-12-03 22:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-03 18:38 BUG: git pull --rebase on detatched head prints a lot of usage warnings Sverre Rabbelier
2010-12-03 19:00 ` Jonathan Nieder
2010-12-03 19:05   ` Sverre Rabbelier
2010-12-03 20:23     ` Santi Béjar
2010-12-03 20:45       ` Sverre Rabbelier
2010-12-03 21:06       ` Junio C Hamano
2010-12-03 22:16         ` Santi Béjar
2010-12-03 22:31           ` Junio C Hamano

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