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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

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

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,



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux