Skip to content

Commit e53dd71

Browse files
committed
Merge branch 'bc/sequencer-export-work-tree-as-well' into pu
* bc/sequencer-export-work-tree-as-well: sequencer: pass absolute GIT_WORK_TREE to exec commands
2 parents bb2a4e1 + ab5e67d commit e53dd71

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

sequencer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,6 +2650,8 @@ static int do_exec(const char *command_line)
26502650
fprintf(stderr, "Executing: %s\n", command_line);
26512651
child_argv[0] = command_line;
26522652
argv_array_pushf(&child_env, "GIT_DIR=%s", absolute_path(get_git_dir()));
2653+
argv_array_pushf(&child_env, "GIT_WORK_TREE=%s",
2654+
absolute_path(get_git_work_tree()));
26532655
status = run_command_v_opt_cd_env(child_argv, RUN_USING_SHELL, NULL,
26542656
child_env.argv);
26552657

t/t3404-rebase-interactive.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ test_expect_success 'rebase -i with exec allows git commands in subdirs' '
134134
)
135135
'
136136

137+
test_expect_success 'rebase -i sets work tree properly' '
138+
test_when_finished "rm -rf subdir" &&
139+
test_when_finished "test_might_fail git rebase --abort" &&
140+
mkdir subdir &&
141+
git rebase -x "(cd subdir && git rev-parse --show-toplevel)" HEAD^ \
142+
>actual &&
143+
! grep "/subdir$" actual
144+
'
145+
137146
test_expect_success 'rebase -i with the exec command checks tree cleanness' '
138147
git checkout master &&
139148
set_fake_editor &&

0 commit comments

Comments
 (0)