Skip to content

Commit 9180fea

Browse files
kusmagitster
authored andcommitted
rebase: report invalid commit correctly
In 9765b6a (rebase: align variable content, 2011-02-06), the code to error out was moved up one level. Unfortunately, one reference to a function parameter wasn't rewritten as it should, leading to the wrong parameter being errored on. This error was propagated by 71786f5 (rebase: factor out reference parsing, 2011-02-06) and merged in 78c6e0f (Merge branch 'mz/rebase', 2011-04-28). Correct this by reporting $onto_name istead. Reported-By: Manuela Hutter <[email protected]> Signed-off-by: Erik Faye-Lund <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 71786f5 commit 9180fea

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

git-rebase.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ case "$onto_name" in
469469
;;
470470
*)
471471
onto=$(git rev-parse --verify "${onto_name}^0") ||
472-
die "Does not point to a valid commit: $1"
472+
die "Does not point to a valid commit: $onto_name"
473473
;;
474474
esac
475475

t/t3406-rebase-message.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,9 @@ test_expect_success 'rebase -n overrides config rebase.stat config' '
6262
! grep "^ fileX | *1 +$" diffstat.txt
6363
'
6464

65+
test_expect_success 'rebase --onto outputs the invalid ref' '
66+
test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err &&
67+
grep "invalid-ref" err
68+
'
69+
6570
test_done

0 commit comments

Comments
 (0)