summaryrefslogtreecommitdiff
path: root/refs/files-backend.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-31 22:04:20 -0700
committerJunio C Hamano <gitster@pobox.com>2018-03-31 22:04:20 -0700
commit5ed23425407c16c17ae07a4bc427c663ef82cd95 (patch)
treed13b8b846004d87d3bd73f1ab2043e9d35b0fd95 /refs/files-backend.c
parent97fc5de7934376e978509677fec1debdbd14bcdf (diff)
parentfb9c2d27039a23457cb9710d86e00c51dfb910dc (diff)
downloadgit-5ed23425407c16c17ae07a4bc427c663ef82cd95.tar.gz
Merge branch 'jk/relative-directory-fix' into pupu
Some codepaths, including the refs API, get and keep relative paths, that go out of sync when the process does chdir(2). The chdir-notify API is introduced to let these codepaths adjust these cached paths to the new current directory. * jk/relative-directory-fix: refs: use chdir_notify to update cached relative paths set_work_tree: use chdir_notify add chdir-notify API trace.c: export trace_setup_key set_git_dir: die when setenv() fails
Diffstat (limited to 'refs/files-backend.c')
-rw-r--r--refs/files-backend.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index bec8e30e9e..a92a2aa821 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -9,6 +9,7 @@
#include "../lockfile.h"
#include "../object.h"
#include "../dir.h"
+#include "../chdir-notify.h"
/*
* This backend uses the following flags in `ref_update::flags` for
@@ -106,6 +107,11 @@ static struct ref_store *files_ref_store_create(const char *gitdir,
refs->packed_ref_store = packed_ref_store_create(sb.buf, flags);
strbuf_release(&sb);
+ chdir_notify_reparent("files-backend $GIT_DIR",
+ &refs->gitdir);
+ chdir_notify_reparent("files-backend $GIT_COMMONDIR",
+ &refs->gitcommondir);
+
return ref_store;
}