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

Re: [PATCH 2/5] refs.c: write updates to packed refs when a transaction has more than one ref

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 29, 2014, 21:09 UTC
Message-ID
<xmqq4mxz3m8q.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1406310926-4080-3-git-send-email-sahlberg@google.com>
Ronnie Sahlberg <sahlberg@google.com> writes:
Show 23 quoted lines
> +	/*
> +	 * Always copy loose refs that are to be deleted to the packed refs.
> +	 * If we are updating multiple refs then copy all non symref refs
> +	 * to the packed refs too.
> +	 */
>  	for (i = 0; i < n; i++) {
>  		struct ref_update *update = updates[i];
>  		unsigned char sha1[20];
> +		int flag;
>  
>  		if (update->update_type != UPDATE_SHA1)
>  			continue;
> -		if (!is_null_sha1(update->new_sha1))
> +		if (num_updates < 2 && !is_null_sha1(update->new_sha1))
>  			continue;
>  		if (get_packed_ref(update->refname))
>  			continue;
>  		if (!resolve_ref_unsafe(update->refname, sha1,
> -					RESOLVE_REF_READING, NULL))
> +					RESOLVE_REF_READING, &flag))
> +			continue;
> +		if (flag & REF_ISSYMREF)
>  			continue;
This skipping of symref didn't use to be here.

Is this an enhancement needed to implement the new "feature" (i.e. use packed refs to represent multi-update as an atomic operation)? It looks to me more like an unrelated "oops, forgot that we cannot use packed refs to store symrefs" fix-up, unless no caller passed symref in updates[] in the original code, and now we have callers that do.

Puzzled...
Previous: Ronnie SahlbergNext: Ronnie Sahlberg
Message 4 of 10 in “use packed refs for ref-transactions”
  1. 0/5 use packed refs for ref-transactionsRonnie Sahlberg, Jul 25, 2014
  2. 1/5 refs.c: move reflog updates into its own functionRonnie Sahlberg, Jul 25, 2014
  3. 2/5 refs.c: write updates to packed refs when a transaction has more than one refRonnie Sahlberg, Jul 25, 2014
  4. Junio C HamanoJul 29, 2014
  5. Ronnie SahlbergJul 30, 2014
  6. Junio C HamanoJul 29, 2014
  7. Ronnie SahlbergJul 30, 2014
  8. 3/5 remote.c: use a transaction for deleting refsRonnie Sahlberg, Jul 25, 2014
  9. 4/5 refs.c: make repack_without_refs staticRonnie Sahlberg, Jul 25, 2014
  10. 5/5 refs.c: make the *_packed_refs functions staticRonnie Sahlberg, Jul 25, 2014

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.