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

[PATCH v2 1/9] files_transaction_prepare(): don't leak flags to packed transaction

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Nov 5, 2017, 08:42 UTC
Message-ID
<b8e61183ad5d5c046a9eff75ea0401cf2c2567c6.1509870243.git.mhagger@alum.mit.edu>
In-Reply-To
<cover.1509870243.git.mhagger@alum.mit.edu>

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>
---
 refs/files-backend.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 2bd54e11ae..fadf1036d3 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -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);
 		}
 	}
-- 
2.14.1
Previous: Michael HaggertyNext: Michael Haggerty
Message 2 of 12 in “Tidy up the constants related to ref_update::flags”
  1. 0/9 Tidy up the constants related to ref_update::flagsMichael Haggerty, Nov 5, 2017
  2. 1/9 files_transaction_prepare(): don't leak flags to packed transactionMichael Haggerty, Nov 5, 2017
  3. 7/9 refs: rename constant `REF_ISPRUNING` to `REF_IS_PRUNING`Michael Haggerty, Nov 5, 2017
  4. 8/9 write_packed_entry(): take `object_id` argumentsMichael Haggerty, Nov 5, 2017
  5. 9/9 refs: update some more docs to use "oid" rather than "sha1"Michael Haggerty, Nov 5, 2017
  6. 5/9 refs: tidy up and adjust visibility of the `ref_update` flagsMichael Haggerty, Nov 5, 2017
  7. 6/9 refs: rename constant `REF_NODEREF` to `REF_NO_DEREF`Michael Haggerty, Nov 5, 2017
  8. 2/9 prune_ref(): call `ref_transaction_add_update()` directlyMichael Haggerty, Nov 5, 2017
  9. 3/9 ref_transaction_update(): die on disallowed flagsMichael Haggerty, Nov 5, 2017
  10. Martin ÅgrenNov 7, 2017
  11. Thomas GummererNov 7, 2017
  12. 4/9 ref_transaction_add_update(): remove a checkMichael Haggerty, Nov 5, 2017

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.