summaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-01-04 00:24:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-01-04 00:24:15 (GMT)
commit0dc90d954db852c6604796b8d817365f94e92a16 (patch)
tree9d4cf45af85370e4e7c89e74ff6ba74b39a28579 /environment.c
parent8bb565d375e14ecbd31dee022b8b28e507e38674 (diff)
parentecd81dfc79cf12cc21fc0340da8ca8fcc5aa58a7 (diff)
downloadgit-0dc90d954db852c6604796b8d817365f94e92a16.zip
git-0dc90d954db852c6604796b8d817365f94e92a16.tar.gz
git-0dc90d954db852c6604796b8d817365f94e92a16.tar.bz2
Merge branch 'ns/tmp-objdir'
New interface into the tmp-objdir API to help in-core use of the quarantine feature. * ns/tmp-objdir: tmp-objdir: disable ref updates when replacing the primary odb tmp-objdir: new API for creating temporary writable databases
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/environment.c b/environment.c
index 0d06a31..fd0501e 100644
--- a/environment.c
+++ b/environment.c
@@ -17,6 +17,7 @@
#include "commit.h"
#include "strvec.h"
#include "object-store.h"
+#include "tmp-objdir.h"
#include "chdir-notify.h"
#include "shallow.h"
@@ -169,6 +170,10 @@ void setup_git_env(const char *git_dir)
args.graft_file = getenv_safe(&to_free, GRAFT_ENVIRONMENT);
args.index_file = getenv_safe(&to_free, INDEX_ENVIRONMENT);
args.alternate_db = getenv_safe(&to_free, ALTERNATE_DB_ENVIRONMENT);
+ if (getenv(GIT_QUARANTINE_ENVIRONMENT)) {
+ args.disable_ref_updates = 1;
+ }
+
repo_set_gitdir(the_repository, git_dir, &args);
strvec_clear(&to_free);
@@ -332,10 +337,14 @@ static void update_relative_gitdir(const char *name,
void *data)
{
char *path = reparent_relative_path(old_cwd, new_cwd, get_git_dir());
+ struct tmp_objdir *tmp_objdir = tmp_objdir_unapply_primary_odb();
+
trace_printf_key(&trace_setup_key,
"setup: move $GIT_DIR to '%s'",
path);
set_git_dir_1(path);
+ if (tmp_objdir)
+ tmp_objdir_reapply_primary_odb(tmp_objdir, old_cwd, new_cwd);
free(path);
}