{"thread":{"id":"30651","subject":"calling git rebase with invalid onto-ref exits with wrong error message","startedAt":"2012-05-30T09:02:05Z","lastAt":"2012-05-30T21:11:01Z","messageCount":5,"participants":["Manuela Hutter","Erik Faye-Lund","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"192462","messageId":"op.we351rjtt21y7h@id-c1003.oslo.osa","threadId":"30651","inReplyTo":null,"subject":"calling git rebase with invalid onto-ref exits with wrong error message","fromName":"Manuela Hutter","fromEmail":"manuelah@opera.com","sentAt":"2012-05-30T09:02:05Z","receivedAt":"2012-05-30T09:02:05Z","isPatch":false,"sender":{"key":"manuelah@opera.com","avatar":null},"body":"Just noticed a small bug (in git version 1.7.10.msysgit.1):\n\ncalling\n   git rebase --onto <onto-ref> <base-ref> <branch-ref>\n\nwith an unknown <onto-ref> reports:\n   fatal: Needed a single revision\n   Does not point to a valid commit: <branch-ref>\n\nExpected:\n   fatal: Needed a single revision\n   Does not point to a valid commit: <onto-ref>\n\nCheers,\nManuela\n"},{"id":"192463","messageId":"CABPQNSZntbPQ7taPhr_QUNnwzOcexjteUsnpmrkCiRUYRA3nvA@mail.gmail.com","threadId":"30651","inReplyTo":"op.we351rjtt21y7h@id-c1003.oslo.osa","subject":"Re: calling git rebase with invalid onto-ref exits with wrong error message","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-05-30T09:27:02Z","receivedAt":"2012-05-30T09:27:02Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Wed, May 30, 2012 at 11:02 AM, Manuela Hutter <manuelah@opera.com> wrote:\n> Just noticed a small bug (in git version 1.7.10.msysgit.1):\n>\n> calling\n>   git rebase --onto <onto-ref> <base-ref> <branch-ref>\n>\n> with an unknown <onto-ref> reports:\n>   fatal: Needed a single revision\n>   Does not point to a valid commit: <branch-ref>\n>\n> Expected:\n>   fatal: Needed a single revision\n>   Does not point to a valid commit: <onto-ref>\n>\n\nIndeed. This looks like the result of a bad merge-resolution, but I\ncould be mistaken. This looks like the correct solution to me:\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 24a2840..3267c92 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -423,7 +423,7 @@ case \"$onto_name\" in\n \t;;\n *)\n \tonto=$(git rev-parse --verify \"${onto_name}^0\") ||\n-\tdie \"Does not point to a valid commit: $1\"\n+\tdie \"Does not point to a valid commit: $onto_name\"\n \t;;\n esac\n"},{"id":"192489","messageId":"7v7gvt1xz6.fsf@alter.siamese.dyndns.org","threadId":"30651","inReplyTo":"CABPQNSZntbPQ7taPhr_QUNnwzOcexjteUsnpmrkCiRUYRA3nvA@mail.gmail.com","subject":"Re: calling git rebase with invalid onto-ref exits with wrong error message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-30T15:37:33Z","receivedAt":"2012-05-30T15:37:33Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Faye-Lund <kusmabite@gmail.com> writes:\n\n> Indeed. This looks like the result of a bad merge-resolution, but I\n> could be mistaken.\n\nIt looks like 9765b6a (rebase: align variable content, 2011-02-06)\noriginally botched it, which propagated to 71786f5 (rebase: factor\nout reference parsing, 2011-02-06) in the series, and finally merged\nat 78c6e0f (Merge branch 'mz/rebase', 2011-04-28).\n\n> This looks like the correct solution to me:\n>\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index 24a2840..3267c92 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -423,7 +423,7 @@ case \"$onto_name\" in\n>  \t;;\n>  *)\n>  \tonto=$(git rev-parse --verify \"${onto_name}^0\") ||\n> -\tdie \"Does not point to a valid commit: $1\"\n> +\tdie \"Does not point to a valid commit: $onto_name\"\n>  \t;;\n>  esac\n\nYes, it does.\n"},{"id":"192491","messageId":"1338395982-5448-1-git-send-email-kusmabite@gmail.com","threadId":"30651","inReplyTo":"7v7gvt1xz6.fsf@alter.siamese.dyndns.org","subject":"[PATCH] rebase: report invalid commit correctly","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-05-30T16:39:42Z","receivedAt":"2012-05-30T16:39:42Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"In 9765b6a (rebase: align variable content, 2011-02-06), the code\nto error out was moved up one level. Unfortunately, one reference\nto a function parameter wasn't rewritten as it should, leading to\nthe wrong parameter being errored on.\n\nThis error was propagated by 71786f5 (rebase: factor out reference\nparsing, 2011-02-06) and merged in 78c6e0f (Merge branch\n'mz/rebase', 2011-04-28).\n\nCorrect this by reporting $onto_name istead.\n\nReported-By: Manuela Hutter <manuelah@opera.com>\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n\nHere's a proper patch, I guess.\n\nOn Wed, May 30, 2012 at 5:37 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Erik Faye-Lund <kusmabite@gmail.com> writes:\n>\n>> Indeed. This looks like the result of a bad merge-resolution, but I\n>> could be mistaken.\n>\n> It looks like 9765b6a (rebase: align variable content, 2011-02-06)\n> originally botched it, which propagated to 71786f5 (rebase: factor\n> out reference parsing, 2011-02-06) in the series, and finally merged\n> at 78c6e0f (Merge branch 'mz/rebase', 2011-04-28).\n>\n\nThanks for digging, this was very helpful for the commit message.\n\n git-rebase.sh             | 2 +-\n t/t3406-rebase-message.sh | 5 +++++\n 2 files changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 24a2840..3267c92 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -423,7 +423,7 @@ case \"$onto_name\" in\n \t;;\n *)\n \tonto=$(git rev-parse --verify \"${onto_name}^0\") ||\n-\tdie \"Does not point to a valid commit: $1\"\n+\tdie \"Does not point to a valid commit: $onto_name\"\n \t;;\n esac\n \ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex fe5f936..6898377 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -62,4 +62,9 @@ test_expect_success 'rebase -n overrides config rebase.stat config' '\n         ! grep \"^ fileX |  *1 +$\" diffstat.txt\n '\n \n+test_expect_success 'rebase --onto outputs the invalid ref' '\n+\ttest_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err &&\n+\tgrep \"invalid-ref\" err\n+'\n+\n test_done\n-- \n1.7.10.msysgit.1.1147.g20e60f3\n"},{"id":"192509","messageId":"7vvcjdxtlm.fsf@alter.siamese.dyndns.org","threadId":"30651","inReplyTo":"1338395982-5448-1-git-send-email-kusmabite@gmail.com","subject":"Re: [PATCH] rebase: report invalid commit correctly","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-30T21:11:01Z","receivedAt":"2012-05-30T21:11:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Faye-Lund <kusmabite@gmail.com> writes:\n\n> In 9765b6a (rebase: align variable content, 2011-02-06), the code\n> to error out was moved up one level. Unfortunately, one reference\n> to a function parameter wasn't rewritten as it should, leading to\n> the wrong parameter being errored on.\n>\n> This error was propagated by 71786f5 (rebase: factor out reference\n> parsing, 2011-02-06) and merged in 78c6e0f (Merge branch\n> 'mz/rebase', 2011-04-28).\n>\n> Correct this by reporting $onto_name istead.\n>\n> Reported-By: Manuela Hutter <manuelah@opera.com>\n> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n> ---\n>\n> Here's a proper patch, I guess.\n\nThanks.\n"}]}