summaryrefslogtreecommitdiff
path: root/t/t4013/diff.show_side
diff options
context:
space:
mode:
authorLibravatar Elijah Newren <newren@gmail.com>2022-01-26 01:43:45 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-01-26 12:01:54 -0800
commitff5b7913f0af62c26682b0376d0aa2d7f5d74b2e (patch)
treeaad74a2cbc13e6a73598b131a115977a56b08689 /t/t4013/diff.show_side
parentt2501: simplify the tests since we can now assume desired behavior (diff)
downloadtgif-ff5b7913f0af62c26682b0376d0aa2d7f5d74b2e.tar.xz
sequencer, stash: fix running from worktree subdir
In commits bc3ae46b42 ("rebase: do not attempt to remove startup_info->original_cwd", 2021-12-09) and 0fce211ccc ("stash: do not attempt to remove startup_info->original_cwd", 2021-12-09), we wanted to allow the subprocess to know which directory the parent process was running from, so that the subprocess could protect it. However... When run from a non-main worktree, setup_git_directory() will note that the discovered git directory (/PATH/TO/.git/worktree/non-main-worktree) does not match DEFAULT_GIT_DIR_ENVIRONMENT (see setup_discovered_git_dir()), and decide to set GIT_DIR in the environment. This matters because... Whenever git is run with the GIT_DIR environment variable set, and GIT_WORK_TREE not set, it presumes that '.' is the working tree. So... This combination results in the subcommand being very confused about the working tree. Fix it by also setting the GIT_WORK_TREE environment variable along with setting cmd.dir. A possibly more involved fix we could consider for later would be to make setup.c set GIT_WORK_TREE whenever (a) it discovers both the git directory and the working tree and (b) it decides to set GIT_DIR in the environment. I did not attempt that here as such would be too big of a change for a 2.35.1 release. Test-case-by: Glen Choo <chooglen@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.show_side')
0 files changed, 0 insertions, 0 deletions