Re: FETCH_HEAD question

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: FETCH_HEAD question

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:13

Jay Soffian [off-list ref] writes:
On Tue, Feb 17, 2009 at 12:36 AM, Junio C Hamano [off-list ref] wrote:
quoted
[... explanation of how git pull and git fetch communicate via FETCH_HEAD...]
I'm aware of all that, and I apologize for not making that clear,
since I made you do lots of extra typing. :-(
Your "git merge FETCH_HEAD" after fetching random set of refs by the
default wildcard refspec in .git/config made me suspect you aren't.
quoted
       $ git fetch git://repo.or.cz/his.git for-linus
       $ git log -p ..FETCH_HEAD ;# to inspect
       $ git merge FETCH_HEAD
...
That makes sense, but I was confused why git merge goes through the
trouble of stripping out the not-for-merge tag which in the above use
case wouldn't be there.
Because it is designed to handle a lot more general case of fetching all
remote branches into your remote tracking branches with wildcard refspecs,
and most of the entries need to be marked with not-for-merge marker.  If
you left only the for-merge branches, you would not have any sane way to
learn what refs were fetched after you said "git fetch" (and no, looking
at timestamp of files in .git/refs/remotes/origin/ is not a sensible
answer).

Re: FETCH_HEAD question

From: Jay Soffian <hidden>
Date: 2016-06-15 22:46:13

On Tue, Feb 17, 2009 at 2:18 AM, Junio C Hamano [off-list ref] wrote:
Because it is designed to handle a lot more general case of fetching all
remote branches into your remote tracking branches with wildcard refspecs,
and most of the entries need to be marked with not-for-merge marker.  If
you left only the for-merge branches, you would not have any sane way to
learn what refs were fetched after you said "git fetch" (and no, looking
at timestamp of files in .git/refs/remotes/origin/ is not a sensible
answer).
We are talking past each other.

I understand the not-for-merge marker, why git fetch puts it there,
and how it is used by git pull.

I was asking why "git merge FETCH_HEAD" is useful, and you gave an
example of fetching a *single* branch using "git fetch <url>
<branch>". But in that case, as you said, git fetch does *not* leave a
"not-for-merge" marker, since only one branch was fetched.

So then, why does "git merge FETCH_HEAD" bother to strip out a
not-for-merge marker that wouldn't be there?

I can only guess there is a use case where one fetches multiple
branches and then uses "git merge FETCH_HEAD".

j.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help