Closed uu1101 closed 8 years ago
I'm not entirely sure. I think the second option is bet: run on the top level directory.
Hello,
Glad to see you back. Yes, what about the following?
diff --git i/git-reintegrate w/git-reintegrate
index 44bf054..39121f7 100755
--- i/git-reintegrate
+++ w/git-reintegrate
@@ -687,6 +687,9 @@ $autocontinue = true
opts.parse
+$git_cdup = %x[git rev-parse --show-cdup].chomp
+die "You need to run this command from the toplevel of the working tree." unless $git_cdup.empty?
+
$git_dir = %x[git rev-parse --git-dir].chomp
$state_dir = "#{$git_dir}/integration"
diff --git i/test/reintegrate.t w/test/reintegrate.t
index 41dddd0..b260dbd 100755
--- i/test/reintegrate.t
+++ w/test/reintegrate.t
@@ -206,14 +206,14 @@ merge branch4
EOM
EOF
-test_expect_success 'invoking from new subfolder should not fail' '
+test_expect_success 'invoking from subfolder should fail' '
git checkout -b branch4 master &&
commit_file dir4/branch4 branch4 &&
GIT_EDITOR=.git/EDITOR git reintegrate --edit pu &&
git reintegrate --rebuild pu &&
git checkout branch4 &&
cd dir4 &&
- git reintegrate --rebuild pu
+ test_must_fail git reintegrate --rebuild pu
'
test_done
Done. I didn't add the test, but I checked it. Fixed in 094ddf9.
The following test case shows the issue. Note that the
commit_file
function has been updated to be able to create files in a directory.What should the solution look like? Should
cd
s into the working dir's root before integrating. But, should it try to return to the directory it was in? What happens when it does not exist in the integrated commit?