@matheusbsbs / matheus-bagliano / commits / 97b88dd58c
Fork 0

git-rebase.sh: Fix --merge --abort failures when path contains whitespace

Also update t/t3407-rebase-abort.sh to expose the bug. Signed-off-by: Bryan Donlan <bdonlan@fushizen.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Bryan Donlan committed May 4, 2008 at 01:37 UTC 97b88dd58cad9d60427af9a956f90f7803f55db8
2 files changed +22 -13
git-rebase.sh
+1 -1
@@ -214,7 +214,7 @@ do
214 else
215 die "No rebase in progress?"
216 fi
217 - git reset --hard $(cat $dotest/orig-head)
217 + git reset --hard $(cat "$dotest/orig-head")
218 rm -r "$dotest"
219 exit
220 ;;
t/t3407-rebase-abort.sh
+21 -12
@@ -4,7 +4,13 @@ test_description='git rebase --abort tests'
4
5 . ./test-lib.sh
6
7 +### Test that we handle space characters properly
8 +work_dir="$(pwd)/test dir"
9 +
10 test_expect_success setup '
11 + mkdir -p "$work_dir" &&
12 + cd "$work_dir" &&
13 + git init &&
14 echo a > a &&
15 git add a &&
16 git commit -m a &&
@@ -28,32 +34,35 @@ testrebase() {
34 dotest=$2
35
36 test_expect_success "rebase$type --abort" '
37 + cd "$work_dir" &&
38 # Clean up the state from the previous one
32 - git reset --hard pre-rebase
33 - test_must_fail git rebase'"$type"' master &&
34 - test -d '$dotest' &&
39 + git reset --hard pre-rebase &&
40 + test_must_fail git rebase$type master &&
41 + test -d "$dotest" &&
42 git rebase --abort &&
43 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
37 - test ! -d '$dotest'
44 + test ! -d "$dotest"
45 '
46
47 test_expect_success "rebase$type --abort after --skip" '
48 + cd "$work_dir" &&
49 # Clean up the state from the previous one
42 - git reset --hard pre-rebase
43 - test_must_fail git rebase'"$type"' master &&
44 - test -d '$dotest' &&
50 + git reset --hard pre-rebase &&
51 + test_must_fail git rebase$type master &&
52 + test -d "$dotest" &&
53 test_must_fail git rebase --skip &&
54 test $(git rev-parse HEAD) = $(git rev-parse master) &&
55 git-rebase --abort &&
56 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
49 - test ! -d '$dotest'
57 + test ! -d "$dotest"
58 '
59
60 test_expect_success "rebase$type --abort after --continue" '
61 + cd "$work_dir" &&
62 # Clean up the state from the previous one
54 - git reset --hard pre-rebase
55 - test_must_fail git rebase'"$type"' master &&
56 - test -d '$dotest' &&
63 + git reset --hard pre-rebase &&
64 + test_must_fail git rebase$type master &&
65 + test -d "$dotest" &&
66 echo c > a &&
67 echo d >> a &&
68 git add a &&
@@ -61,7 +70,7 @@ testrebase() {
70 test $(git rev-parse HEAD) != $(git rev-parse master) &&
71 git rebase --abort &&
72 test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
64 - test ! -d '$dotest'
73 + test ! -d "$dotest"
74 '
75 }
76