From: Junio C Hamano <gitster@pobox.com>
To: Joey Hess <joey@kitenet.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] write first for-merge ref to FETCH_HEAD first
Date: Tue, 27 Dec 2011 10:44:46 -0800 [thread overview]
Message-ID: <7v1urp97mp.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20111226161656.GB29582@gnu.kitenet.net> (Joey Hess's message of "Mon, 26 Dec 2011 12:16:56 -0400")
Joey Hess <joey@kitenet.net> writes:
> The FETCH_HEAD refname is supposed to refer to the ref that was fetched
> and should be merged. However all fetched refs are written to
> .git/FETCH_HEAD in an arbitrary order, and resolve_ref_unsafe simply
> takes the first ref as the FETCH_HEAD, which is often the wrong one,
> when other branches were also fetched.
>
> The solution is to write the for-merge ref(s) to FETCH_HEAD first.
> Then, unless --append is used, the FETCH_HEAD refname behaves as intended.
> If the user uses --append, they presumably are doing so in order to
> preserve the old FETCH_HEAD.
>
> Also included a fix to documentation that assumes FETCH_HEAD contains
> only a single ref.
That "single ref" assumption is perfectly fine for the part of the
documentation you patched, actually. The "fetch" command-line the example
shows explicitly fetches a single ref.
It is a good idea to use rev-parse anyway, so the patch itself is good. A
potential problem of that example (I haven't re-tried these examples for
eons since they were written) comes from the fact that FETCH_HEAD contains
not just the object name of what we fetched, but also other information to
describe what happened to that fetched object.
> ---
Sign-off?
> Documentation/git-read-tree.txt | 2 +-
> builtin/fetch.c | 158 +++++++++++++++++++++------------------
> 2 files changed, 85 insertions(+), 75 deletions(-)
next prev parent reply other threads:[~2011-12-27 18:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-25 17:39 FETCH_HEAD documentation vs reality Joey Hess
2011-12-26 8:16 ` Junio C Hamano
2011-12-26 16:16 ` [PATCH] write first for-merge ref to FETCH_HEAD first Joey Hess
2011-12-27 18:44 ` Junio C Hamano [this message]
2012-01-03 23:57 ` Junio C Hamano
2012-01-04 0:03 ` Joey Hess
2012-01-04 0:12 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v1urp97mp.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=joey@kitenet.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).