git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What is the default refspec for fetch?
@ 2014-11-07 15:31 Christian Halstrick
  2014-11-08 10:52 ` Jeff King
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Halstrick @ 2014-11-07 15:31 UTC (permalink / raw)
  To: Git

Hi,

In a repo where no remote.<name>.fetch config parameter is set what
should a "git fetch" do? My experiments let me think it's
"HEAD:FETCH_HEAD". Right?

I came to this question after finding out that when I clone repos in
bare mode then they don't have and explicit remote.<name>.fetch in
their config. But a "git fetch" sometimes updated "something".

Ciao
  Chris

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

* Re: What is the default refspec for fetch?
  2014-11-07 15:31 What is the default refspec for fetch? Christian Halstrick
@ 2014-11-08 10:52 ` Jeff King
  2014-11-08 14:35   ` Jakub Narębski
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff King @ 2014-11-08 10:52 UTC (permalink / raw)
  To: Christian Halstrick; +Cc: Git

On Fri, Nov 07, 2014 at 04:31:08PM +0100, Christian Halstrick wrote:

> In a repo where no remote.<name>.fetch config parameter is set what
> should a "git fetch" do? My experiments let me think it's
> "HEAD:FETCH_HEAD". Right?

Basically, yes. We always write FETCH_HEAD, regardless of the refspec.
We choose "HEAD" if no other refspec was provided. So it is really more
like

  git fetch $remote HEAD

This is what makes one-off bare-url pulls work, like:

  git pull git://...

It runs fetch under the hood, which writes into FETCH_HEAD, and then we
merge that.

-Peff

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

* Re: What is the default refspec for fetch?
  2014-11-08 10:52 ` Jeff King
@ 2014-11-08 14:35   ` Jakub Narębski
  2014-11-09 17:23     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Narębski @ 2014-11-08 14:35 UTC (permalink / raw)
  To: Jeff King, Christian Halstrick; +Cc: Git

W dniu 2014-11-08 11:52, Jeff King pisze:
> On Fri, Nov 07, 2014 at 04:31:08PM +0100, Christian Halstrick wrote:
>
>> In a repo where no remote.<name>.fetch config parameter is set what
>> should a "git fetch" do? My experiments let me think it's
>> "HEAD:FETCH_HEAD". Right?
>
> Basically, yes. We always write FETCH_HEAD, regardless of the refspec.
> We choose "HEAD" if no other refspec was provided. So it is really more
> like
>
>    git fetch $remote HEAD
>
> This is what makes one-off bare-url pulls work, like:
>
>    git pull git://...
>
> It runs fetch under the hood, which writes into FETCH_HEAD, and then we
> merge that.

Actually FETCH_HEAD consists of multiple lines, one per ref...
but only top ref is merged.

-- 
Jakub Narębski

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

* Re: What is the default refspec for fetch?
  2014-11-08 14:35   ` Jakub Narębski
@ 2014-11-09 17:23     ` Junio C Hamano
  2014-11-11 23:01       ` Christian Halstrick
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2014-11-09 17:23 UTC (permalink / raw)
  To: Jakub Narębski; +Cc: Jeff King, Christian Halstrick, Git

Jakub Narębski <jnareb@gmail.com> writes:

> W dniu 2014-11-08 11:52, Jeff King pisze:
>> On Fri, Nov 07, 2014 at 04:31:08PM +0100, Christian Halstrick wrote:
>>
>>> In a repo where no remote.<name>.fetch config parameter is set what
>>> should a "git fetch" do? My experiments let me think it's
>>> "HEAD:FETCH_HEAD". Right?
>>
>> Basically, yes. We always write FETCH_HEAD, regardless of the refspec.
>> We choose "HEAD" if no other refspec was provided. So it is really more
>> like
>>
>>    git fetch $remote HEAD
>>
>> This is what makes one-off bare-url pulls work, like:
>>
>>    git pull git://...
>>
>> It runs fetch under the hood, which writes into FETCH_HEAD, and then we
>> merge that.
>
> Actually FETCH_HEAD consists of multiple lines, one per ref...
> but only top ref is merged.

Incorrect in that "only top" is misinformation, and irrelevant in
the context of discussing the "what is fetched in a one-off fetch".

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

* Re: What is the default refspec for fetch?
  2014-11-09 17:23     ` Junio C Hamano
@ 2014-11-11 23:01       ` Christian Halstrick
  2014-11-11 23:04         ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Halstrick @ 2014-11-11 23:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jakub Narębski, Jeff King, Git

ok, thanks. Then I'll teach JGit to fetch at least "HEAD" if nothing
is configured and nothing explicitly specified as refspec.
Ciao
  Chris


On Sun, Nov 9, 2014 at 6:23 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Jakub Narębski <jnareb@gmail.com> writes:
>
>> W dniu 2014-11-08 11:52, Jeff King pisze:
>>> On Fri, Nov 07, 2014 at 04:31:08PM +0100, Christian Halstrick wrote:
>>>
>>>> In a repo where no remote.<name>.fetch config parameter is set what
>>>> should a "git fetch" do? My experiments let me think it's
>>>> "HEAD:FETCH_HEAD". Right?
>>>
>>> Basically, yes. We always write FETCH_HEAD, regardless of the refspec.
>>> We choose "HEAD" if no other refspec was provided. So it is really more
>>> like
>>>
>>>    git fetch $remote HEAD
>>>
>>> This is what makes one-off bare-url pulls work, like:
>>>
>>>    git pull git://...
>>>
>>> It runs fetch under the hood, which writes into FETCH_HEAD, and then we
>>> merge that.
>>
>> Actually FETCH_HEAD consists of multiple lines, one per ref...
>> but only top ref is merged.
>
> Incorrect in that "only top" is misinformation, and irrelevant in
> the context of discussing the "what is fetched in a one-off fetch".

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

* Re: What is the default refspec for fetch?
  2014-11-11 23:01       ` Christian Halstrick
@ 2014-11-11 23:04         ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2014-11-11 23:04 UTC (permalink / raw)
  To: Christian Halstrick; +Cc: Jakub Narębski, Jeff King, Git

Christian Halstrick <christian.halstrick@gmail.com> writes:

> ok, thanks. Then I'll teach JGit to fetch at least "HEAD" if nothing
> is configured and nothing explicitly specified as refspec.

Sounds like a sensible thing to do to match what JGit does to what
we did from the time immemorial ;-)

Thanks.

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

end of thread, other threads:[~2014-11-11 23:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-07 15:31 What is the default refspec for fetch? Christian Halstrick
2014-11-08 10:52 ` Jeff King
2014-11-08 14:35   ` Jakub Narębski
2014-11-09 17:23     ` Junio C Hamano
2014-11-11 23:01       ` Christian Halstrick
2014-11-11 23:04         ` 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).