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 436436 shift
437437 ;;
438438 esac
439- upstream=` git rev-parse --verify " ${upstream_name} ^0 " ` ||
439+ upstream=$( peel_committish " ${upstream_name} " ) ||
440440 die " $( eval_gettext " invalid upstream \$ upstream_name" ) "
441441 upstream_arg=" $upstream_name "
442442else
@@ -472,7 +472,7 @@ case "$onto_name" in
472472 fi
473473 ;;
474474* )
475- onto=$( git rev-parse --verify " ${ onto_name} ^0 " ) ||
475+ onto=$( peel_committish " $ onto_name" ) ||
476476 die " $( eval_gettext " Does not point to a valid commit: \$ onto_name" ) "
477477 ;;
478478esac
Original file line number Diff line number Diff line change @@ -313,3 +313,15 @@ then
313313 }
314314 : ${GIT_OBJECT_DIRECTORY=" $GIT_DIR /objects" }
315315fi
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' '
5959 git rebase master
6060'
6161
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+
6273test_expect_success ' the rebase operation should not have destroyed author information' '
6374 ! (git log | grep "Author:" | grep "<>")
6475'
Original file line number Diff line number Diff line change @@ -939,4 +939,15 @@ test_expect_success 'rebase -i respects core.commentchar' '
939939 test B = $(git cat-file commit HEAD^ | sed -ne \$p)
940940'
941941
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+
942953test_done
You can’t perform that action at this time.
0 commit comments