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...