git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 0/4] Handle FETCH_HEAD and MERGE_HEAD generically

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 19, 2020, 21:09 UTC
Message-ID
<xmqq1rk2tka1.fsf@gitster.c.googlers.com>
In-Reply-To
<pull.705.v2.git.1597847278.gitgitgadget@gmail.com>
"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.
Show 27 quoted lines
>      -+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,
Previous: Han-Wen Nienhuys via GitGitGadget
Message 12 of 12 in “Handle FETCH_HEAD generically”
  1. 0/4 Handle FETCH_HEAD genericallyHan-Wen Nienhuys via GitGitGadget, Aug 17, 2020
  2. 1/4 Split off reading loose ref data in separate functionHan-Wen Nienhuys via GitGitGadget, Aug 17, 2020
  3. 2/4 refs: fix comment about submodule ref_storesHan-Wen Nienhuys via GitGitGadget, Aug 17, 2020
  4. 3/4 refs: move gitdir into base ref_storeHan-Wen Nienhuys via GitGitGadget, Aug 17, 2020
  5. 4/4 refs: read FETCH_HEAD genericallyHan-Wen Nienhuys via GitGitGadget, Aug 17, 2020
  6. Junio C HamanoAug 17, 2020
  7. 0/4 Handle FETCH_HEAD and MERGE_HEAD genericallyHan-Wen Nienhuys via GitGitGadget, Aug 19, 2020
  8. 2/4 refs: fix comment about submodule ref_storesHan-Wen Nienhuys via GitGitGadget, Aug 19, 2020
  9. 3/4 refs: move gitdir into base ref_storeHan-Wen Nienhuys via GitGitGadget, Aug 19, 2020
  10. 4/4 refs: read FETCH_HEAD and MERGE_HEAD genericallyHan-Wen Nienhuys via GitGitGadget, Aug 19, 2020
  11. 1/4 refs: split off reading loose ref data in separate functionHan-Wen Nienhuys via GitGitGadget, Aug 19, 2020
  12. Junio C HamanoAug 19, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.