In the preceding commit we have moved the logic that reparents object
database sources on chdir(3p) from "setup.c" into "odb.c". Let's also do
the same for any temporary quarantine directories so that the complete
reparenting logic is self-contained in "odb.c".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
#include "strbuf.h"
#include "strvec.h"
#include "submodule.h"
+#include "tmp-objdir.h"
#include "trace2.h"
#include "write-or-die.h"
void *cb_data)
{
struct object_database *odb = cb_data;
+ struct tmp_objdir *tmp_objdir;
struct odb_source *source;
+ tmp_objdir = tmp_objdir_unapply_primary_odb();
+
/*
* In theory, we only have to do this for the primary object source, as
* alternates' paths are always resolved to an absolute path.
free(source->path);
source->path = path;
}
+
+ if (tmp_objdir)
+ tmp_objdir_reapply_primary_odb(tmp_objdir, old_cwd, new_cwd);
}
struct object_database *odb_new(struct repository *repo,
#include "chdir-notify.h"
#include "path.h"
#include "quote.h"
-#include "tmp-objdir.h"
#include "trace.h"
#include "trace2.h"
#include "worktree.h"
{
char *path = reparent_relative_path(old_cwd, new_cwd,
repo_get_git_dir(the_repository));
- 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, true);
- if (tmp_objdir)
- tmp_objdir_reapply_primary_odb(tmp_objdir, old_cwd, new_cwd);
free(path);
}