git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Pulling from refs/remotes/ ?
@ 2007-05-25  1:12 Han-Wen Nienhuys
  2007-05-25  1:19 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Han-Wen Nienhuys @ 2007-05-25  1:12 UTC (permalink / raw)
  To: git


Hi,

why can't I pull from a remote?  I can do 

  git log REMOTE-BRANCH
  git diff BRANCH REMOTE-BRANCH

etc. But pulling yields

 [hanwen@haring foobar]$ git pull . origin/nonrandr-setup
 error: no such remote ref refs/heads/origin/nonrandr-setup
 Fetch failure: .

also, "Fetch failure: .", what is that supposed to mean?

-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen

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

* Re: Pulling from refs/remotes/ ?
  2007-05-25  1:12 Pulling from refs/remotes/ ? Han-Wen Nienhuys
@ 2007-05-25  1:19 ` Junio C Hamano
  2007-05-25  1:35   ` Han-Wen Nienhuys
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-05-25  1:19 UTC (permalink / raw)
  To: hanwen; +Cc: git

Han-Wen Nienhuys <hanwen@xs4all.nl> writes:

> why can't I pull from a remote?  I can do 
>
>   git log REMOTE-BRANCH
>   git diff BRANCH REMOTE-BRANCH
>
> etc. But pulling yields
>
>  [hanwen@haring foobar]$ git pull . origin/nonrandr-setup
>  error: no such remote ref refs/heads/origin/nonrandr-setup
>  Fetch failure: .
>
> also, "Fetch failure: .", what is that supposed to mean?

You are treating your local repository as if it is a remote
repository somewhere else, namely, '.' (current repository).

Notice "git log" and "git diff" are LOCAL operations?  "git
pull" is "git fetch" which is a remote operation (i.e. it
interacts with a remote repository) followed by "git merge"
which is a local operation to merge in what was fetched or what
you already have locally.

I think you would want:

	git merge REMOTE-BRANCH

e.g. "git merge origin/nonrandr-setup".

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

* Re: Pulling from refs/remotes/ ?
  2007-05-25  1:19 ` Junio C Hamano
@ 2007-05-25  1:35   ` Han-Wen Nienhuys
  2007-05-25  1:53     ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Han-Wen Nienhuys @ 2007-05-25  1:35 UTC (permalink / raw)
  To: git; +Cc: git

Junio C Hamano escreveu:
> Han-Wen Nienhuys <hanwen@xs4all.nl> writes:
> 
>> why can't I pull from a remote?  I can do 
>>
>>   git log REMOTE-BRANCH
>>   git diff BRANCH REMOTE-BRANCH
>>
>> etc. But pulling yields
>>
>>  [hanwen@haring foobar]$ git pull . origin/nonrandr-setup
>>  error: no such remote ref refs/heads/origin/nonrandr-setup
>>  Fetch failure: .
>>
>> also, "Fetch failure: .", what is that supposed to mean?
> 
> You are treating your local repository as if it is a remote
> repository somewhere else, namely, '.' (current repository).
> 
> Notice "git log" and "git diff" are LOCAL operations?  "git
> pull" is "git fetch" which is a remote operation (i.e. it
> interacts with a remote repository) followed by "git merge"
> which is a local operation to merge in what was fetched or what
> you already have locally.
> 
> I think you would want:
> 
> 	git merge REMOTE-BRANCH
> 
> e.g. "git merge origin/nonrandr-setup".

Yes, that works, thanks. Wouldn't it be more consistent with this
reasoning to disallow 

  git pull . LOCAL-BRANCH 

too?

I still think that "fetch failure" is a bad error message. 
What information does it convey?


-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen

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

* Re: Pulling from refs/remotes/ ?
  2007-05-25  1:35   ` Han-Wen Nienhuys
@ 2007-05-25  1:53     ` Junio C Hamano
  2007-05-25  2:24       ` Han-Wen Nienhuys
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-05-25  1:53 UTC (permalink / raw)
  To: hanwen; +Cc: git

Han-Wen Nienhuys <hanwen@xs4all.nl> writes:

> Yes, that works, thanks. Wouldn't it be more consistent with this
> reasoning to disallow 
>
>   git pull . LOCAL-BRANCH 
>
> too?

I do not think so.

If somebody else (or yourself) did:

	$ git pull $dir LOCAL-BRANCH

(replace $dir with the `pwd` you would get in your repository),
that would work.  Why shouldn't it work for yourself?

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

* Re: Pulling from refs/remotes/ ?
  2007-05-25  1:53     ` Junio C Hamano
@ 2007-05-25  2:24       ` Han-Wen Nienhuys
  2007-05-25  3:06         ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Han-Wen Nienhuys @ 2007-05-25  2:24 UTC (permalink / raw)
  To: git; +Cc: git

Junio C Hamano escreveu:
> Han-Wen Nienhuys <hanwen@xs4all.nl> writes:
> 
>> Yes, that works, thanks. Wouldn't it be more consistent with this
>> reasoning to disallow 
>>
>>   git pull . LOCAL-BRANCH 
>>
>> too?
> 
> I do not think so.
> 
> If somebody else (or yourself) did:
> 
> 	$ git pull $dir LOCAL-BRANCH
> 
> (replace $dir with the `pwd` you would get in your repository),
> that would work.  Why shouldn't it work for yourself?
 
Because

"You are treating your local repository as if it is a remote
repository somewhere else, namely, '.' (current repository)."

that was the justification for not being able to pull in a remote
branch.  This justification (which I disagree with) applies to this
case as well.

I understand that we don't want people committing to
remotes, because fetches will then later fail, but other than 
that, why should there be limitations on using a remote?

-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen

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

* Re: Pulling from refs/remotes/ ?
  2007-05-25  2:24       ` Han-Wen Nienhuys
@ 2007-05-25  3:06         ` Junio C Hamano
  2007-05-26 19:47           ` Han-Wen Nienhuys
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-05-25  3:06 UTC (permalink / raw)
  To: hanwen; +Cc: git

Han-Wen Nienhuys <hanwen@xs4all.nl> writes:

>> If somebody else (or yourself) did:
>> 
>> 	$ git pull $dir LOCAL-BRANCH
>> 
>> (replace $dir with the `pwd` you would get in your repository),
>> that would work.  Why shouldn't it work for yourself?
>  
> Because
>
> "You are treating your local repository as if it is a remote
> repository somewhere else, namely, '.' (current repository)."
>
> that was the justification for not being able to pull in a remote
> branch.  This justification (which I disagree with) applies to this
> case as well.

Ah, so "forbidding a pull of local branch" was tongue-in-cheek
comment, and what you really wanted was to allow pulling remote
tracking branch with pull, either inside or outside of a
repository, like...

	$ git pull $somebody_elses_repo remotes/origin/master

without having to say "remotes/"?

That one comes from a different design issue.  refs/remotes/
hierarchy is local to your repository, and is not subject to
remote operation.

> I understand that we don't want people committing to
> remotes, because fetches will then later fail, but other than 
> that, why should there be limitations on using a remote?

My stance on this is that what I track as my upstream to
maintain my repository is none of other people's business.  I
have remote tracking branches because I use them to track
others; I do not necessarily have them with an intention to
publish them.

You could pull from my remote tracking branches using the fuller
refspec ("remotes/origin/master" in the example above) if you
really wanted to, and ls-remote lets you take a peek at them, so
the above "none of your business" is not in the sense of being
secretive, but is to reduce clutter and to avoid potential
confusion.

But this is an ancient design choice, and I am open to
suggestions loosening it, as long as we are aware of
implications.

One thing that comes to mind if we allow it is if a clone should
have refs/remotes/origin/remotes/origin/* that keeps track of
the remote that is being tracked by your origin.

I think it is insane to do so, but if somebody says "git pull
somewhere-else origin/master", we would not know if he meant
remotes/origin/master or remotes/origin/remotes/origin/master.

And the reason it is "insane" is the same as why we currently do
not interpret "git pull $repo origin/master" as a request to
pull from remotes/origin/master.  It really is none of your
business what kind of remote branches the other end is
interacting with.

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

* Re: Pulling from refs/remotes/ ?
  2007-05-25  3:06         ` Junio C Hamano
@ 2007-05-26 19:47           ` Han-Wen Nienhuys
  0 siblings, 0 replies; 7+ messages in thread
From: Han-Wen Nienhuys @ 2007-05-26 19:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano escreveu:
> And the reason it is "insane" is the same as why we currently do
> not interpret "git pull $repo origin/master" as a request to
> pull from remotes/origin/master.  It really is none of your
> business what kind of remote branches the other end is
> interacting with.

fair enough; my remaining gripe is that the error message is broken.
My suggestion is to have  

  git fetch . XXX

(and by extension: pull) print something like

  Will not fetch from self. 
  Do you mean "git merge XXX" or "git update-ref XXX" ? 

It may be an artificial restriction when compared to "git pull $dir XXX" 
but I think it helps the user better than "Fetch failure".

-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen

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

end of thread, other threads:[~2007-05-26 19:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-25  1:12 Pulling from refs/remotes/ ? Han-Wen Nienhuys
2007-05-25  1:19 ` Junio C Hamano
2007-05-25  1:35   ` Han-Wen Nienhuys
2007-05-25  1:53     ` Junio C Hamano
2007-05-25  2:24       ` Han-Wen Nienhuys
2007-05-25  3:06         ` Junio C Hamano
2007-05-26 19:47           ` Han-Wen Nienhuys

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