{"thread":{"id":"34218","subject":"[PATCH v3 0/7] Re-roll rr/rebase-checkout-reflog","startedAt":"2013-06-19T08:04:42Z","lastAt":"2013-06-24T08:12:09Z","messageCount":14,"participants":["Ramkumar Ramachandra","Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":7},"messages":[{"id":"221358","messageId":"1371629089-27008-1-git-send-email-artagnon@gmail.com","threadId":"34218","inReplyTo":null,"subject":"[PATCH v3 0/7] Re-roll rr/rebase-checkout-reflog","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-19T08:04:42Z","receivedAt":"2013-06-19T08:04:42Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"So, this is hopefully the final re-roll.  [6/7] and [7/7] have updated\ncommit messages and comments describing what this new\nbase_reflog_action is.  Also, to prevent breakages with another\nin-flight topic, the test that Junio contributed to [7/7] uses a\ndifferent branch name.\n\nThanks.\n\nJunio C Hamano (1):\n  t/t7512-status-help: test \"HEAD detached from\"\n\nRamkumar Ramachandra (6):\n  wt-status: remove unused field in grab_1st_switch_cbdata\n  t/t2012-checkout-last: test \"checkout -\" after a rebase\n  status: do not depend on rebase reflog messages\n  checkout: respect GIT_REFLOG_ACTION\n  rebase: write better reflog messages\n  rebase -i: write better reflog messages\n\n builtin/checkout.c            | 11 +++++++---\n git-am.sh                     |  4 +++-\n git-rebase--am.sh             |  7 +++++++\n git-rebase--interactive.sh    | 14 +++++++++----\n git-rebase.sh                 | 18 +++++++++++++++--\n t/t2012-checkout-last.sh      | 34 +++++++++++++++++++++++++++++++\n t/t3404-rebase-interactive.sh | 15 ++++++++++++++\n t/t7512-status-help.sh        | 47 ++++++++++++++++++++++++-------------------\n wt-status.c                   |  7 ++++---\n 9 files changed, 123 insertions(+), 34 deletions(-)\n\n-- \n1.8.3.1.449.g41b32a4.dirty\n"},{"id":"221360","messageId":"1371629089-27008-2-git-send-email-artagnon@gmail.com","threadId":"34218","inReplyTo":"1371629089-27008-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v3 1/7] t/t7512-status-help: test \"HEAD detached from\"","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-19T08:04:43Z","receivedAt":"2013-06-19T08:04:43Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"From: Junio C Hamano <gitster@pobox.com>\n\nb397ea (status: show more info than \"currently not on any branch\",\n2013-03-13) wanted to make sure that after a checkout to detach HEAD,\nthe user can see where the HEAD was originally detached from.  The last\ntest added by that commit to t/status-help shows one example,\nimmediately after HEAD is detached via a checkout.  Enhance that test to\ntest the \"HEAD detached from\" message is displayed when the user further\nresets to another commit.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n t/t7512-status-help.sh | 10 +++++++++-\n 1 file changed, 9 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh\nindex bf08d4e..bafa5e7 100755\n--- a/t/t7512-status-help.sh\n+++ b/t/t7512-status-help.sh\n@@ -667,7 +667,7 @@ test_expect_success 'status when cherry-picking after resolving conflicts' '\n \ttest_i18ncmp expected actual\n '\n \n-test_expect_success 'status showing detached from a tag' '\n+test_expect_success 'status showing detached at and from a tag' '\n \ttest_commit atag tagging &&\n \tgit checkout atag &&\n \tcat >expected <<-\\EOF\n@@ -675,6 +675,14 @@ test_expect_success 'status showing detached from a tag' '\n \tnothing to commit (use -u to show untracked files)\n \tEOF\n \tgit status --untracked-files=no >actual &&\n+\ttest_i18ncmp expected actual &&\n+\n+\tgit reset --hard HEAD^ &&\n+\tcat >expected <<-\\EOF\n+\t# HEAD detached from atag\n+\tnothing to commit (use -u to show untracked files)\n+\tEOF\n+\tgit status --untracked-files=no >actual &&\n \ttest_i18ncmp expected actual\n '\n \n-- \n1.8.3.1.449.g41b32a4.dirty\n"},{"id":"221359","messageId":"1371629089-27008-3-git-send-email-artagnon@gmail.com","threadId":"34218","inReplyTo":"1371629089-27008-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v3 2/7] wt-status: remove unused field in grab_1st_switch_cbdata","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-19T08:04:44Z","receivedAt":"2013-06-19T08:04:44Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"The struct grab_1st_switch_cbdata has the field \"found\", which is\nset in grab_1st_switch() when a match is found.  This information is\nredundant and unused by any code.  The return value of the function\nserves to communicate this information anyway.\n\nRemove the field.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n wt-status.c | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex bf84a86..2511270 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1035,7 +1035,6 @@ got_nothing:\n }\n \n struct grab_1st_switch_cbdata {\n-\tint found;\n \tstruct strbuf buf;\n \tunsigned char nsha1[20];\n };\n@@ -1059,7 +1058,6 @@ static int grab_1st_switch(unsigned char *osha1, unsigned char *nsha1,\n \tfor (end = target; *end && *end != '\\n'; end++)\n \t\t;\n \tstrbuf_add(&cb->buf, target, end - target);\n-\tcb->found = 1;\n \treturn 1;\n }\n \n-- \n1.8.3.1.449.g41b32a4.dirty\n"},{"id":"221362","messageId":"1371629089-27008-4-git-send-email-artagnon@gmail.com","threadId":"34218","inReplyTo":"1371629089-27008-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v3 3/7] t/t2012-checkout-last: test \"checkout -\" after a rebase","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-19T08:04:45Z","receivedAt":"2013-06-19T08:04:45Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"  $ git checkout -\n\ndoes not work as expected after a rebase.  This is because the\nreflog records \"checkout\" made by \"rebase\" as its implementation\ndetail the same way as end-user initiated \"checkout\", and makes it\ncount as the branch that was previously checked out.\n\nAdd four failing tests documenting this bug: two for a normal rebase,\nand another two for an interactive rebase.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t2012-checkout-last.sh | 34 ++++++++++++++++++++++++++++++++++\n 1 file changed, 34 insertions(+)\n\ndiff --git a/t/t2012-checkout-last.sh b/t/t2012-checkout-last.sh\nindex b44de9d..6ad6edf 100755\n--- a/t/t2012-checkout-last.sh\n+++ b/t/t2012-checkout-last.sh\n@@ -116,4 +116,38 @@ test_expect_success 'master...' '\n \ttest \"z$(git rev-parse --verify HEAD)\" = \"z$(git rev-parse --verify master^)\"\n '\n \n+test_expect_failure '\"checkout -\" works after a rebase A' '\n+\tgit checkout master &&\n+\tgit checkout other &&\n+\tgit rebase master &&\n+\tgit checkout - &&\n+\ttest \"z$(git symbolic-ref HEAD)\" = \"zrefs/heads/master\"\n+'\n+\n+test_expect_failure '\"checkout -\" works after a rebase A B' '\n+\tgit branch moodle master~1 &&\n+\tgit checkout master &&\n+\tgit checkout other &&\n+\tgit rebase master moodle &&\n+\tgit checkout - &&\n+\ttest \"z$(git symbolic-ref HEAD)\" = \"zrefs/heads/master\"\n+'\n+\n+test_expect_failure '\"checkout -\" works after a rebase -i A' '\n+\tgit checkout master &&\n+\tgit checkout other &&\n+\tgit rebase -i master &&\n+\tgit checkout - &&\n+\ttest \"z$(git symbolic-ref HEAD)\" = \"zrefs/heads/master\"\n+'\n+\n+test_expect_failure '\"checkout -\" works after a rebase -i A B' '\n+\tgit branch foodle master~1 &&\n+\tgit checkout master &&\n+\tgit checkout other &&\n+\tgit rebase master foodle &&\n+\tgit checkout - &&\n+\ttest \"z$(git symbolic-ref HEAD)\" = \"zrefs/heads/master\"\n+'\n+\n test_done\n-- \n1.8.3.1.449.g41b32a4.dirty\n"},{"id":"221361","messageId":"1371629089-27008-5-git-send-email-artagnon@gmail.com","threadId":"34218","inReplyTo":"1371629089-27008-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v3 4/7] status: do not depend on rebase reflog messages","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-19T08:04:46Z","receivedAt":"2013-06-19T08:04:46Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"b397ea4 (status: show more info than \"currently not on any branch\",\n2013-03-13) attempted to make the output of 'git status' richer in\nthe case of a detached HEAD.  Before this patch, with a detached\nHEAD, we saw:\n\n  $ git status\n  # Not currently on any branch.\n\nBut after the patch, we see:\n\n  $ git checkout v1.8.2\n  $ git status\n  # HEAD detached at v1.8.2\n\nIt works by digging the reflog for the most recent message of the\nform \"checkout: moving from xxxx to yyyy\".  It then asserts that\nHEAD and \"yyyy\" are the same, and displays this message.  When they\naren't equal, it displays:\n\n  $ git status\n  # HEAD detached from fe11db\n\nso that the user can see where the HEAD was first detached.\n\nIn case of a rebase [-i] operation in progress, this message depends on\nthe implementation of rebase writing \"checkout: \" messages to the\nreflog, but that is an implementation detail of \"rebase\".  To remove\nthis dependency so that rebase can be updated to write better reflog\nmessages, replace this \"HEAD detached from\" message with:\n\n  # rebase in progress; onto $ONTO\n\nChanges to the commit object name in the expected output for some of the\ntests shows that what the test expected \"status\" to show during \"rebase\n-i\" was not consistent with the output during a vanilla \"rebase\", which\nshowed on top of what commit the series is being replayed.  Now we\nconsistently show something meaningful to the end user.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t7512-status-help.sh | 37 +++++++++++++++++--------------------\n wt-status.c            |  5 ++++-\n 2 files changed, 21 insertions(+), 21 deletions(-)\n\ndiff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh\nindex bafa5e7..d6c66d7 100755\n--- a/t/t7512-status-help.sh\n+++ b/t/t7512-status-help.sh\n@@ -77,7 +77,7 @@ test_expect_success 'status when rebase in progress before resolving conflicts'\n \tONTO=$(git rev-parse --short HEAD^^) &&\n \ttest_must_fail git rebase HEAD^ --onto HEAD^^ &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached at $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently rebasing branch '\\''rebase_conflicts'\\'' on '\\''$ONTO'\\''.\n \t#   (fix conflicts and then run \"git rebase --continue\")\n \t#   (use \"git rebase --skip\" to skip this patch)\n@@ -104,7 +104,7 @@ test_expect_success 'status when rebase in progress before rebase --continue' '\n \techo three >main.txt &&\n \tgit add main.txt &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached at $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently rebasing branch '\\''rebase_conflicts'\\'' on '\\''$ONTO'\\''.\n \t#   (all conflicts fixed: run \"git rebase --continue\")\n \t#\n@@ -136,7 +136,7 @@ test_expect_success 'status during rebase -i when conflicts unresolved' '\n \tONTO=$(git rev-parse --short rebase_i_conflicts) &&\n \ttest_must_fail git rebase -i rebase_i_conflicts &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached at $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently rebasing branch '\\''rebase_i_conflicts_second'\\'' on '\\''$ONTO'\\''.\n \t#   (fix conflicts and then run \"git rebase --continue\")\n \t#   (use \"git rebase --skip\" to skip this patch)\n@@ -162,7 +162,7 @@ test_expect_success 'status during rebase -i after resolving conflicts' '\n \ttest_must_fail git rebase -i rebase_i_conflicts &&\n \tgit add main.txt &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached at $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently rebasing branch '\\''rebase_i_conflicts_second'\\'' on '\\''$ONTO'\\''.\n \t#   (all conflicts fixed: run \"git rebase --continue\")\n \t#\n@@ -188,10 +188,9 @@ test_expect_success 'status when rebasing -i in edit mode' '\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n \tONTO=$(git rev-parse --short HEAD~2) &&\n-\tTGT=$(git rev-parse --short two_rebase_i) &&\n \tgit rebase -i HEAD~2 &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $TGT\n+\t# rebase in progress; onto $ONTO\n \t# You are currently editing a commit while rebasing branch '\\''rebase_i_edit'\\'' on '\\''$ONTO'\\''.\n \t#   (use \"git commit --amend\" to amend the current commit)\n \t#   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -216,9 +215,8 @@ test_expect_success 'status when splitting a commit' '\n \tONTO=$(git rev-parse --short HEAD~3) &&\n \tgit rebase -i HEAD~3 &&\n \tgit reset HEAD^ &&\n-\tTGT=$(git rev-parse --short HEAD) &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached at $TGT\n+\t# rebase in progress; onto $ONTO\n \t# You are currently splitting a commit while rebasing branch '\\''split_commit'\\'' on '\\''$ONTO'\\''.\n \t#   (Once your working directory is clean, run \"git rebase --continue\")\n \t#\n@@ -246,11 +244,10 @@ test_expect_success 'status after editing the last commit with --amend during a\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n \tONTO=$(git rev-parse --short HEAD~3) &&\n-\tTGT=$(git rev-parse --short three_amend) &&\n \tgit rebase -i HEAD~3 &&\n \tgit commit --amend -m \"foo\" &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $TGT\n+\t# rebase in progress; onto $ONTO\n \t# You are currently editing a commit while rebasing branch '\\''amend_last'\\'' on '\\''$ONTO'\\''.\n \t#   (use \"git commit --amend\" to amend the current commit)\n \t#   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -280,7 +277,7 @@ test_expect_success 'status: (continue first edit) second edit' '\n \tgit rebase -i HEAD~3 &&\n \tgit rebase --continue &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n \t#   (use \"git commit --amend\" to amend the current commit)\n \t#   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -302,7 +299,7 @@ test_expect_success 'status: (continue first edit) second edit and split' '\n \tgit rebase --continue &&\n \tgit reset HEAD^ &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently splitting a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n \t#   (Once your working directory is clean, run \"git rebase --continue\")\n \t#\n@@ -329,7 +326,7 @@ test_expect_success 'status: (continue first edit) second edit and amend' '\n \tgit rebase --continue &&\n \tgit commit --amend -m \"foo\" &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n \t#   (use \"git commit --amend\" to amend the current commit)\n \t#   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -351,7 +348,7 @@ test_expect_success 'status: (amend first edit) second edit' '\n \tgit commit --amend -m \"a\" &&\n \tgit rebase --continue &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n \t#   (use \"git commit --amend\" to amend the current commit)\n \t#   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -374,7 +371,7 @@ test_expect_success 'status: (amend first edit) second edit and split' '\n \tgit rebase --continue &&\n \tgit reset HEAD^ &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently splitting a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n \t#   (Once your working directory is clean, run \"git rebase --continue\")\n \t#\n@@ -402,7 +399,7 @@ test_expect_success 'status: (amend first edit) second edit and amend' '\n \tgit rebase --continue &&\n \tgit commit --amend -m \"d\" &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n \t#   (use \"git commit --amend\" to amend the current commit)\n \t#   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -426,7 +423,7 @@ test_expect_success 'status: (split first edit) second edit' '\n \tgit commit -m \"e\" &&\n \tgit rebase --continue &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n \t#   (use \"git commit --amend\" to amend the current commit)\n \t#   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -451,7 +448,7 @@ test_expect_success 'status: (split first edit) second edit and split' '\n \tgit rebase --continue &&\n \tgit reset HEAD^ &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently splitting a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n \t#   (Once your working directory is clean, run \"git rebase --continue\")\n \t#\n@@ -481,7 +478,7 @@ test_expect_success 'status: (split first edit) second edit and amend' '\n \tgit rebase --continue &&\n \tgit commit --amend -m \"h\" &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached from $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n \t#   (use \"git commit --amend\" to amend the current commit)\n \t#   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -601,7 +598,7 @@ test_expect_success 'status when rebase conflicts with statushints disabled' '\n \tONTO=$(git rev-parse --short HEAD^^) &&\n \ttest_must_fail git rebase HEAD^ --onto HEAD^^ &&\n \tcat >expected <<-EOF &&\n-\t# HEAD detached at $ONTO\n+\t# rebase in progress; onto $ONTO\n \t# You are currently rebasing branch '\\''statushints_disabled'\\'' on '\\''$ONTO'\\''.\n \t#\n \t# Unmerged paths:\ndiff --git a/wt-status.c b/wt-status.c\nindex 2511270..85a00f1 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1174,7 +1174,10 @@ void wt_status_print(struct wt_status *s)\n \t\t\tbranch_name += 11;\n \t\telse if (!strcmp(branch_name, \"HEAD\")) {\n \t\t\tbranch_status_color = color(WT_STATUS_NOBRANCH, s);\n-\t\t\tif (state.detached_from) {\n+\t\t\tif (state.rebase_in_progress || state.rebase_interactive_in_progress) {\n+\t\t\t\ton_what = _(\"rebase in progress; onto \");\n+\t\t\t\tbranch_name = state.onto;\n+\t\t\t} else if (state.detached_from) {\n \t\t\t\tunsigned char sha1[20];\n \t\t\t\tbranch_name = state.detached_from;\n \t\t\t\tif (!get_sha1(\"HEAD\", sha1) &&\n-- \n1.8.3.1.449.g41b32a4.dirty\n"},{"id":"221363","messageId":"1371629089-27008-6-git-send-email-artagnon@gmail.com","threadId":"34218","inReplyTo":"1371629089-27008-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v3 5/7] checkout: respect GIT_REFLOG_ACTION","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-19T08:04:47Z","receivedAt":"2013-06-19T08:04:47Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"GIT_REFLOG_ACTION is an environment variable specifying the reflog\nmessage to write after an action is completed.  Several other commands\nincluding merge, reset, and commit respect it.\n\nFix the failing tests in t/checkout-last by making checkout respect it\ntoo.  You can now expect\n\n  $ git checkout -\n\nto work as expected after any a rebase [-i].  It will also work with any\nother scripts provided they set an appropriate GIT_REFLOG_ACTION if they\ninternally use \"git checkout\".\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/checkout.c       | 11 ++++++++---\n t/t2012-checkout-last.sh |  8 ++++----\n 2 files changed, 12 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex f5b50e5..1e2af85 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -587,7 +587,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,\n \t\t\t\t   struct branch_info *new)\n {\n \tstruct strbuf msg = STRBUF_INIT;\n-\tconst char *old_desc;\n+\tconst char *old_desc, *reflog_msg;\n \tif (opts->new_branch) {\n \t\tif (opts->new_orphan_branch) {\n \t\t\tif (opts->new_branch_log && !log_all_ref_updates) {\n@@ -620,8 +620,13 @@ static void update_refs_for_switch(const struct checkout_opts *opts,\n \told_desc = old->name;\n \tif (!old_desc && old->commit)\n \t\told_desc = sha1_to_hex(old->commit->object.sha1);\n-\tstrbuf_addf(&msg, \"checkout: moving from %s to %s\",\n-\t\t    old_desc ? old_desc : \"(invalid)\", new->name);\n+\n+\treflog_msg = getenv(\"GIT_REFLOG_ACTION\");\n+\tif (!reflog_msg)\n+\t\tstrbuf_addf(&msg, \"checkout: moving from %s to %s\",\n+\t\t\told_desc ? old_desc : \"(invalid)\", new->name);\n+\telse\n+\t\tstrbuf_insert(&msg, 0, reflog_msg, strlen(reflog_msg));\n \n \tif (!strcmp(new->name, \"HEAD\") && !new->path && !opts->force_detach) {\n \t\t/* Nothing to do. */\ndiff --git a/t/t2012-checkout-last.sh b/t/t2012-checkout-last.sh\nindex 6ad6edf..e7ba8c5 100755\n--- a/t/t2012-checkout-last.sh\n+++ b/t/t2012-checkout-last.sh\n@@ -116,7 +116,7 @@ test_expect_success 'master...' '\n \ttest \"z$(git rev-parse --verify HEAD)\" = \"z$(git rev-parse --verify master^)\"\n '\n \n-test_expect_failure '\"checkout -\" works after a rebase A' '\n+test_expect_success '\"checkout -\" works after a rebase A' '\n \tgit checkout master &&\n \tgit checkout other &&\n \tgit rebase master &&\n@@ -124,7 +124,7 @@ test_expect_failure '\"checkout -\" works after a rebase A' '\n \ttest \"z$(git symbolic-ref HEAD)\" = \"zrefs/heads/master\"\n '\n \n-test_expect_failure '\"checkout -\" works after a rebase A B' '\n+test_expect_success '\"checkout -\" works after a rebase A B' '\n \tgit branch moodle master~1 &&\n \tgit checkout master &&\n \tgit checkout other &&\n@@ -133,7 +133,7 @@ test_expect_failure '\"checkout -\" works after a rebase A B' '\n \ttest \"z$(git symbolic-ref HEAD)\" = \"zrefs/heads/master\"\n '\n \n-test_expect_failure '\"checkout -\" works after a rebase -i A' '\n+test_expect_success '\"checkout -\" works after a rebase -i A' '\n \tgit checkout master &&\n \tgit checkout other &&\n \tgit rebase -i master &&\n@@ -141,7 +141,7 @@ test_expect_failure '\"checkout -\" works after a rebase -i A' '\n \ttest \"z$(git symbolic-ref HEAD)\" = \"zrefs/heads/master\"\n '\n \n-test_expect_failure '\"checkout -\" works after a rebase -i A B' '\n+test_expect_success '\"checkout -\" works after a rebase -i A B' '\n \tgit branch foodle master~1 &&\n \tgit checkout master &&\n \tgit checkout other &&\n-- \n1.8.3.1.449.g41b32a4.dirty\n"},{"id":"221364","messageId":"1371629089-27008-7-git-send-email-artagnon@gmail.com","threadId":"34218","inReplyTo":"1371629089-27008-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v3 6/7] rebase: write better reflog messages","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-19T08:04:48Z","receivedAt":"2013-06-19T08:04:48Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Now that the \"checkout\" invoked internally from \"rebase\" knows to honor\nGIT_REFLOG_ACTION, we can start to use it to write a better reflog\nmessage when \"rebase anotherbranch\", \"rebase --onto branch\",\netc. internally checks out the new fork point.  We will write:\n\n  rebase: checkout master\n\ninstead of the old\n\n  rebase\n\nThe usage semantics of GIT_REFLOG_ACTION have changed; by appending to\nGIT_REFLOG_ACTION directly, we risk appending to a prebuilt string like\n\"rebase: checkout mool\" from a previous append, when we really intended\nto append to the string \"rebase\".  Solve this problem by introducing a\nbase_reflog_action variable that is different from GIT_REFLOG_ACTION.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-am.sh         |  4 +++-\n git-rebase--am.sh |  7 +++++++\n git-rebase.sh     | 18 ++++++++++++++++--\n 3 files changed, 26 insertions(+), 3 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 1cf3d1d..74ef9ca 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -46,6 +46,8 @@ set_reflog_action am\n require_work_tree\n cd_to_toplevel\n \n+base_reflog_action=\"$GIT_REFLOG_ACTION\"\n+\n git var GIT_COMMITTER_IDENT >/dev/null ||\n \tdie \"$(gettext \"You need to set your committer info first\")\"\n \n@@ -884,7 +886,7 @@ did you forget to use 'git add'?\"\n \t\tfi &&\n \t\tgit commit-tree $tree ${parent:+-p} $parent <\"$dotest/final-commit\"\n \t) &&\n-\tgit update-ref -m \"$GIT_REFLOG_ACTION: $FIRSTLINE\" HEAD $commit $parent ||\n+\tgit update-ref -m \"$base_reflog_action: $FIRSTLINE\" HEAD $commit $parent ||\n \tstop_here $this\n \n \tif test -f \"$dotest/original-commit\"; then\ndiff --git a/git-rebase--am.sh b/git-rebase--am.sh\nindex 34e3102..7fbeb35 100644\n--- a/git-rebase--am.sh\n+++ b/git-rebase--am.sh\n@@ -5,11 +5,13 @@\n \n case \"$action\" in\n continue)\n+\tGIT_REFLOG_ACTION=\"$base_reflog_action\"\n \tgit am --resolved --resolvemsg=\"$resolvemsg\" &&\n \tmove_to_original_branch\n \treturn\n \t;;\n skip)\n+\tGIT_REFLOG_ACTION=\"$base_reflog_action\"\n \tgit am --skip --resolvemsg=\"$resolvemsg\" &&\n \tmove_to_original_branch\n \treturn\n@@ -40,9 +42,11 @@ else\n \t\trm -f \"$GIT_DIR/rebased-patches\"\n \t\tcase \"$head_name\" in\n \t\trefs/heads/*)\n+\t\t\tGIT_REFLOG_ACTION=\"$base_reflog_action: checkout $head_name\"\n \t\t\tgit checkout -q \"$head_name\"\n \t\t\t;;\n \t\t*)\n+\t\t\tGIT_REFLOG_ACTION=\"$base_reflog_action: checkout $orig_head\"\n \t\t\tgit checkout -q \"$orig_head\"\n \t\t\t;;\n \t\tesac\n@@ -59,6 +63,9 @@ else\n \t\treturn $?\n \tfi\n \n+\t# always reset GIT_REFLOG_ACTION before calling any external\n+\t# scripts; they have no idea about our base_reflog_action\n+\tGIT_REFLOG_ACTION=\"$base_reflog_action\"\n \tgit am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\" <\"$GIT_DIR/rebased-patches\"\n \tret=$?\n \ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex d0c11a9..6cdf9f8 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -47,6 +47,13 @@ set_reflog_action rebase\n require_work_tree_exists\n cd_to_toplevel\n \n+# Should contain a base string like \"rebase\" (or \"rebase -i (start)\")\n+# to which a more information like \": checkout foom\" can be appended\n+# to set the final GIT_REFLOG_ACTION.  If you append to\n+# GIT_REFLOG_ACTION directly, you risk appending to a prebuilt string\n+# like \"rebase: checkout mool\" from a previous append.\n+base_reflog_action=\"$GIT_REFLOG_ACTION\"\n+\n LF='\n '\n ok_to_skip_pre_rebase=\n@@ -336,7 +343,8 @@ then\n \t# Only interactive rebase uses detailed reflog messages\n \tif test \"$type\" = interactive && test \"$GIT_REFLOG_ACTION\" = rebase\n \tthen\n-\t\tGIT_REFLOG_ACTION=\"rebase -i ($action)\"\n+\t\tGIT_REFLOG_ACTION=\"rebase -i ($1)\"\n+\t\tbase_reflog_action=\"$GIT_REFLOG_ACTION\"\n \t\texport GIT_REFLOG_ACTION\n \tfi\n fi\n@@ -543,7 +551,11 @@ then\n \tif test -z \"$force_rebase\"\n \tthen\n \t\t# Lazily switch to the target branch if needed...\n-\t\ttest -z \"$switch_to\" || git checkout \"$switch_to\" --\n+\t\tif test -n \"$switch_to\"\n+\t\tthen\n+\t\t\tGIT_REFLOG_ACTION=\"$base_reflog_action: checkout $switch_to\"\n+\t\t\tgit checkout \"$switch_to\" --\n+\t\tfi\n \t\tsay \"$(eval_gettext \"Current branch \\$branch_name is up to date.\")\"\n \t\texit 0\n \telse\n@@ -568,6 +580,8 @@ test \"$type\" = interactive && run_specific_rebase\n \n # Detach HEAD and reset the tree\n say \"$(gettext \"First, rewinding head to replay your work on top of it...\")\"\n+\n+GIT_REFLOG_ACTION=\"$base_reflog_action: checkout $onto_name\"\n git checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n git update-ref ORIG_HEAD $orig_head\n \n-- \n1.8.3.1.449.g41b32a4.dirty\n"},{"id":"221365","messageId":"1371629089-27008-8-git-send-email-artagnon@gmail.com","threadId":"34218","inReplyTo":"1371629089-27008-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v3 7/7] rebase -i: write better reflog messages","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-19T08:04:49Z","receivedAt":"2013-06-19T08:04:49Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Now that the \"checkout\" invoked internally from \"rebase -i\" knows to\nhonor GIT_REFLOG_ACTION, we can start to use it to write a better reflog\nmessage when \"rebase -i anotherbranch\", \"rebase -i --onto branch\",\netc. internally checks out the new fork point.  We will write:\n\n  rebase -i (start): checkout master\n\ninstead of the old\n\n  rebase -i (start)\n\nThe usage semantics of GIT_REFLOG_ACTION have changed: use\nbase_reflog_action just like in git-rebase.sh.\n\n[jc: add rebase-reflog test]\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-rebase--interactive.sh    | 14 ++++++++++----\n t/t3404-rebase-interactive.sh | 15 +++++++++++++++\n 2 files changed, 25 insertions(+), 4 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex f953d8d..8429c87 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -95,12 +95,15 @@ commit_message () {\n \tgit cat-file commit \"$1\" | sed \"1,/^$/d\"\n }\n \n-orig_reflog_action=\"$GIT_REFLOG_ACTION\"\n+base_reflog_action=\"$GIT_REFLOG_ACTION\"\n \n comment_for_reflog () {\n-\tcase \"$orig_reflog_action\" in\n+\tcase \"$base_reflog_action\" in\n+\t# if GIT_REFLOG_ACTION was set by caller git-rebase, overwrite\n+\t# it with rebase -i.\n \t''|rebase*)\n \t\tGIT_REFLOG_ACTION=\"rebase -i ($1)\"\n+\t\tbase_reflog_action=\"$GIT_REFLOG_ACTION\"\n \t\texport GIT_REFLOG_ACTION\n \t\t;;\n \tesac\n@@ -326,6 +329,7 @@ pick_one_preserving_merges () {\n \t\tif [ \"$1\" != \"-n\" ]\n \t\tthen\n \t\t\t# detach HEAD to current parent\n+\t\t\tGIT_REFLOG_ACTION=\"$base_reflog_action: checkout $first_parent\"\n \t\t\toutput git checkout $first_parent 2> /dev/null ||\n \t\t\t\tdie \"Cannot move HEAD to $first_parent\"\n \t\tfi\n@@ -608,10 +612,10 @@ do_next () {\n \tnewhead=$(git rev-parse HEAD) &&\n \tcase $head_name in\n \trefs/*)\n-\t\tmessage=\"$GIT_REFLOG_ACTION: $head_name onto $onto\" &&\n+\t\tmessage=\"$base_reflog_action: $head_name onto $onto\" &&\n \t\tgit update-ref -m \"$message\" $head_name $newhead $orig_head &&\n \t\tgit symbolic-ref \\\n-\t\t  -m \"$GIT_REFLOG_ACTION: returning to $head_name\" \\\n+\t\t  -m \"$base_reflog_action: returning to $head_name\" \\\n \t\t  HEAD $head_name\n \t\t;;\n \tesac && {\n@@ -838,6 +842,7 @@ comment_for_reflog start\n \n if test ! -z \"$switch_to\"\n then\n+\tGIT_REFLOG_ACTION=\"$base_reflog_action: checkout $switch_to\"\n \toutput git checkout \"$switch_to\" -- ||\n \t\tdie \"Could not checkout $switch_to\"\n fi\n@@ -981,6 +986,7 @@ has_action \"$todo\" ||\n \n test -d \"$rewritten\" || test -n \"$force_rebase\" || skip_unnecessary_picks\n \n+GIT_REFLOG_ACTION=\"$base_reflog_action: checkout $onto_name\"\n output git checkout $onto || die_abort \"could not detach HEAD\"\n git update-ref ORIG_HEAD $orig_head\n do_rest\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 79e8d3c..f943efa 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -934,6 +934,21 @@ test_expect_success 'rebase --edit-todo can be used to modify todo' '\n \ttest L = $(git cat-file commit HEAD | sed -ne \\$p)\n '\n \n+test_expect_success 'rebase -i produces readable reflog' '\n+\tgit reset --hard &&\n+\tgit branch -f branch-reflog-test H &&\n+\tgit rebase -i --onto I F branch-reflog-test &&\n+\tcat >expect <<-\\EOF &&\n+\trebase -i (start): checkout I\n+\trebase -i (pick): G\n+\trebase -i (pick): H\n+\trebase -i (finish): returning to refs/heads/branch-reflog-test\n+\tEOF\n+\ttail -n 4 .git/logs/HEAD |\n+\tsed -e \"s/.*\t//\" >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success 'rebase -i respects core.commentchar' '\n \tgit reset --hard &&\n \tgit checkout E^0 &&\n-- \n1.8.3.1.449.g41b32a4.dirty\n"},{"id":"221366","messageId":"51C1756B.2000907@viscovery.net","threadId":"34218","inReplyTo":"1371629089-27008-4-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH v3 3/7] t/t2012-checkout-last: test \"checkout -\" after a rebase","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-06-19T09:10:03Z","receivedAt":"2013-06-19T09:10:03Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 6/19/2013 10:04, schrieb Ramkumar Ramachandra:\n> +test_expect_failure '\"checkout -\" works after a rebase -i A B' '\n> +\tgit branch foodle master~1 &&\n> +\tgit checkout master &&\n> +\tgit checkout other &&\n> +\tgit rebase master foodle &&\n\n\tgit rebase -i master foodle &&\n\n> +\tgit checkout - &&\n> +\ttest \"z$(git symbolic-ref HEAD)\" = \"zrefs/heads/master\"\n> +'\n> +\n>  test_done\n\n-- Hannes\n"},{"id":"221367","messageId":"CALkWK0nmotYMUDpRp5Yp8sRfhy1brSWSCxz91oBWVE8ryrtetg@mail.gmail.com","threadId":"34218","inReplyTo":"51C1756B.2000907@viscovery.net","subject":"Re: [PATCH v3 3/7] t/t2012-checkout-last: test \"checkout -\" after a rebase","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-19T09:41:11Z","receivedAt":"2013-06-19T09:41:11Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Johannes Sixt wrote:\n> Am 6/19/2013 10:04, schrieb Ramkumar Ramachandra:\n>> +test_expect_failure '\"checkout -\" works after a rebase -i A B' '\n>> +     git branch foodle master~1 &&\n>> +     git checkout master &&\n>> +     git checkout other &&\n>> +     git rebase master foodle &&\n>\n>         git rebase -i master foodle &&\n\nGood eyes.  Thanks.\n"},{"id":"221748","messageId":"7vfvw8dw9m.fsf@alter.siamese.dyndns.org","threadId":"34218","inReplyTo":"1371629089-27008-7-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH v3 6/7] rebase: write better reflog messages","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-24T03:26:29Z","receivedAt":"2013-06-24T03:26:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> @@ -59,6 +63,9 @@ else\n>  \t\treturn $?\n>  \tfi\n>  \n> +\t# always reset GIT_REFLOG_ACTION before calling any external\n> +\t# scripts; they have no idea about our base_reflog_action\n> +\tGIT_REFLOG_ACTION=\"$base_reflog_action\"\n>  \tgit am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\"\n\nWhy does this reroll still use this base_reflog_action convention?\n\nThe original orig_reflog_action you borrowed this may have been an\nacceptable local solution inside \ngit-rebase--interactive that does not call out to amyting, but\nthe above comment a good demonstration that shows why this cannot be \na good general solution that scales across scriptlets.\n\nAnd I already explained that to you at least twice.\n\ncf. http://article.gmane.org/gmane.comp.version-control.git/228399\n\n    But after writing it down this way, I realize that introduction of\n    base_reflog_action (or GIT_REFLOG_NAME which is a moral equivalent)\n    is not helping us at all.  As long as calls to \"git\" command in the\n    second category exists in these scripts, GIT_REFLOG_ACTION *must* be\n    kept pristine after set_reflog_action sets it, so we can get rid of\n    this new variable, and rewrite 3.a and 3.b like so:\n\n        3-a)\n\n            GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: custom message\" \\\n                    git cmd\n\n        3-b)\n\n            SAVED=$GIT_REFLOG_ACTION\n            GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: custom message\"\n            output git cmd\n            GIT_REFLOG_ACTION=$SAVED\n\n                or\n\n            (\n                    GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: custom message\"\n                    output git cmd\n            )\n\n    That essentially boils down to the very original suggestion I made\n    before Ram introduced the base_reflog_action.\n"},{"id":"221761","messageId":"CALkWK0kj3UOx8sq+h=L0giUC-vn+h3by9o_6YbjA8ArRXZfgZw@mail.gmail.com","threadId":"34218","inReplyTo":"7vfvw8dw9m.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v3 6/7] rebase: write better reflog messages","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-24T07:07:46Z","receivedAt":"2013-06-24T07:07:46Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Junio C Hamano wrote:\n>> @@ -59,6 +63,9 @@ else\n>>               return $?\n>>       fi\n>>\n>> +     # always reset GIT_REFLOG_ACTION before calling any external\n>> +     # scripts; they have no idea about our base_reflog_action\n>> +     GIT_REFLOG_ACTION=\"$base_reflog_action\"\n>>       git am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\"\n>\n> Why does this reroll still use this base_reflog_action convention?\n\nBecause it's simple and it makes sense.\n\n> The original orig_reflog_action you borrowed this may have been an\n> acceptable local solution inside\n> git-rebase--interactive that does not call out to amyting, but\n> the above comment a good demonstration that shows why this cannot be\n> a good general solution that scales across scriptlets.\n\nNonsense.  How do I set a custom reflog action when a certain flag is\npassed to my script (like git-rebase.sh:333) without *overriding* an\nexisting GIT_REFLOG_ACTION?  How do I construct cute start/pick/reword\nprefixes elegantly (like in\ngit-rebase--interactive.sh:comment_for_reflog()) without *overriding*\nan existing GIT_REFLOG_ACTION?  In both these examples, I'm setting a\nGIT_REFLOG_ACTION for the \"rest of the code\" to use.  I don't care\nabout the exact command sequence, but I know that they respect\nGIT_REFLOG_ACTION; so I'm setting one in advance.\n\nWhen calling out to an external scriptlet, I want to define my own\nreflog message: when I call out to \"am\" from \"rebase -i\", it should\nwrite a \"rebase -i: \" message, and ignoring its own\nset_reflog_message().  _That_ can be done using the subshell thing you\nproposed.  And I have absolutely no clue why\n\n  (\n    export GIT_REFLOG_ACTION\n    git am\n  )\n\nis \"more scalable\" than\n\n  GIT_REFLOG_ACTION=\"$base_reflog_action\"\n  git am\n\n> And I already explained that to you at least twice.\n\nYou just gave set_reflog_action() and GIT_REFLOG_ACTION some sort of\nGod status, and proposed to make the scripts more ugly and less\nextensible.\n\n... and we're discussing absolutely trivial inconsequential rubbish\nonce again.  In any case, I've given up on arguing with you as it is\nclear that I can't possibly win.  Do whatever you want.\n"},{"id":"221769","messageId":"7vtxkoc557.fsf@alter.siamese.dyndns.org","threadId":"34218","inReplyTo":"CALkWK0kj3UOx8sq+h=L0giUC-vn+h3by9o_6YbjA8ArRXZfgZw@mail.gmail.com","subject":"Re: [PATCH v3 6/7] rebase: write better reflog messages","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-24T07:57:40Z","receivedAt":"2013-06-24T07:57:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n>>> +     # always reset GIT_REFLOG_ACTION before calling any external\n>>> +     # scripts; they have no idea about our base_reflog_action\n>>> +     GIT_REFLOG_ACTION=\"$base_reflog_action\"\n>>>       git am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\"\n>>\n>> Why does this reroll still use this base_reflog_action convention?\n>\n> Because it's simple and it makes sense.\n\nWithout $base_reflog_action hack, you have to make sure\nGIT_REFLOG_ACTION is reasonably pristine when you call out other\npeople.  Even with $base_reflog_action, you still have to do the\nsame \"keep GIT_REFLOG_ACTION pristine\" like this one.  And in\naddition, you have to maintain $base_reflog_action as if it is a\nread-only variable [*1*].\n\nSo you are forcing people to maintain _two_ variables, instead of\njust _one_, without making anything simpler.\n\nWhat's so hard to understand why it is a wrong design?\n\n> ... and we're discussing absolutely trivial inconsequential rubbish\n> once again.  In any case, I've given up on arguing with you as it is\n> clear that I can't possibly win.  Do whatever you want.\n\nIt is not about winning or losing.\n\nIf you truly think this is \"inconsequential\", that unfortunately\nconvinces me that you cannot yet be trusted enough to give you\nlatitude to design interfaces that span multiple programs X-<.\n\n\n[Footnote]\n\n*1* The original orig_reflog_action you borrowed from was bad enough\nbut it had an excuse that it was confined within the leaf level of\nthe callchain.  It was merely done as a way to stash the vanilla\naction name (e.g. \"rebase -i\" before it is specialized into \"rebase\n-i pick\" etc) away, so that it can easily \"lose\" the speciailzation\nfrom GIT_REFLOG_ACTION while preparing for the next operation.\n"},{"id":"221773","messageId":"CALkWK0meLtmSFNSXPxkz4dnXQ_wgNPdUbB-7TL3iqL0JOg5Qmw@mail.gmail.com","threadId":"34218","inReplyTo":"7vtxkoc557.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v3 6/7] rebase: write better reflog messages","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-24T08:12:09Z","receivedAt":"2013-06-24T08:12:09Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Junio C Hamano wrote:\n> So you are forcing people to maintain _two_ variables, instead of\n> just _one_, without making anything simpler.\n>\n> What's so hard to understand why it is a wrong design?\n\nFine.  Let's say I buy your argument about one-variable versus\ntwo-variables: how do you solve the existing problems that are solved\nby overriding GIT_REFLOG_ACTION that I pointed out?\n\n> If you truly think this is \"inconsequential\", that unfortunately\n> convinces me that you cannot yet be trusted enough to give you\n> latitude to design interfaces that span multiple programs X-<.\n\n*shrug* I certainly don't think one-variable versus two-variables\nwarrants this much discussion.\n\nI don't have anything to win or lose: I designed a solution to the\nproblem which I think is reasonable; you don't.  Fine.  Show me an\nalternative that doesn't involve rewriting half of the rebase\ninfrastructure in a series that fixes checkout-dash.\n"}]}