{"thread":{"id":"36419","subject":"[PATCH v2] git-rebase: Print name of rev when using shorthand","startedAt":"2014-04-16T08:31:48Z","lastAt":"2014-04-16T08:31:48Z","messageCount":1,"participants":["Brian Gesiak"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"238919","messageId":"1397637108-51129-1-git-send-email-modocache@gmail.com","threadId":"36419","inReplyTo":null,"subject":"[PATCH v2] git-rebase: Print name of rev when using shorthand","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-04-16T08:31:48Z","receivedAt":"2014-04-16T08:31:48Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"The output from a successful invocation of the shorthand command\n\"git rebase -\" is something like \"Fast-forwarded HEAD to @{-1}\",\nwhich includes a relative reference to a revision. Other commands\nthat use the shorthand \"-\", such as \"git checkout -\", typically\ndisplay the symbolic name of the revision.\n\nChange rebase to output the symbolic name of the revision when using\nthe shorthand. For the example above, the new output is\n\"Fast-forwarded HEAD to master\", assuming \"@{-1}\" is a reference to\n\"master\".\n\n- Use \"git rev-parse\" to retreive the name of the rev.\n- Update the tests in light of this new behavior.\n\nRequested-by: John Keeping <john@keeping.me.uk>\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n git-rebase.sh     | 8 +++++++-\n t/t3400-rebase.sh | 4 +---\n 2 files changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 2c75e9f..42d34a6 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -455,7 +455,13 @@ then\n \t*)\tupstream_name=\"$1\"\n \t\tif test \"$upstream_name\" = \"-\"\n \t\tthen\n-\t\t\tupstream_name=\"@{-1}\"\n+\t\t\tupstream_name=`git rev-parse --symbolic-full-name @{-1}`\n+\t\t\tif test -n \"$upstream_name\"\n+\t\t\tthen\n+\t\t\t\tupstream_name=${upstream_name#refs/heads/}\n+\t\t\telse\n+\t\t\t\tupstream_name=\"@{-1}\"\n+\t\t\tfi\n \t\tfi\n \t\tshift\n \t\t;;\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex 80e0a95..2b99940 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -91,7 +91,7 @@ test_expect_success 'rebase from ambiguous branch name' '\n test_expect_success 'rebase off of the previous branch using \"-\"' '\n \tgit checkout master &&\n \tgit checkout HEAD^ &&\n-\tgit rebase @{-1} >expect.messages &&\n+\tgit rebase master >expect.messages &&\n \tgit merge-base master HEAD >expect.forkpoint &&\n \n \tgit checkout master &&\n@@ -100,8 +100,6 @@ test_expect_success 'rebase off of the previous branch using \"-\"' '\n \tgit merge-base master HEAD >actual.forkpoint &&\n \n \ttest_cmp expect.forkpoint actual.forkpoint &&\n-\t# the next one is dubious---we may want to say \"-\",\n-\t# instead of @{-1}, in the message\n \ttest_i18ncmp expect.messages actual.messages\n '\n \n-- \n1.9.0.259.gc5d75e8.dirty\n"}]}