]> git.ipfire.org Git - thirdparty/git.git/commitdiff
files_transaction_prepare(): don't leak flags to packed transaction
authorMichael Haggerty <mhagger@alum.mit.edu>
Sun, 5 Nov 2017 08:42:01 +0000 (09:42 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Nov 2017 01:31:07 +0000 (10:31 +0900)
The files backend uses `ref_update::flags` for several internal flags.
But those flags have no meaning to the packed backend. So when adding
updates for the packed-refs transaction, only use flags that make
sense to the packed backend.

`REF_NODEREF` is part of the public interface, and it's logically what
we want, so include it. In fact it is actually ignored by the packed
backend (which doesn't support symbolic references), but that's its
own business.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c

index 2bd54e11aedf0e081072dbb58d327b969d0948bc..fadf1036d3745bc6367317bb1d1cc6bf62f91a61 100644 (file)
@@ -2594,8 +2594,8 @@ static int files_transaction_prepare(struct ref_store *ref_store,
 
                        ref_transaction_add_update(
                                        packed_transaction, update->refname,
-                                       update->flags & ~REF_HAVE_OLD,
-                                       &update->new_oid, &update->old_oid,
+                                       REF_HAVE_NEW | REF_NODEREF,
+                                       &update->new_oid, NULL,
                                        NULL);
                }
        }