提交 9180feaf 编写于 作者: E Erik Faye-Lund 提交者: Junio C Hamano

rebase: report invalid commit correctly

In 9765b6ab (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 71786f54 (rebase: factor out reference
parsing, 2011-02-06) and merged in 78c6e0f3 (Merge branch
'mz/rebase', 2011-04-28).

Correct this by reporting $onto_name istead.
Reported-By: NManuela Hutter <manuelah@opera.com>
Signed-off-by: NErik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 71786f54
...@@ -469,7 +469,7 @@ case "$onto_name" in ...@@ -469,7 +469,7 @@ case "$onto_name" in
;; ;;
*) *)
onto=$(git rev-parse --verify "${onto_name}^0") || onto=$(git rev-parse --verify "${onto_name}^0") ||
die "Does not point to a valid commit: $1" die "Does not point to a valid commit: $onto_name"
;; ;;
esac esac
......
...@@ -62,4 +62,9 @@ test_expect_success 'rebase -n overrides config rebase.stat config' ' ...@@ -62,4 +62,9 @@ test_expect_success 'rebase -n overrides config rebase.stat config' '
! grep "^ fileX | *1 +$" diffstat.txt ! grep "^ fileX | *1 +$" diffstat.txt
' '
test_expect_success 'rebase --onto outputs the invalid ref' '
test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err &&
grep "invalid-ref" err
'
test_done test_done
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册