git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Han-Wen Nienhuys <hanwenn@gmail.com>
Subject: Re: [PATCH v2 0/4] Handle FETCH_HEAD and MERGE_HEAD generically
Date: Wed, 19 Aug 2020 14:09:42 -0700	[thread overview]
Message-ID: <xmqq1rk2tka1.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <pull.705.v2.git.1597847278.gitgitgadget@gmail.com> (Han-Wen Nienhuys via GitGitGadget's message of "Wed, 19 Aug 2020 14:27:54 +0000")

"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> This moves the FETCH_HEAD handling into refs.c as discussed in 
> https://public-inbox.org/git/xmqq5z9pav01.fsf@gitster.c.googlers.com/

Thanks.  The way the support for MERGE_HEAD is added to the series
looks very sensible, too.

Will replace.

>      -+static int refs_read_fetch_head(struct ref_store *ref_store,
>      -+				struct object_id *oid, struct strbuf *referent,
>      -+				unsigned int *type)
>      ++static int refs_read_special_head(struct ref_store *ref_store,
>      ++				  const char *refname, struct object_id *oid,
>      ++				  struct strbuf *referent, unsigned int *type)
>       +{
>       +	struct strbuf full_path = STRBUF_INIT;
>       +	struct strbuf content = STRBUF_INIT;
>       +	int result = -1;
>      -+	strbuf_addf(&full_path, "%s/%s", ref_store->gitdir, "FETCH_HEAD");
>      ++	strbuf_addf(&full_path, "%s/%s", ref_store->gitdir, refname);
>       +
>       +	if (strbuf_read_file(&content, full_path.buf, 0) < 0)
>       +		goto done;
>      @@ refs.c: int for_each_rawref(each_ref_fn fn, void *cb_data)
>        		      struct strbuf *referent, unsigned int *type)
>        {
>       -	return ref_store->be->read_raw_ref(ref_store, refname, oid, referent, type);
>      -+	if (!strcmp(refname, "FETCH_HEAD")) {
>      -+		return refs_read_fetch_head(ref_store, oid, referent, type);
>      ++	if (!strcmp(refname, "FETCH_HEAD") || !strcmp(refname, "MERGE_HEAD")) {
>      ++		return refs_read_special_head(ref_store, refname, oid, referent,
>      ++					      type);
>       +	}
>       +
>       +	return ref_store->be->read_raw_ref(ref_store, refname, oid, referent,

      parent reply	other threads:[~2020-08-19 21:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17 15:39 [PATCH 0/4] Handle FETCH_HEAD generically Han-Wen Nienhuys via GitGitGadget
2020-08-17 15:39 ` [PATCH 1/4] Split off reading loose ref data in separate function Han-Wen Nienhuys via GitGitGadget
2020-08-17 15:39 ` [PATCH 2/4] refs: fix comment about submodule ref_stores Han-Wen Nienhuys via GitGitGadget
2020-08-17 15:39 ` [PATCH 3/4] refs: move gitdir into base ref_store Han-Wen Nienhuys via GitGitGadget
2020-08-17 15:39 ` [PATCH 4/4] refs: read FETCH_HEAD generically Han-Wen Nienhuys via GitGitGadget
2020-08-17 19:40 ` [PATCH 0/4] Handle " Junio C Hamano
2020-08-19 14:27 ` [PATCH v2 0/4] Handle FETCH_HEAD and MERGE_HEAD generically Han-Wen Nienhuys via GitGitGadget
2020-08-19 14:27   ` [PATCH v2 1/4] refs: split off reading loose ref data in separate function Han-Wen Nienhuys via GitGitGadget
2020-08-19 14:27   ` [PATCH v2 2/4] refs: fix comment about submodule ref_stores Han-Wen Nienhuys via GitGitGadget
2020-08-19 14:27   ` [PATCH v2 3/4] refs: move gitdir into base ref_store Han-Wen Nienhuys via GitGitGadget
2020-08-19 14:27   ` [PATCH v2 4/4] refs: read FETCH_HEAD and MERGE_HEAD generically Han-Wen Nienhuys via GitGitGadget
2020-08-19 21:09   ` Junio C Hamano [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq1rk2tka1.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=hanwenn@gmail.com \
    --subject='Re: [PATCH v2 0/4] Handle FETCH_HEAD and MERGE_HEAD generically' \
    /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

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).