File tree Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 436
436
shift
437
437
;;
438
438
esac
439
- upstream=` git rev-parse --verify " ${upstream_name} ^0 " ` ||
439
+ upstream=$( peel_committish " ${upstream_name} " ) ||
440
440
die " $( eval_gettext " invalid upstream \$ upstream_name" ) "
441
441
upstream_arg=" $upstream_name "
442
442
else
@@ -472,7 +472,7 @@ case "$onto_name" in
472
472
fi
473
473
;;
474
474
* )
475
- onto=$( git rev-parse --verify " ${ onto_name} ^0 " ) ||
475
+ onto=$( peel_committish " $ onto_name" ) ||
476
476
die " $( eval_gettext " Does not point to a valid commit: \$ onto_name" ) "
477
477
;;
478
478
esac
Original file line number Diff line number Diff line change @@ -313,3 +313,15 @@ then
313
313
}
314
314
: ${GIT_OBJECT_DIRECTORY=" $GIT_DIR /objects" }
315
315
fi
316
+
317
+ peel_committish () {
318
+ case " $1 " in
319
+ :/* )
320
+ peeltmp=$( git rev-parse --verify " $1 " ) &&
321
+ git rev-parse --verify " ${peeltmp} ^0"
322
+ ;;
323
+ * )
324
+ git rev-parse --verify " ${1} ^0"
325
+ ;;
326
+ esac
327
+ }
Original file line number Diff line number Diff line change @@ -59,6 +59,17 @@ test_expect_success 'rebase against master' '
59
59
git rebase master
60
60
'
61
61
62
+ test_expect_success ' rebase, with <onto> and <upstream> specified as :/quuxery' '
63
+ test_when_finished "git branch -D torebase" &&
64
+ git checkout -b torebase my-topic-branch^ &&
65
+ upstream=$(git rev-parse ":/Add B") &&
66
+ onto=$(git rev-parse ":/Add A") &&
67
+ git rebase --onto $onto $upstream &&
68
+ git reset --hard my-topic-branch^ &&
69
+ git rebase --onto ":/Add A" ":/Add B" &&
70
+ git checkout my-topic-branch
71
+ '
72
+
62
73
test_expect_success ' the rebase operation should not have destroyed author information' '
63
74
! (git log | grep "Author:" | grep "<>")
64
75
'
Original file line number Diff line number Diff line change @@ -939,4 +939,15 @@ test_expect_success 'rebase -i respects core.commentchar' '
939
939
test B = $(git cat-file commit HEAD^ | sed -ne \$p)
940
940
'
941
941
942
+ test_expect_success ' rebase -i, with <onto> and <upstream> specified as :/quuxery' '
943
+ test_when_finished "git branch -D torebase" &&
944
+ git checkout -b torebase branch1 &&
945
+ upstream=$(git rev-parse ":/J") &&
946
+ onto=$(git rev-parse ":/A") &&
947
+ git rebase --onto $onto $upstream &&
948
+ git reset --hard branch1 &&
949
+ git rebase --onto ":/A" ":/J" &&
950
+ git checkout branch1
951
+ '
952
+
942
953
test_done
You can’t perform that action at this time.
0 commit comments