summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-04-25 13:28:52 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-04-25 13:28:52 +0900
commitff6eb825f0aa1f45230c10fbb0cf8d484c927c55 (patch)
treee64f3f038b0f888c0ddc0a5c97e0d266068b82a4 /t
parentMerge branch 'jk/flockfile-stdio' (diff)
parentrefs: use chdir_notify to update cached relative paths (diff)
downloadtgif-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 't')
-rwxr-xr-xt/t1501-work-tree.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh
index 02cf2013fc..9c0bc65250 100755
--- a/t/t1501-work-tree.sh
+++ b/t/t1501-work-tree.sh
@@ -431,4 +431,16 @@ test_expect_success 'error out gracefully on invalid $GIT_WORK_TREE' '
)
'
+test_expect_success 'refs work with relative gitdir and work tree' '
+ git init relative &&
+ git -C relative commit --allow-empty -m one &&
+ git -C relative commit --allow-empty -m two &&
+
+ GIT_DIR=relative/.git GIT_WORK_TREE=relative git reset HEAD^ &&
+
+ git -C relative log -1 --format=%s >actual &&
+ echo one >expect &&
+ test_cmp expect actual
+'
+
test_done