git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Now what: multiple HEAD refs
@ 2005-12-15  9:05 Alex Riesen
  2005-12-15  9:29 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Alex Riesen @ 2005-12-15  9:05 UTC (permalink / raw)
  To: git

Hi,

just a heads-up for everyone tried "git pull" after using "git merge" too much:

$ git pull . ref1 HEAD (notice the space!)

will happily create refs/heads/HEAD. What happens next is not easily
to understand: all files suddenly declared "New" by "git status", "git
checkout" does not work, reporting "Need a single revision" (which is
actually _the_ hint here).

The solution is simple: remove .git/refs/heads/HEAD

Maybe "git fsck-object" can hint on multiple HEADS?

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

* Re: Now what: multiple HEAD refs
  2005-12-15  9:05 Now what: multiple HEAD refs Alex Riesen
@ 2005-12-15  9:29 ` Junio C Hamano
  2005-12-15 10:16   ` Alex Riesen
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-12-15  9:29 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

Alex Riesen <raa.lkml@gmail.com> writes:

> just a heads-up for everyone tried "git pull" after using "git merge" too much:
>
> $ git pull . ref1 HEAD (notice the space!)

If you were too used to git merge, you would have wrote
HEAD before ref1, so that does not sound plausible ;-).

        $ git pull . maint HEAD
        error: no such remote ref refs/heads/HEAD
        Fetch failure: .
	$ echo $?
        1

But worse yet, the above syntax is to create an Octopus, and you
probably did not mean that.

I think the reason why my trial here worked correctly while you
had trouble with it is because I have the send-pack fix from
Pasky last night.

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

* Re: Now what: multiple HEAD refs
  2005-12-15  9:29 ` Junio C Hamano
@ 2005-12-15 10:16   ` Alex Riesen
  2005-12-15 14:19     ` Junio C Hamano
  2005-12-15 14:30     ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: Alex Riesen @ 2005-12-15 10:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 12/15/05, Junio C Hamano <junkio@cox.net> wrote:
> > just a heads-up for everyone tried "git pull" after using "git merge" too much:
> >
> > $ git pull . ref1 HEAD (notice the space!)
>
> If you were too used to git merge, you would have wrote
> HEAD before ref1, so that does not sound plausible ;-).

no, that I have remembered. What I constantly forget is the
space-vs-colon difference.

>         $ git pull . maint HEAD
>         error: no such remote ref refs/heads/HEAD
>         Fetch failure: .
>         $ echo $?
>         1
>
> But worse yet, the above syntax is to create an Octopus, and you
> probably did not mean that.

no, of course not.

> I think the reason why my trial here worked correctly while you
> had trouble with it is because I have the send-pack fix from
> Pasky last night.

yes, probably. It cleanups a reference if there was an error, right?

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

* Re: Now what: multiple HEAD refs
  2005-12-15 10:16   ` Alex Riesen
@ 2005-12-15 14:19     ` Junio C Hamano
  2005-12-15 15:14       ` Alex Riesen
  2005-12-15 14:30     ` Junio C Hamano
  1 sibling, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-12-15 14:19 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

Alex Riesen <raa.lkml@gmail.com> writes:

> On 12/15/05, Junio C Hamano <junkio@cox.net> wrote:
>> I think the reason why my trial here worked correctly while you
>> had trouble with it is because I have the send-pack fix from
>> Pasky last night.
>
> yes, probably. It cleanups a reference if there was an error, right?

Not really.  send-pack does not have anything to do with this
(it is involved in git-push not git-pull).  Care to see how
yours gets broken when you do "sh -x git-pull.sh . ref1 HEAD"?
If .git/refs/heads/HEAD exists in the first place then I would
understand it would not fail with the error message I quoted,
but the original message from you indicated that "git pull" is
the one that creates the breakage, and I am trying to see how.

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

* Re: Now what: multiple HEAD refs
  2005-12-15 10:16   ` Alex Riesen
  2005-12-15 14:19     ` Junio C Hamano
@ 2005-12-15 14:30     ` Junio C Hamano
  2005-12-15 14:54       ` Alex Riesen
  1 sibling, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-12-15 14:30 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

Alex Riesen <raa.lkml@gmail.com> writes:

> On 12/15/05, Junio C Hamano <junkio@cox.net> wrote:
>
>> >
>> > $ git pull . ref1 HEAD (notice the space!)
>>
>> If you were too used to git merge, you would have wrote
>> HEAD before ref1, so that does not sound plausible ;-).
>
> no, that I have remembered. What I constantly forget is the
> space-vs-colon difference.

That statement sounds as if "git pull . ref1:HEAD" makes some
sense and you typed it without colon by mistake.  But it does
not make any sense to me; I am puzzled ... what are you trying
to achieve with "git pull . ref1:HEAD"?

The patch from Johannes feels right but I haven't had caffeine
yet, so..

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

* Re: Now what: multiple HEAD refs
  2005-12-15 14:30     ` Junio C Hamano
@ 2005-12-15 14:54       ` Alex Riesen
  2005-12-15 15:40         ` Johannes Schindelin
  0 siblings, 1 reply; 9+ messages in thread
From: Alex Riesen @ 2005-12-15 14:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 12/15/05, Junio C Hamano <junkio@cox.net> wrote:
> >> >
> >> > $ git pull . ref1 HEAD (notice the space!)
> >>
> >> If you were too used to git merge, you would have wrote
> >> HEAD before ref1, so that does not sound plausible ;-).
> >
> > no, that I have remembered. What I constantly forget is the
> > space-vs-colon difference.
>
> That statement sounds as if "git pull . ref1:HEAD" makes some
> sense and you typed it without colon by mistake.  But it does

exactly.

> not make any sense to me; I am puzzled ... what are you trying
> to achieve with "git pull . ref1:HEAD"?

merge branch ref1 into current. Is that not a correct refspec?

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

* Re: Now what: multiple HEAD refs
  2005-12-15 14:19     ` Junio C Hamano
@ 2005-12-15 15:14       ` Alex Riesen
  0 siblings, 0 replies; 9+ messages in thread
From: Alex Riesen @ 2005-12-15 15:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 12/15/05, Junio C Hamano <junkio@cox.net> wrote:
> >> I think the reason why my trial here worked correctly while you
> >> had trouble with it is because I have the send-pack fix from
> >> Pasky last night.
> >
> > yes, probably. It cleanups a reference if there was an error, right?
>
> Not really.  send-pack does not have anything to do with this
> (it is involved in git-push not git-pull).  Care to see how
> yours gets broken when you do "sh -x git-pull.sh . ref1 HEAD"?

I tried. Interesting: no refs/heads/HEAD. But, then I tried "ref1:HEAD":

broken-HEAD /d/download/git2 [822]
PATH=".:$PATH" sh -x git-pull . lf-usage:HEAD
+ . git-sh-setup
++ unset CDPATH
++ : .git
++ : .git/objects
++ GIT_DIR=.git
++ git-var GIT_AUTHOR_IDENT
+ strategy_args=
+ no_summary=
+ no_commit=
+ break
++ git-rev-parse --verify HEAD
+ orig_head=5a0b59da20d832fcfdf864b522718acbc2171525
+ git-fetch --update-head-ok . lf-usage:HEAD
* refs/heads/HEAD: storing branch 'lf-usage' of .
++ git-rev-parse --verify HEAD
git-rev-parse: fatal: Needed a single revision
+ curr_head=
+ test '' '!=' 5a0b59da20d832fcfdf864b522718acbc2171525
+ echo 'Warning: fetch updated the current branch head.'
Warning: fetch updated the current branch head.
+ echo 'Warning: fast forwarding your working tree.'
Warning: fast forwarding your working tree.
+ git-read-tree -u -m 5a0b59da20d832fcfdf864b522718acbc2171525 ''
usage: git-read-tree (<sha> | -m [-u | -i] <sha1> [<sha2> [<sha3>]])
+ die 'You need to first update your working tree.'
+ echo 'You need to first update your working tree.'
You need to first update your working tree.
+ exit 1

And of course, there was refs/heads/HEAD now.
So it seems that I _had_ typed it with a colon (though I'm very sure I
did it with a space as well). Sorry for the whole confusion, but that
reveals that other problem, which Johannes' patch partially helps
with.

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

* Re: Now what: multiple HEAD refs
  2005-12-15 14:54       ` Alex Riesen
@ 2005-12-15 15:40         ` Johannes Schindelin
  2005-12-15 15:57           ` Alex Riesen
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2005-12-15 15:40 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Junio C Hamano, git

Hi,

On Thu, 15 Dec 2005, Alex Riesen wrote:

> > not make any sense to me; I am puzzled ... what are you trying
> > to achieve with "git pull . ref1:HEAD"?
> 
> merge branch ref1 into current. Is that not a correct refspec?

No, it is not correct. To pull means that you want to merge the fetched 
ref (your ref1), and store the result in the current branch.

But if you write "ref1:HEAD", you pretend that you want to fast-forward 
the local branch "HEAD" to ref1, and get an error if it is not 
forwardable.

In your case, I guess, "git pull ref1" is what you meant.

Hth,
Dscho

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

* Re: Now what: multiple HEAD refs
  2005-12-15 15:40         ` Johannes Schindelin
@ 2005-12-15 15:57           ` Alex Riesen
  0 siblings, 0 replies; 9+ messages in thread
From: Alex Riesen @ 2005-12-15 15:57 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git

On 12/15/05, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > > not make any sense to me; I am puzzled ... what are you trying
> > > to achieve with "git pull . ref1:HEAD"?
> >
> > merge branch ref1 into current. Is that not a correct refspec?
>
> No, it is not correct. To pull means that you want to merge the fetched
> ref (your ref1), and store the result in the current branch.
>
> But if you write "ref1:HEAD", you pretend that you want to fast-forward
> the local branch "HEAD" to ref1, and get an error if it is not
> forwardable.
>
> In your case, I guess, "git pull ref1" is what you meant.

I did, I guess...
Confused now.

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

end of thread, other threads:[~2005-12-15 15:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-15  9:05 Now what: multiple HEAD refs Alex Riesen
2005-12-15  9:29 ` Junio C Hamano
2005-12-15 10:16   ` Alex Riesen
2005-12-15 14:19     ` Junio C Hamano
2005-12-15 15:14       ` Alex Riesen
2005-12-15 14:30     ` Junio C Hamano
2005-12-15 14:54       ` Alex Riesen
2005-12-15 15:40         ` Johannes Schindelin
2005-12-15 15:57           ` Alex Riesen

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