sequencer: pass absolute GIT_WORK_TREE to exec commands
commitab5e67d7513ac6efb4c0ee9787aeaa41604c0566
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sat, 14 Jul 2018 18:38:59 +0000 (14 18:38 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Jul 2018 18:16:45 +0000 (16 11:16 -0700)
treebe71eb4132e5c6a71c7d1d2433506f9a6b7bbe9c
parenta42a58d7b62cc1d6301440e81a83feed9d7c118c
sequencer: pass absolute GIT_WORK_TREE to exec commands

The sequencer currently passes GIT_DIR, but not GIT_WORK_TREE, to exec
commands.  In that configuration, we assume that whatever directory
we're in is the top level of the work tree, and git rev-parse
--show-toplevel responds accordingly.  However, when we're in a
subdirectory, that isn't correct: we respond with the subdirectory as
the top level, resulting in unexpected behavior.

Ensure that we pass GIT_WORK_TREE as well as GIT_DIR so that git
operations within subdirectories work correctly.

Note that we are guaranteed to have a work tree in this case: the
relevant sequencer functions are called only from revert, cherry-pick,
and rebase--helper; all of these commands require a working tree.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
t/t3404-rebase-interactive.sh