From ecd81dfc79cf12cc21fc0340da8ca8fcc5aa58a7 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Mon, 6 Dec 2021 22:05:05 +0000 Subject: tmp-objdir: disable ref updates when replacing the primary odb When creating a subprocess with a temporary ODB, we set the GIT_QUARANTINE_ENVIRONMENT env var to tell child Git processes not to update refs, since the tmp-objdir may go away. Introduce a similar mechanism for in-process temporary ODBs when we call tmp_objdir_replace_primary_odb. Now both mechanisms set the disable_ref_updates flag on the odb, which is queried by the ref_transaction_prepare function. Peff's test case [1] was invoking ref updates via the cachetextconv setting. That particular code silently does nothing when a ref update is forbidden. See the call to notes_cache_put in fill_textconv where errors are ignored. [1] https://lore.kernel.org/git/YVOn3hDsb5pnxR53@coredump.intra.peff.net/ Reported-by: Jeff King Signed-off-by: Neeraj Singh Reviewed-by: Elijah Newren Signed-off-by: Junio C Hamano --- object-store.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'object-store.h') diff --git a/object-store.h b/object-store.h index 74b1b5872a..62a0c97f27 100644 --- a/object-store.h +++ b/object-store.h @@ -27,6 +27,13 @@ struct object_directory { uint32_t loose_objects_subdir_seen[8]; /* 256 bits */ struct oidtree *loose_objects_cache; + /* + * This is a temporary object store created by the tmp_objdir + * facility. Disable ref updates since the objects in the store + * might be discarded on rollback. + */ + int disable_ref_updates; + /* * This object store is ephemeral, so there is no need to fsync. */ -- cgit v1.2.3