diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-04-25 13:28:52 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-25 13:28:52 +0900 |
commit | ff6eb825f0aa1f45230c10fbb0cf8d484c927c55 (patch) | |
tree | e64f3f038b0f888c0ddc0a5c97e0d266068b82a4 /refs | |
parent | Merge branch 'jk/flockfile-stdio' (diff) | |
parent | refs: use chdir_notify to update cached relative paths (diff) | |
download | tgif-ff6eb825f0aa1f45230c10fbb0cf8d484c927c55.tar.xz |
Merge branch 'jk/relative-directory-fix'
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')
-rw-r--r-- | refs/files-backend.c | 6 | ||||
-rw-r--r-- | refs/packed-backend.c | 3 |
2 files changed, 9 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; } diff --git a/refs/packed-backend.c b/refs/packed-backend.c index 65288c6472..369c34f886 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -5,6 +5,7 @@ #include "packed-backend.h" #include "../iterator.h" #include "../lockfile.h" +#include "../chdir-notify.h" enum mmap_strategy { /* @@ -202,6 +203,8 @@ struct ref_store *packed_ref_store_create(const char *path, refs->store_flags = store_flags; refs->path = xstrdup(path); + chdir_notify_reparent("packed-refs", &refs->path); + return ref_store; } |