{"thread":{"id":"21857","subject":"[PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","startedAt":"2009-12-04T14:36:27Z","lastAt":"2009-12-09T06:16:25Z","messageCount":32,"participants":["Michael Haggerty","Michael J Gruber","Shawn O. Pearce","Johannes Schindelin","Junio C Hamano","Matthieu Moy","Nanako Shiraishi","Björn Gustavsson","Jeff King","Sverre Rabbelier","Aaron Cohen"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"129176","messageId":"cover.1259934977.git.mhagger@alum.mit.edu","threadId":"21857","inReplyTo":null,"subject":"[PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2009-12-04T14:36:27Z","receivedAt":"2009-12-04T14:36:27Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"This patch series adds \"fix\" to the commands that can be used within\nthe \"rebase --interactive\" patch editor.  \"fix\" is like \"squash\"\nexcept that it discards the log message of the corresponding commit.\n\nWhy I would like this feature:\n\nOne of my favorite aliases is\n\n    fix = commit --amend -C HEAD\n\nwhich I use in those all-too-frequent head-slapping \"I just committed\nsomething with a minor typo\" moments.  It amends the last commit with\nwhatever is staged, reusing the same commit message.  It can also be\nused with the \"-a\" option, a list of filenames, etc.\n\nBut sometimes I don't have my head-slapping moments until a few\ncommits later.  In this case, my usual practice is to commit the\ntrivial typo change on top of the current branch, then \"rebase\n--interactive\" to move the typo fix on top of the erroneous commit and\nsquash it:\n\npick 05d3b81 Commit with typo\npick c29114a Good commit 1\npick 250b013 Good commit 2\npick 5eb3299 Fix for typo\n\n        |\n        V\n\npick 05d3b81 Commit with typo\nsquash 5eb3299 Fix for typo\npick c29114a Good commit 1\npick 250b013 Good commit 2\n\nBut then it is necessary to go into the commit message editor, move\nthe cursor down past the first commit message, delete the \"Fix for\ntypo\" commit message, save, and quit.\n\nThis patch implements a \"fix\" command, similar to \"squash\", except\nthat the corresponding log message is not included in the log message\nsuggested for the combined commit.  (In fact, it includes the log\nmessage, but commented out.)  It therefore saves the editor chores.\n\n\"fix\" and \"squash\" can be used in the same group, in which case the\n\"squash\" commit messages are preserved and the \"fix\" commit messages\nare skipped.\n\nIf the idea of a \"fix\" command is acceptable, then I would like to\nimplement a further convenience: if a group of commits to be folded\ntogether includes *only* \"fix\" commits, then the first log message\nshould be used without even opening an editor.  But I would like to\nget a reaction to the \"fix\" command in general before doing so.\n\nMichael Haggerty (3):\n  Better document the original repository layout.\n  Set a couple more tags in the original repository.\n  Add a command \"fix\" to rebase --interactive.\n\n Documentation/git-rebase.txt  |   13 ++++++++-----\n git-rebase--interactive.sh    |   39 +++++++++++++++++++++++++++++----------\n t/lib-rebase.sh               |    7 ++++---\n t/t3404-rebase-interactive.sh |   41 +++++++++++++++++++++++++++++++++++++----\n 4 files changed, 78 insertions(+), 22 deletions(-)\n"},{"id":"129177","messageId":"91462ec5e4409e558ec5158b7dea33ebf0081d3e.1259934977.git.mhagger@alum.mit.edu","threadId":"21857","inReplyTo":"cover.1259934977.git.mhagger@alum.mit.edu","subject":"[PATCH 1/3] Better document the original repository layout.","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2009-12-04T14:36:28Z","receivedAt":"2009-12-04T14:36:28Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"\nSigned-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\n t/t3404-rebase-interactive.sh |    9 +++++----\n 1 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 3a37793..073674f 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -16,13 +16,14 @@ set_fake_editor\n \n # set up two branches like this:\n #\n-# A - B - C - D - E\n+# A - B - C - D - E     (master)\n #   \\\n-#     F - G - H\n+#     F - G - H         (branch1)\n #       \\\n-#         I\n+#         I             (branch2)\n #\n-# where B, D and G touch the same file.\n+# where B, D and G touch the same file.  In addition, set tags at\n+# points A, F, and I.\n \n test_expect_success 'setup' '\n \t: > file1 &&\n-- \n1.6.5.4\n"},{"id":"129179","messageId":"5482fe5eb1141d925dd4df20cc00416e09813ff7.1259934977.git.mhagger@alum.mit.edu","threadId":"21857","inReplyTo":"cover.1259934977.git.mhagger@alum.mit.edu","subject":"[PATCH 2/3] Set a couple more tags in the original repository.","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2009-12-04T14:36:29Z","receivedAt":"2009-12-04T14:36:29Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"\nSigned-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\n t/t3404-rebase-interactive.sh |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 073674f..236d698 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -23,7 +23,7 @@ set_fake_editor\n #         I             (branch2)\n #\n # where B, D and G touch the same file.  In addition, set tags at\n-# points A, F, and I.\n+# points A, E, F, H, and I.\n \n test_expect_success 'setup' '\n \t: > file1 &&\n@@ -45,6 +45,7 @@ test_expect_success 'setup' '\n \tgit add file3 &&\n \ttest_tick &&\n \tgit commit -m E &&\n+\tgit tag E &&\n \tgit checkout -b branch1 A &&\n \t: > file4 &&\n \tgit add file4 &&\n@@ -58,6 +59,7 @@ test_expect_success 'setup' '\n \tgit add file5 &&\n \ttest_tick &&\n \tgit commit -m H &&\n+\tgit tag H &&\n \tgit checkout -b branch2 F &&\n \t: > file6 &&\n \tgit add file6 &&\n-- \n1.6.5.4\n"},{"id":"129178","messageId":"6d779d2c244bf5d5b7924cdc5daf66a8186e4bc7.1259934977.git.mhagger@alum.mit.edu","threadId":"21857","inReplyTo":"cover.1259934977.git.mhagger@alum.mit.edu","subject":"[PATCH 3/3] Add a command \"fix\" to rebase --interactive.","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2009-12-04T14:36:30Z","receivedAt":"2009-12-04T14:36:30Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"The command is like \"squash\", except that it discards the commit message\nof the corresponding commit.\n\nSigned-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\n Documentation/git-rebase.txt  |   13 ++++++++-----\n git-rebase--interactive.sh    |   39 +++++++++++++++++++++++++++++----------\n t/lib-rebase.sh               |    7 ++++---\n t/t3404-rebase-interactive.sh |   30 ++++++++++++++++++++++++++++++\n 4 files changed, 71 insertions(+), 18 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex ca5e1e8..eafab57 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -382,9 +382,12 @@ If you just want to edit the commit message for a commit, replace the\n command \"pick\" with the command \"reword\".\n \n If you want to fold two or more commits into one, replace the command\n-\"pick\" with \"squash\" for the second and subsequent commit.  If the\n-commits had different authors, it will attribute the squashed commit to\n-the author of the first commit.\n+\"pick\" for the second and subsequent commits with \"squash\" or \"fix\".\n+If the commits had different authors, the folded commit will be\n+attributed to the author of the first commit.  The suggested commit\n+message for the folded commit is the concatenation of the commit\n+messages of the first commit and of those with the \"squash\" command,\n+but omits the commit messages of commits with the \"fix\" command.\n \n 'git-rebase' will stop when \"pick\" has been replaced with \"edit\" or\n when a command fails due to merge errors. When you are done editing\n@@ -512,8 +515,8 @@ Easy case: The changes are literally the same.::\n Hard case: The changes are not the same.::\n \n \tThis happens if the 'subsystem' rebase had conflicts, or used\n-\t`\\--interactive` to omit, edit, or squash commits; or if the\n-\tupstream used one of `commit \\--amend`, `reset`, or\n+\t`\\--interactive` to omit, edit, squash, or fix commits; or if\n+\tthe upstream used one of `commit \\--amend`, `reset`, or\n \t`filter-branch`.\n \n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 0bd3bf7..539413d 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -302,7 +302,7 @@ nth_string () {\n \n make_squash_message () {\n \tif test -f \"$SQUASH_MSG\"; then\n-\t\tCOUNT=$(($(sed -n \"s/^# This is [^0-9]*\\([1-9][0-9]*\\).*/\\1/p\" \\\n+\t\tCOUNT=$(($(sed -n \"s/^# Th[^0-9]*\\([1-9][0-9]*\\)\\(th\\|st\\|nd\\|rd\\) commit message.*:/\\1/p\" \\\n \t\t\t< \"$SQUASH_MSG\" | sed -ne '$p')+1))\n \t\techo \"# This is a combination of $COUNT commits.\"\n \t\tsed -e 1d -e '2,/^./{\n@@ -315,10 +315,20 @@ make_squash_message () {\n \t\techo\n \t\tgit cat-file commit HEAD | sed -e '1,/^$/d'\n \tfi\n-\techo\n-\techo \"# This is the $(nth_string $COUNT) commit message:\"\n-\techo\n-\tgit cat-file commit $1 | sed -e '1,/^$/d'\n+\tcase $1 in\n+\tsquash)\n+\t\techo\n+\t\techo \"# This is the $(nth_string $COUNT) commit message:\"\n+\t\techo\n+\t\tgit cat-file commit $2 | sed -e '1,/^$/d'\n+\t\t;;\n+\tfix)\n+\t\techo\n+\t\techo \"# The $(nth_string $COUNT) commit message will be skipped:\"\n+\t\techo\n+\t\tgit cat-file commit $2 | sed -e '1,/^$/d' -e 's/^/#/'\n+\t\t;;\n+\tesac\n }\n \n peek_next_command () {\n@@ -367,20 +377,28 @@ do_next () {\n \t\twarn\n \t\texit 0\n \t\t;;\n-\tsquash|s)\n-\t\tcomment_for_reflog squash\n+\tsquash|s|fix|f)\n+\t\tcase \"$command\" in\n+\t\tsquash|s)\n+\t\t\tsquash_style=squash\n+\t\t\t;;\n+\t\tfix|f)\n+\t\t\tsquash_style=fix\n+\t\t\t;;\n+\t\tesac\n+\t\tcomment_for_reflog $squash_style\n \n \t\ttest -f \"$DONE\" && has_action \"$DONE\" ||\n-\t\t\tdie \"Cannot 'squash' without a previous commit\"\n+\t\t\tdie \"Cannot '$squash_style' without a previous commit\"\n \n \t\tmark_action_done\n-\t\tmake_squash_message $sha1 > \"$MSG\"\n+\t\tmake_squash_message $squash_style $sha1 > \"$MSG\"\n \t\tfailed=f\n \t\tauthor_script=$(get_author_ident_from_commit HEAD)\n \t\toutput git reset --soft HEAD^\n \t\tpick_one -n $sha1 || failed=t\n \t\tcase \"$(peek_next_command)\" in\n-\t\tsquash|s)\n+\t\tsquash|s|fix|f)\n \t\t\tUSE_OUTPUT=output\n \t\t\tMSG_OPT=-F\n \t\t\tEDIT_OR_FILE=\"$MSG\"\n@@ -768,6 +786,7 @@ first and then run 'git rebase --continue' again.\"\n #  r, reword = use commit, but edit the commit message\n #  e, edit = use commit, but stop for amending\n #  s, squash = use commit, but meld into previous commit\n+#  f, fix = like \"squash\", but discard this commit's log message\n #\n # If you remove a line here THAT COMMIT WILL BE LOST.\n # However, if you remove everything, the rebase will be aborted.\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 62f452c..8b42f23 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -9,8 +9,9 @@\n #\n #\t\"[<lineno1>] [<lineno2>]...\"\n #\n-#   If a line number is prefixed with \"squash\", \"edit\", or \"reword\", the\n-#   respective line's command will be replaced with the specified one.\n+#   If a line number is prefixed with \"squash\", \"fix\", \"edit\", or\n+#   \"reword\", the respective line's command will be replaced with the\n+#   specified one.\n \n set_fake_editor () {\n \techo \"#!$SHELL_PATH\" >fake-editor.sh\n@@ -32,7 +33,7 @@ cat \"$1\".tmp\n action=pick\n for line in $FAKE_LINES; do\n \tcase $line in\n-\tsquash|edit|reword)\n+\tsquash|fix|edit|reword)\n \t\taction=\"$line\";;\n \t*)\n \t\techo sed -n \"${line}s/^pick/$action/p\"\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 236d698..27645c4 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -264,6 +264,36 @@ test_expect_success 'multi-squash only fires up editor once' '\n \ttest 1 = $(git show | grep ONCE | wc -l)\n '\n \n+test_expect_success 'multi-fix only fires up editor once' '\n+\tgit checkout -b multi-fix E &&\n+\tbase=$(git rev-parse HEAD~4) &&\n+\tFAKE_COMMIT_AMEND=\"ONCE\" FAKE_LINES=\"1 fix 2 fix 3 fix 4\" \\\n+\t\tgit rebase -i $base &&\n+\ttest $base = $(git rev-parse HEAD^) &&\n+\ttest 1 = $(git show | grep ONCE | wc -l) &&\n+\tgit checkout to-be-rebased &&\n+\tgit branch -D multi-fix\n+'\n+\n+cat > expect-squash-fix << EOF\n+B\n+\n+D\n+\n+ONCE\n+EOF\n+\n+test_expect_success 'squash and fix generate correct log messages' '\n+\tgit checkout -b squash-fix E &&\n+\tbase=$(git rev-parse HEAD~4) &&\n+\tFAKE_COMMIT_AMEND=\"ONCE\" FAKE_LINES=\"1 fix 2 squash 3 fix 4\" \\\n+\t\tgit rebase -i $base &&\n+\tgit cat-file commit HEAD | sed -e 1,/^\\$/d > actual-squash-fix &&\n+\ttest_cmp expect-squash-fix actual-squash-fix &&\n+\tgit checkout to-be-rebased &&\n+\tgit branch -D squash-fix\n+'\n+\n test_expect_success 'squash works as expected' '\n \tfor n in one two three four\n \tdo\n-- \n1.6.5.4\n"},{"id":"129180","messageId":"4B192210.908@drmicha.warpmail.net","threadId":"21857","inReplyTo":"91462ec5e4409e558ec5158b7dea33ebf0081d3e.1259934977.git.mhagger@alum.mit.edu","subject":"Re: [PATCH 1/3] Better document the original repository layout.","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-04T14:52:00Z","receivedAt":"2009-12-04T14:52:00Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Michael Haggerty venit, vidit, dixit 04.12.2009 15:36:\n> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n> ---\n>  t/t3404-rebase-interactive.sh |    9 +++++----\n>  1 files changed, 5 insertions(+), 4 deletions(-)\n> \n> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\n> index 3a37793..073674f 100755\n> --- a/t/t3404-rebase-interactive.sh\n> +++ b/t/t3404-rebase-interactive.sh\n> @@ -16,13 +16,14 @@ set_fake_editor\n>  \n>  # set up two branches like this:\n>  #\n> -# A - B - C - D - E\n> +# A - B - C - D - E     (master)\n>  #   \\\n> -#     F - G - H\n> +#     F - G - H         (branch1)\n>  #       \\\n> -#         I\n> +#         I             (branch2)\n>  #\n> -# where B, D and G touch the same file.\n> +# where B, D and G touch the same file.  In addition, set tags at\n> +# points A, F, and I.\n>  \n>  test_expect_success 'setup' '\n>  \t: > file1 &&\n\nMy first reaction to the subject was \"Huh? What repository?\". So I\nsuggest something like\n\nt3404: Better document the original repository layout\n\nas a more descriptive subject.\n\nMichael\n"},{"id":"129181","messageId":"4B192701.4000308@drmicha.warpmail.net","threadId":"21857","inReplyTo":"cover.1259934977.git.mhagger@alum.mit.edu","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-04T15:13:05Z","receivedAt":"2009-12-04T15:13:05Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Michael Haggerty venit, vidit, dixit 04.12.2009 15:36:\n> This patch series adds \"fix\" to the commands that can be used within\n> the \"rebase --interactive\" patch editor.  \"fix\" is like \"squash\"\n> except that it discards the log message of the corresponding commit.\n> \n> Why I would like this feature:\n> \n> One of my favorite aliases is\n> \n>     fix = commit --amend -C HEAD\n> \n> which I use in those all-too-frequent head-slapping \"I just committed\n> something with a minor typo\" moments.  It amends the last commit with\n> whatever is staged, reusing the same commit message.  It can also be\n> used with the \"-a\" option, a list of filenames, etc.\n> \n> But sometimes I don't have my head-slapping moments until a few\n> commits later.  In this case, my usual practice is to commit the\n> trivial typo change on top of the current branch, then \"rebase\n> --interactive\" to move the typo fix on top of the erroneous commit and\n> squash it:\n> \n> pick 05d3b81 Commit with typo\n> pick c29114a Good commit 1\n> pick 250b013 Good commit 2\n> pick 5eb3299 Fix for typo\n> \n>         |\n>         V\n> \n> pick 05d3b81 Commit with typo\n> squash 5eb3299 Fix for typo\n> pick c29114a Good commit 1\n> pick 250b013 Good commit 2\n> \n> But then it is necessary to go into the commit message editor, move\n> the cursor down past the first commit message, delete the \"Fix for\n> typo\" commit message, save, and quit.\n> \n> This patch implements a \"fix\" command, similar to \"squash\", except\n> that the corresponding log message is not included in the log message\n> suggested for the combined commit.  (In fact, it includes the log\n> message, but commented out.)  It therefore saves the editor chores.\n> \n> \"fix\" and \"squash\" can be used in the same group, in which case the\n> \"squash\" commit messages are preserved and the \"fix\" commit messages\n> are skipped.\n> \n> If the idea of a \"fix\" command is acceptable, then I would like to\n> implement a further convenience: if a group of commits to be folded\n> together includes *only* \"fix\" commits, then the first log message\n> should be used without even opening an editor.  But I would like to\n> get a reaction to the \"fix\" command in general before doing so.\n\nI'd say that would make a useful command (\"fix\") even more useful, being\njust the right counterpart to \"reword\" for trivial commit message fixes.\n\nOTOH, it would not be possible any more to squash in a few fixes and\nthen edit the message. Maybe having to quit the editor is not that much\nwork after all.\n\nAs a bike-shedding side note: So far, all commands are verbs which\ndescribe actions to take on that commit. In that sense a \"fix deadbeef\"\nwould be confusing: You don't fix deadbeef, you fix the predecessor\nusing deadbeef.\n\nA bit of brainstorming (suck/use/smash/apply/join) does not convince me\nof any of my alternatives, but maybe they convince someone else :)\n\nMichael\n\nP.S.: I thought there's some heavy rb-i rewrite in progress (sequencer\nbased or not?), but you cc'ed Dscho anyway who knows best.\n\n> Michael Haggerty (3):\n>   Better document the original repository layout.\n>   Set a couple more tags in the original repository.\n>   Add a command \"fix\" to rebase --interactive.\n> \n>  Documentation/git-rebase.txt  |   13 ++++++++-----\n>  git-rebase--interactive.sh    |   39 +++++++++++++++++++++++++++++----------\n>  t/lib-rebase.sh               |    7 ++++---\n>  t/t3404-rebase-interactive.sh |   41 +++++++++++++++++++++++++++++++++++++----\n>  4 files changed, 78 insertions(+), 22 deletions(-)\n> \n"},{"id":"129183","messageId":"20091204155009.GA1483@spearce.org","threadId":"21857","inReplyTo":"cover.1259934977.git.mhagger@alum.mit.edu","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-12-04T15:50:09Z","receivedAt":"2009-12-04T15:50:09Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Michael Haggerty <mhagger@alum.mit.edu> wrote:\n> This patch series adds \"fix\" to the commands that can be used within\n> the \"rebase --interactive\" patch editor.  \"fix\" is like \"squash\"\n> except that it discards the log message of the corresponding commit.\n...\n> But sometimes I don't have my head-slapping moments until a few\n> commits later.  In this case, my usual practice is to commit the\n> trivial typo change on top of the current branch, then \"rebase\n> --interactive\" to move the typo fix on top of the erroneous commit and\n> squash it:\n...\n> pick 05d3b81 Commit with typo\n> squash 5eb3299 Fix for typo\n> pick c29114a Good commit 1\n> pick 250b013 Good commit 2\n\n+1 for fix.  Totally.\n\nWhen developing I *often* have not just 1 to squash, but 10 or so\nin a single rebase -i session, all with useless commit messages like\n\"a\", \"s\", or \"foo\".  Given that I also have a commit-msg hook which\ninjects additional lines into each of those messages, squash can be\nannoying to use...\n\nfix would be really cool.  To be honest, its my most common use\nof squash... to use the first commit's message, but combine in the\nmisc. idiot fixes I've collected since I wrote that commit.\n\n-- \nShawn.\n"},{"id":"129201","messageId":"alpine.DEB.1.00.0912041751150.21557@intel-tinevez-2-302","threadId":"21857","inReplyTo":"4B192210.908@drmicha.warpmail.net","subject":"Re: [PATCH 1/3] Better document the original repository layout.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-12-04T16:51:34Z","receivedAt":"2009-12-04T16:51:34Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 4 Dec 2009, Michael J Gruber wrote:\n\n> Michael Haggerty venit, vidit, dixit 04.12.2009 15:36:\n> > Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n> > ---\n> >  t/t3404-rebase-interactive.sh |    9 +++++----\n> >  1 files changed, 5 insertions(+), 4 deletions(-)\n> > \n> > diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\n> > index 3a37793..073674f 100755\n> > --- a/t/t3404-rebase-interactive.sh\n> > +++ b/t/t3404-rebase-interactive.sh\n> > @@ -16,13 +16,14 @@ set_fake_editor\n> >  \n> >  # set up two branches like this:\n> >  #\n> > -# A - B - C - D - E\n> > +# A - B - C - D - E     (master)\n> >  #   \\\n> > -#     F - G - H\n> > +#     F - G - H         (branch1)\n> >  #       \\\n> > -#         I\n> > +#         I             (branch2)\n> >  #\n> > -# where B, D and G touch the same file.\n> > +# where B, D and G touch the same file.  In addition, set tags at\n> > +# points A, F, and I.\n> >  \n> >  test_expect_success 'setup' '\n> >  \t: > file1 &&\n> \n> My first reaction to the subject was \"Huh? What repository?\". So I\n> suggest something like\n> \n> t3404: Better document the original repository layout\n> \n> as a more descriptive subject.\n\nThat would be good, the patch itself is already good.\n\nACK\n"},{"id":"129202","messageId":"alpine.DEB.1.00.0912041751510.21557@intel-tinevez-2-302","threadId":"21857","inReplyTo":"5482fe5eb1141d925dd4df20cc00416e09813ff7.1259934977.git.mhagger@alum.mit.edu","subject":"Re: [PATCH 2/3] Set a couple more tags in the original repository.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-12-04T16:52:25Z","receivedAt":"2009-12-04T16:52:25Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 4 Dec 2009, Michael Haggerty wrote:\n\n> \n> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n\nAlternatively, one could use the test_commit function, I guess.  But the \npatch is good as it is.\n\nACK.\n"},{"id":"129203","messageId":"alpine.DEB.1.00.0912041755220.21557@intel-tinevez-2-302","threadId":"21857","inReplyTo":"6d779d2c244bf5d5b7924cdc5daf66a8186e4bc7.1259934977.git.mhagger@alum.mit.edu","subject":"Re: [PATCH 3/3] Add a command \"fix\" to rebase --interactive.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-12-04T16:57:46Z","receivedAt":"2009-12-04T16:57:46Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 4 Dec 2009, Michael Haggerty wrote:\n\n> The command is like \"squash\", except that it discards the commit message\n> of the corresponding commit.\n> \n> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n\nThe only part which made me a bit uneasy was this one:\n\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index 0bd3bf7..539413d 100755\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -302,7 +302,7 @@ nth_string () {\n>  \n>  make_squash_message () {\n>  \tif test -f \"$SQUASH_MSG\"; then\n> -\t\tCOUNT=$(($(sed -n \"s/^# This is [^0-9]*\\([1-9][0-9]*\\).*/\\1/p\" \\\n> +\t\tCOUNT=$(($(sed -n \"s/^# Th[^0-9]*\\([1-9][0-9]*\\)\\(th\\|st\\|nd\\|rd\\) commit message.*:/\\1/p\" \\\n>  \t\t\t< \"$SQUASH_MSG\" | sed -ne '$p')+1))\n>  \t\techo \"# This is a combination of $COUNT commits.\"\n>  \t\tsed -e 1d -e '2,/^./{\n\nBut it is fine.  (Took this idiot a couple of seconds to figure out why; \nI'd have put \"th\" last, being a mathematician instead of a computer \nscientist, so my natural numbers start with 1, not 0 ;-)\n\nTo be honest, I never thought of \"fix\" as something I want, but patiently \ndeleted the respective commit messages of my fixup commits (usually called \n\"amend\" or \"amend.<something helpful>\").\n\nThis is brilliant.\n\nACK\n"},{"id":"129219","messageId":"7v638mskmx.fsf@alter.siamese.dyndns.org","threadId":"21857","inReplyTo":"6d779d2c244bf5d5b7924cdc5daf66a8186e4bc7.1259934977.git.mhagger@alum.mit.edu","subject":"Re: [PATCH 3/3] Add a command \"fix\" to rebase --interactive.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-04T17:40:22Z","receivedAt":"2009-12-04T17:40:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Haggerty <mhagger@alum.mit.edu> writes:\n\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index 0bd3bf7..539413d 100755\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -302,7 +302,7 @@ nth_string () {\n>  \n>  make_squash_message () {\n>  \tif test -f \"$SQUASH_MSG\"; then\n> -\t\tCOUNT=$(($(sed -n \"s/^# This is [^0-9]*\\([1-9][0-9]*\\).*/\\1/p\" \\\n> +\t\tCOUNT=$(($(sed -n \"s/^# Th[^0-9]*\\([1-9][0-9]*\\)\\(th\\|st\\|nd\\|rd\\) commit message.*:/\\1/p\" \\\n>  \t\t\t< \"$SQUASH_MSG\" | sed -ne '$p')+1))\n\nThis sed replacement worries me.  I don't have a time to check myself\ntoday but do we use \\(this\\|or\\|that\\) alternates with our sed script\nalready elsewhere in the codebase (test scripts do not count)?\n\nOtherwise this may suddenly be breaking a platform that has an\nimplementation of sed that may be substandard but so far has been\nsufficient to work with git.\n"},{"id":"129220","messageId":"vpqfx7qocwl.fsf@bauges.imag.fr","threadId":"21857","inReplyTo":"4B192701.4000308@drmicha.warpmail.net","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2009-12-04T17:40:58Z","receivedAt":"2009-12-04T17:40:58Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n>> If the idea of a \"fix\" command is acceptable, then I would like to\n>> implement a further convenience: if a group of commits to be folded\n>> together includes *only* \"fix\" commits, then the first log message\n>> should be used without even opening an editor.  But I would like to\n>> get a reaction to the \"fix\" command in general before doing so.\n>\n> I'd say that would make a useful command (\"fix\") even more useful, being\n> just the right counterpart to \"reword\" for trivial commit message fixes.\n\n+1 for fix, and +1 for the \"don't even launch the editor\" too.\n\n> OTOH, it would not be possible any more to squash in a few fixes and\n> then edit the message. Maybe having to quit the editor is not that much\n> work after all.\n\nWell, it's still possible, by using \"squash\" and deleting the extra\npart. In both cases, there's one scenario where one has a little more\nto do than strictly required (either delete a bit of texte or close\nthe editor), but I think the senario \"just want to fix the content\nwith another patch, but the commit message was good\" is so common that\nit deserves being optimized.\n\nIn particular, that would make a rebase -i with only reordering and\nfixes non-interactive. With 3 fixes, you just wait for Git around a\nsecond and it's done, smoothly, while it requires launching/closing\nthe editor 3 times ...\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"129223","messageId":"vpqaaxyocr4.fsf@bauges.imag.fr","threadId":"21857","inReplyTo":"7v638mskmx.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] Add a command \"fix\" to rebase --interactive.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2009-12-04T17:44:15Z","receivedAt":"2009-12-04T17:44:15Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Michael Haggerty <mhagger@alum.mit.edu> writes:\n>\n>> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n>> index 0bd3bf7..539413d 100755\n>> --- a/git-rebase--interactive.sh\n>> +++ b/git-rebase--interactive.sh\n>> @@ -302,7 +302,7 @@ nth_string () {\n>>  \n>>  make_squash_message () {\n>>  \tif test -f \"$SQUASH_MSG\"; then\n>> -\t\tCOUNT=$(($(sed -n \"s/^# This is [^0-9]*\\([1-9][0-9]*\\).*/\\1/p\" \\\n>> +\t\tCOUNT=$(($(sed -n \"s/^# Th[^0-9]*\\([1-9][0-9]*\\)\\(th\\|st\\|nd\\|rd\\) commit message.*:/\\1/p\" \\\n>>  \t\t\t< \"$SQUASH_MSG\" | sed -ne '$p')+1))\n>\n> This sed replacement worries me.  I don't have a time to check myself\n> today but do we use \\(this\\|or\\|that\\) alternates with our sed script\n> already elsewhere in the codebase (test scripts do not count)?\n\nIt seems we don't:\n\ngit$ git grep '\\\\|' *.sh\ngit-rebase--interactive.sh:             COUNT=$(($(sed -n \"s/^# Th[^0-9]*\\([1-9][0-9]*\\)\\(th\\|st\\|nd\\|rd\\) commit message.*:/\\\ngit$ \n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"129222","messageId":"7vws12r5v2.fsf@alter.siamese.dyndns.org","threadId":"21857","inReplyTo":"vpqfx7qocwl.fsf@bauges.imag.fr","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-04T17:44:49Z","receivedAt":"2009-12-04T17:44:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>\n>>> If the idea of a \"fix\" command is acceptable, then I would like to\n>>> implement a further convenience: if a group of commits to be folded\n>>> together includes *only* \"fix\" commits, then the first log message\n>>> should be used without even opening an editor.  But I would like to\n>>> get a reaction to the \"fix\" command in general before doing so.\n>>\n>> I'd say that would make a useful command (\"fix\") even more useful, being\n>> just the right counterpart to \"reword\" for trivial commit message fixes.\n>\n> +1 for fix, and +1 for the \"don't even launch the editor\" too.\n\nI like it, too.  Also I vaguely recall that there was a series that died\nthat would have allowed you to give hints to help this behaviour at the\ntime you make \"fix-up\" commits; we may want to resurrect it on top of this\nfeature.\n"},{"id":"129231","messageId":"alpine.DEB.1.00.0912041943160.21557@intel-tinevez-2-302","threadId":"21857","inReplyTo":"7v638mskmx.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] Add a command \"fix\" to rebase --interactive.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-12-04T18:44:31Z","receivedAt":"2009-12-04T18:44:31Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 4 Dec 2009, Junio C Hamano wrote:\n\n> Michael Haggerty <mhagger@alum.mit.edu> writes:\n> \n> > diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> > index 0bd3bf7..539413d 100755\n> > --- a/git-rebase--interactive.sh\n> > +++ b/git-rebase--interactive.sh\n> > @@ -302,7 +302,7 @@ nth_string () {\n> >  \n> >  make_squash_message () {\n> >  \tif test -f \"$SQUASH_MSG\"; then\n> > -\t\tCOUNT=$(($(sed -n \"s/^# This is [^0-9]*\\([1-9][0-9]*\\).*/\\1/p\" \\\n> > +\t\tCOUNT=$(($(sed -n \"s/^# Th[^0-9]*\\([1-9][0-9]*\\)\\(th\\|st\\|nd\\|rd\\) commit message.*:/\\1/p\" \\\n> >  \t\t\t< \"$SQUASH_MSG\" | sed -ne '$p')+1))\n> \n> This sed replacement worries me.  I don't have a time to check myself\n> today but do we use \\(this\\|or\\|that\\) alternates with our sed script\n> already elsewhere in the codebase (test scripts do not count)?\n> \n> Otherwise this may suddenly be breaking a platform that has an\n> implementation of sed that may be substandard but so far has been\n> sufficient to work with git.\n\nIIRC \"|\" was not correctly handled by BSD sed (used e.g. in MacOSX).\n\nSo maybe it would be best to just look for \"commit message\"?  I agree with \nMichael that the regex should not be too loose.\n\nCiao,\nDscho\n"},{"id":"129232","messageId":"alpine.DEB.1.00.0912041945161.21557@intel-tinevez-2-302","threadId":"21857","inReplyTo":"7vws12r5v2.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-12-04T18:47:17Z","receivedAt":"2009-12-04T18:47:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 4 Dec 2009, Junio C Hamano wrote:\n\n> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n> \n> > Michael J Gruber <git@drmicha.warpmail.net> writes:\n> >\n> >>> If the idea of a \"fix\" command is acceptable, then I would like to\n> >>> implement a further convenience: if a group of commits to be folded\n> >>> together includes *only* \"fix\" commits, then the first log message\n> >>> should be used without even opening an editor.  But I would like to\n> >>> get a reaction to the \"fix\" command in general before doing so.\n> >>\n> >> I'd say that would make a useful command (\"fix\") even more useful, being\n> >> just the right counterpart to \"reword\" for trivial commit message fixes.\n> >\n> > +1 for fix, and +1 for the \"don't even launch the editor\" too.\n> \n> I like it, too.  Also I vaguely recall that there was a series that died\n> that would have allowed you to give hints to help this behaviour at the\n> time you make \"fix-up\" commits; we may want to resurrect it on top of this\n> feature.\n\nI'll just repeat this exactly one more time: it is not always possible to \nknow whether you make a fix-up commit, and it is not always possible to be \nsure that you want to amend the next time you do a rebase.\n\nSo: Commit time is definitely a bad time to decide on the action in some \nfuture rebase event.\n\nCiao,\nDscho\n"},{"id":"129244","messageId":"20091205062708.6117@nanako3.lavabit.com","threadId":"21857","inReplyTo":"alpine.DEB.1.00.0912041945161.21557@intel-tinevez-2-302","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-12-04T21:27:08Z","receivedAt":"2009-12-04T21:27:08Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n> Hi,\n>\n> On Fri, 4 Dec 2009, Junio C Hamano wrote:\n>\n>> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n>> \n>> > Michael J Gruber <git@drmicha.warpmail.net> writes:\n>> >\n>> >>> If the idea of a \"fix\" command is acceptable, then I would like to\n>> >>> implement a further convenience: if a group of commits to be folded\n>> >>> together includes *only* \"fix\" commits, then the first log message\n>> >>> should be used without even opening an editor.  But I would like to\n>> >>> get a reaction to the \"fix\" command in general before doing so.\n>> >>\n>> >> I'd say that would make a useful command (\"fix\") even more useful, being\n>> >> just the right counterpart to \"reword\" for trivial commit message fixes.\n>> >\n>> > +1 for fix, and +1 for the \"don't even launch the editor\" too.\n>> \n>> I like it, too.  Also I vaguely recall that there was a series that died\n>> that would have allowed you to give hints to help this behaviour at the\n>> time you make \"fix-up\" commits; we may want to resurrect it on top of this\n>> feature.\n>\n> I'll just repeat this exactly one more time: it is not always possible to \n> know whether you make a fix-up commit, and it is not always possible to be \n> sure that you want to amend the next time you do a rebase.\n>\n> So: Commit time is definitely a bad time to decide on the action in some \n> future rebase event.\n\nI think Junio is referring to this thread:\n\n  http://thread.gmane.org/gmane.comp.version-control.git/127923/focus=121874\n\nThe old patch added a convention to mark a fix-up commit \nwith a special string \"!fixup\" and refer to which commit \nin the series it is fixing.  It added --autosquash option\nto rebase--interactive that tells it to move such a commit \nto an appropriate place in the series and change its 'pick' \nto 'squash'. I think with Michael's patches, it can change \n'pick' to 'fix' instead.\n\nI too think Michael's \"fix\" is a good feature, and in the \nworkflow by Shawn, he knows he is fixing up an earlier \ncommit, and he knows he doesn't want to add anything to \nthe message by the fix-up commit when he makes that commit \n(how else would he have messages like \"a\", \"s\", or \"foo\").\n\nI don't think your objection should block *others* (like\nShawn and Junio) who can decide when they make commits \nfrom using the feature from my old patch to make it even \neasier to clean up their topics. If *you* can't decide if \nyou want to amend or not when you make a fix-up commit, you \ncan leave your fix-up commits unmarked, run interactive \nrebase without the --autosquash option, and use Michael's \n'fix' manually. People who can sometimes but not always \ndecide when they make commits can do the same when they \ncan't.\n\nIsn't it what Junio suggested by his \"on top of this feature\", \nand wouldn't that make everybody happy?\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"129246","messageId":"6672d0160912041419s2cbcb8ech49f69250b99386ae@mail.gmail.com","threadId":"21857","inReplyTo":"cover.1259934977.git.mhagger@alum.mit.edu","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2009-12-04T22:19:17Z","receivedAt":"2009-12-04T22:19:17Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"On Fri, Dec 4, 2009 at 3:36 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:\n\n> If the idea of a \"fix\" command is acceptable, then I would like to\n> implement a further convenience: if a group of commits to be folded\n> together includes *only* \"fix\" commits, then the first log message\n> should be used without even opening an editor.  But I would like to\n> get a reaction to the \"fix\" command in general before doing so.\n\nI would really prefer that the editor is not entered at all if there\nare only \"fix\" commands in a group of commits to be folded.\n\n> Michael Haggerty (3):\n>  Better document the original repository layout.\n>  Set a couple more tags in the original repository.\n>  Add a command \"fix\" to rebase --interactive.\n\nNitpick: the recommended style is to leave out the full stop\nat the end of the first line of the commit message.\n\n-- \nBjörn Gustavsson, Erlang/OTP, Ericsson AB\n"},{"id":"129247","messageId":"7v4oo6l6ef.fsf@alter.siamese.dyndns.org","threadId":"21857","inReplyTo":"6672d0160912041419s2cbcb8ech49f69250b99386ae@mail.gmail.com","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-04T22:29:44Z","receivedAt":"2009-12-04T22:29:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Björn Gustavsson <bgustavsson@gmail.com> writes:\n\n> On Fri, Dec 4, 2009 at 3:36 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:\n>\n>> If the idea of a \"fix\" command is acceptable, then I would like to\n>> implement a further convenience: if a group of commits to be folded\n>> together includes *only* \"fix\" commits, then the first log message\n>> should be used without even opening an editor. But I would like to\n>> get a reaction to the \"fix\" command in general before doing so.\n>\n> I would really prefer that the editor is not entered at all if there\n> are only \"fix\" commands in a group of commits to be folded.\n\nI think all of these ideas were already discussed in the earlier thread\nfrom mid June this year, so I do not think there is no need for any more\n\"me too like it\" comments to show the support for this feature, unless it\nadds any new ideas of value.  I think \"fixup and nothing else shouldn't\nopen editor\" and \"an option to pay attention to specially marked commit\"\nare good ideas but they both appear in the old thread already.\n\nIIRC, the end result of the bikeshedding for the name of the command was\nwon by Dscho's \"fixup\":\n\n  http://thread.gmane.org/gmane.comp.version-control.git/127923/focus=121820\n"},{"id":"129260","messageId":"7vd42t6f9i.fsf@alter.siamese.dyndns.org","threadId":"21857","inReplyTo":"20091205062708.6117@nanako3.lavabit.com","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-05T07:39:37Z","receivedAt":"2009-12-05T07:39:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> I think Junio is referring to this thread:\n>\n>   http://thread.gmane.org/gmane.comp.version-control.git/127923/focus=121874\n\nYes, that was the one I had in mind, and it is a shame that we somehow\nended up not taking it, perhaps in an improved form, back then.  Even\ntoday alone, I missed the \"mark for later fixing/squashing and then rebase\nat the end\" feature twice at dayjob.\n\n> I too think Michael's \"fix\" is a good feature, and in the \n> workflow by Shawn, he knows he is fixing up an earlier \n> commit, and he knows he doesn't want to add anything to \n> the message by the fix-up commit when he makes that commit \n> (how else would he have messages like \"a\", \"s\", or \"foo\").\n\nThere is a slight distinction between \"Shawn's fix-up commits have garbage\nmessage and he does not want any part of them in the final commit message\"\nand \"Shawn is happy with the message of the original commit whose tree\nthese fix-up commits are meant to correct.\"  He may still not be entirely\nhappy with the original message.  Wanting to edit the commit log message,\nand not wanting to use the messages from follow-up commits, are two\ndifferent things.\n\nI would agree that it is a good idea for \"rebase -i\" with only \"fix\" and\nnot \"squash\" to skip the editing of the final message.  You manually move,\nor tell your \"rebase --autosquash\" option to automatically move, the\nfollow-up commits next to the ones they are meant to correct while editing\nthe rebase-i insn, and you change their \"pick\" to \"fix\" (or \"fixup\" as\nDscho and others suggested in the earlier round you quoted) only when you\nknow you want to keep the message of the original commit.  Otherwise you\ncan change them to \"squash\" not to \"fix\", and you can edit the final log\nmessage that way.\n\nIf Michael rolls his second round with your \"--autosquash\", or you do so\nyourself on top of his patch, I think it _might_ be safer to mark the ones\nautomatically moved as \"squash\", and not as \"fix\", and have the users\nexplicitly change the \"squash\" they want to \"fix\" themselves.\nAlternatively, you can also use two magic tokens (i.e. instead of one\n\"fixup!\", allow people to use \"squash!\" and \"fixup!\")  and change the\naction chosen for the moved commits to \"squash\" and \"fixup\" respectively.\n\n> I don't think your objection should block *others* (like\n> Shawn and Junio) who can decide when they make commits \n> from using the feature from my old patch to make it even \n> easier to clean up their topics. If *you* can't decide if \n> you want to amend or not when you make a fix-up commit, you \n> can leave your fix-up commits unmarked, run interactive \n> rebase without the --autosquash option, and use Michael's \n> 'fix' manually. People who can sometimes but not always \n> decide when they make commits can do the same when they \n> can't.\n>\n> Isn't it what Junio suggested by his \"on top of this feature\", \n> and wouldn't that make everybody happy?\n\nThe answer to the first question is \"yes\"---I did't understand why Dscho\nobjected to a feature he can choose not to use if he doesn't want to, and\nI still don't (unless I was misreading your earlier patch back then and it\nsomehow forced all rebase-i users to decide upfront at the commit time,\nbut I highly doubt it).\n\nI don't know about the second one but I am guessing it would also be\n\"yes\".\n"},{"id":"129278","messageId":"7vaaxxw8vl.fsf@alter.siamese.dyndns.org","threadId":"21857","inReplyTo":"alpine.DEB.1.00.0912041943160.21557@intel-tinevez-2-302","subject":"Re: [PATCH 3/3] Add a command \"fix\" to rebase --interactive.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-05T18:53:02Z","receivedAt":"2009-12-05T18:53:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Fri, 4 Dec 2009, Junio C Hamano wrote:\n>\n>> Michael Haggerty <mhagger@alum.mit.edu> writes:\n>> \n>> > diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n>> > index 0bd3bf7..539413d 100755\n>> > --- a/git-rebase--interactive.sh\n>> > +++ b/git-rebase--interactive.sh\n>> > @@ -302,7 +302,7 @@ nth_string () {\n>> >  \n>> >  make_squash_message () {\n>> >  \tif test -f \"$SQUASH_MSG\"; then\n>> > -\t\tCOUNT=$(($(sed -n \"s/^# This is [^0-9]*\\([1-9][0-9]*\\).*/\\1/p\" \\\n>> > +\t\tCOUNT=$(($(sed -n \"s/^# Th[^0-9]*\\([1-9][0-9]*\\)\\(th\\|st\\|nd\\|rd\\) commit message.*:/\\1/p\" \\\n> ...\n> IIRC \"|\" was not correctly handled by BSD sed (used e.g. in MacOSX).\n\nYou are right; we actually have seen and fixed a similar breakage.  For\nexample, \"git log --all-match --grep=BRE --grep=ERE\" finds:\n\n    commit 1883a0d3b7ad7c9de1ac790bda6f1a6181237439\n    Author: Junio C Hamano <gitster@pobox.com>\n    Date:   Fri Sep 19 23:52:49 2008 -0700\n\n        diff: use extended regexp to find hunk headers\n\n        Using ERE elements such as \"|\" (alternation) by backquoting in BRE\n        is a GNU extension and should not be done in portable programs.\n\nand \"sed\" is defined to take BRE.\n\nTentatively I'd queue this on top of 3/3 for eventual squashing.\n\nThanks\n\n-- >8 --\nFrom: Junio C Hamano <gitster@pobox.com>\nDate: Sat, 5 Dec 2009 10:42:44 -0800\nSubject: [PATCH] [squash to Add a command \"fix\"] Avoid \"\\(alternatives\\|choices\\)\" in sed script\n\n---\n git-rebase--interactive.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 539413d..c30209e 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -302,7 +302,7 @@ nth_string () {\n \n make_squash_message () {\n \tif test -f \"$SQUASH_MSG\"; then\n-\t\tCOUNT=$(($(sed -n \"s/^# Th[^0-9]*\\([1-9][0-9]*\\)\\(th\\|st\\|nd\\|rd\\) commit message.*:/\\1/p\" \\\n+\t\tCOUNT=$(($(sed -n \"s/^# Th[^0-9]*\\([1-9][0-9]*\\)[tsnr][htd] commit message.*:$/\\1/p\" \\\n \t\t\t< \"$SQUASH_MSG\" | sed -ne '$p')+1))\n \t\techo \"# This is a combination of $COUNT commits.\"\n \t\tsed -e 1d -e '2,/^./{\n-- \n1.6.6.rc1.31.g1a56b\n"},{"id":"129473","messageId":"20091208121314.6117@nanako3.lavabit.com","threadId":"21857","inReplyTo":"7vd42t6f9i.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-12-08T03:13:14Z","receivedAt":"2009-12-08T03:13:14Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Teach a new option, --autosquash, to the interactive rebase.\nWhen the commit log message begins with \"!fixup ...\", and there\nis a commit whose title begins with the same ..., automatically\nmodify the todo list of rebase -i so that the commit marked for\nsquashing come right after the commit to be modified, and change\nthe action of the moved commit from pick to squash.\n\nSigned-off-by: Nanako Shiraishi <nanako3@lavabit.com>\n---\n\n Junio C Hamano <gitster@pobox.com> writes:\n\n > If Michael rolls his second round with your \"--autosquash\", or you do so\n > yourself on top of his patch, I think it _might_ be safer to mark the ones\n > automatically moved as \"squash\", and not as \"fix\", and have the users\n > explicitly change the \"squash\" they want to \"fix\" themselves.\n > Alternatively, you can also use two magic tokens (i.e. instead of one\n > \"fixup!\", allow people to use \"squash!\" and \"fixup!\")  and change the\n > action chosen for the moved commits to \"squash\" and \"fixup\" respectively.\n\n Here is a rebased and updated version of my patch from June \n 2009. It should apply cleanly on top of Michael's patch.\n\n Documentation/git-rebase.txt |   10 +++++++\n git-rebase--interactive.sh   |   43 +++++++++++++++++++++++++++++++\n t/t3415-rebase-autosquash.sh |   58 ++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 111 insertions(+), 0 deletions(-)\n create mode 100755 t/t3415-rebase-autosquash.sh\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 9b648ec..87cb62d 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -308,6 +308,16 @@ which makes little sense.\n \troot commits will be rewritten to have <newbase> as parent\n \tinstead.\n \n+--autosquash::\n+\tWhen the commit log message begins with \"!squash ...\" (or\n+\t\"!fixup ...\"), and there is a commit whose title begins with\n+\tthe same ..., automatically modify the todo list of rebase -i\n+\tso that the commit marked for quashing come right after the \n+\tcommit to be modified, and change the action of the moved \n+\tcommit from `pick` to `squash` (or `fixup`).\n++\n+This option is only valid when '--interactive' option is used.\n+\n include::merge-strategies.txt[]\n \n NOTES\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 30de96e..b014231 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -28,6 +28,7 @@ abort              abort rebasing process and restore original branch\n skip               skip current patch and continue rebasing process\n no-verify          override pre-rebase hook from stopping the operation\n root               rebase all reachable commmits up to the root(s)\n+autosquash         move commits that begin with !squash/!fixup\n \"\n \n . git-sh-setup\n@@ -46,6 +47,7 @@ ONTO=\n VERBOSE=\n OK_TO_SKIP_PRE_REBASE=\n REBASE_ROOT=\n+AUTOSQUASH=\n \n GIT_CHERRY_PICK_HELP=\"  After resolving the conflicts,\n mark the corrected paths with 'git add <paths>', and\n@@ -519,6 +521,43 @@ get_saved_options () {\n \ttest -f \"$DOTEST\"/rebase-root && REBASE_ROOT=t\n }\n \n+# Rearrange the todo list that has both \"pick sha1 msg\" and\n+# \"pick sha1 !fixup/!squash msg\" appears in it so that the latter\n+# comes immediately after the former, and change \"pick\" to\n+# \"fixup\"/\"squash\".\n+rearrange_squash () {\n+\tsed -n -e 's/^pick \\([0-9a-f]*\\) !\\(squash\\) /\\1 \\2 /p' \\\n+\t\t-e 's/^pick \\([0-9a-f]*\\) !\\(fixup\\) /\\1 \\2 /p' \\\n+\t\t\"$1\" >\"$1.sq\"\n+\ttest -s \"$1.sq\" || return\n+\n+\tsed -e '/^pick [0-9a-f]* !squash /d' \\\n+\t\t-e '/^pick [0-9a-f]* !fixup /d' \\\n+\t\t\"$1\" |\n+\t(\n+\t\tused=\n+\t\twhile read pick sha1 message\n+\t\tdo\n+\t\t\techo \"$pick $sha1 $message\"\n+\t\t\twhile read squash action msg\n+\t\t\tdo\n+\t\t\t\tcase \" $used\" in\n+\t\t\t\t*\" $squash \"*)\n+\t\t\t\t\tcontinue ;;\n+\t\t\t\tesac\n+\t\t\t\tcase \"$message\" in\n+\t\t\t\t\"$msg\"*)\n+\t\t\t\t\techo \"$action $squash !$action $msg\"\n+\t\t\t\t\tused=\"$used$squash \"\n+\t\t\t\t\t;;\n+\t\t\t\tesac\n+\t\t\tdone <\"$1.sq\"\n+\t\tdone >\"$1.rearranged\"\n+\t)\n+\tcat \"$1.rearranged\" >\"$1\"\n+\trm -f \"$1.sq\"\n+}\n+\n while test $# != 0\n do\n \tcase \"$1\" in\n@@ -624,6 +663,9 @@ first and then run 'git rebase --continue' again.\"\n \t--root)\n \t\tREBASE_ROOT=t\n \t\t;;\n+\t--autosquash)\n+\t\tAUTOSQUASH=t\n+\t\t;;\n \t--onto)\n \t\tshift\n \t\tONTO=$(git rev-parse --verify \"$1\") ||\n@@ -783,6 +825,7 @@ first and then run 'git rebase --continue' again.\"\n \t\tfi\n \n \t\ttest -s \"$TODO\" || echo noop >> \"$TODO\"\n+\t\ttest -n \"$AUTOSQUASH\" && rearrange_squash \"$TODO\"\n \t\tcat >> \"$TODO\" << EOF\n \n # Rebase $SHORTREVISIONS onto $SHORTONTO\ndiff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh\nnew file mode 100755\nindex 0000000..5ea2073\n--- /dev/null\n+++ b/t/t3415-rebase-autosquash.sh\n@@ -0,0 +1,58 @@\n+#!/bin/sh\n+\n+test_description='auto squash'\n+\n+. ./test-lib.sh\n+\n+test_expect_success setup '\n+\techo 0 > file0 &&\n+\tgit add . &&\n+\ttest_tick &&\n+\tgit commit -m \"initial commit\" &&\n+\techo 0 > file1 &&\n+\techo 2 > file2 &&\n+\tgit add . &&\n+\ttest_tick &&\n+\tgit commit -m \"first commit\" &&\n+\techo 3 > file3 &&\n+\tgit add . &&\n+\ttest_tick &&\n+\tgit commit -m \"second commit\" &&\n+\tgit tag base\n+'\n+\n+test_expect_success 'auto fixup' '\n+\tgit reset --hard base &&\n+\techo 1 > file1 &&\n+\tgit add -u &&\n+\ttest_tick &&\n+\tgit commit -m \"!fixup first\"\n+\n+\tgit tag final-fixup &&\n+\ttest_tick &&\n+\tgit rebase --autosquash -i HEAD^^^ &&\n+\tgit log --oneline >actual &&\n+\ttest 3 = $(wc -l <actual) &&\n+\tgit diff --exit-code final-fixup &&\n+\ttest 1 = \"$(git cat-file blob HEAD^:file1)\" &&\n+\ttest 1 = $(git cat-file commit HEAD^ | grep first | wc -l)\n+'\n+\n+test_expect_success 'auto squash' '\n+\tgit reset --hard base &&\n+\techo 1 > file1 &&\n+\tgit add -u &&\n+\ttest_tick &&\n+\tgit commit -m \"!squash first\"\n+\n+\tgit tag final-squash &&\n+\ttest_tick &&\n+\tgit rebase --autosquash -i HEAD^^^ &&\n+\tgit log --oneline >actual &&\n+\ttest 3 = $(wc -l <actual) &&\n+\tgit diff --exit-code final-squash &&\n+\ttest 1 = \"$(git cat-file blob HEAD^:file1)\" &&\n+\ttest 2 = $(git cat-file commit HEAD^ | grep first | wc -l)\n+'\n+\n+test_done\n-- \n1.6.6.rc0.60.g4926\n\n\n\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"129478","messageId":"7vtyw2p2ju.fsf@alter.siamese.dyndns.org","threadId":"21857","inReplyTo":"20091208121314.6117@nanako3.lavabit.com","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-08T03:28:21Z","receivedAt":"2009-12-08T03:28:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> Teach a new option, --autosquash, to the interactive rebase.\n> When the commit log message begins with \"!fixup ...\", and there\n> is a commit whose title begins with the same ..., automatically\n> modify the todo list of rebase -i so that the commit marked for\n> squashing come right after the commit to be modified, and change\n> the action of the moved commit from pick to squash.\n>\n> Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>\n\nHmph, did you forget to retitle the message, or keep in-body \"Subject:\"?\n"},{"id":"129485","messageId":"20091208150102.6117@nanako3.lavabit.com","threadId":"21857","inReplyTo":"7vtyw2p2ju.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-12-08T06:01:02Z","receivedAt":"2009-12-08T06:01:02Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Junio C Hamano <gitster@pobox.com>\n\n> Nanako Shiraishi <nanako3@lavabit.com> writes:\n>\n>> Teach a new option, --autosquash, to the interactive rebase.\n>> When the commit log message begins with \"!fixup ...\", and there\n>> is a commit whose title begins with the same ..., automatically\n>> modify the todo list of rebase -i so that the commit marked for\n>> squashing come right after the commit to be modified, and change\n>> the action of the moved commit from pick to squash.\n>>\n>> Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>\n>\n> Hmph, did you forget to retitle the message, or keep in-body \"Subject:\"?\n\nSorry. Yes I did. Please amend it to -\n\n Subject: rebase -i --autosquash: auto-squash commits\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"129497","messageId":"7vr5r5lxlo.fsf@alter.siamese.dyndns.org","threadId":"21857","inReplyTo":"20091208150102.6117@nanako3.lavabit.com","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-08T07:43:31Z","receivedAt":"2009-12-08T07:43:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n>> Hmph, did you forget to retitle the message, or keep in-body \"Subject:\"?\n>\n> Sorry. Yes I did. Please amend it to -\n>\n>  Subject: rebase -i --autosquash: auto-squash commits\n\nOk.\n"},{"id":"129511","messageId":"7viqchhl7h.fsf@alter.siamese.dyndns.org","threadId":"21857","inReplyTo":"20091208121314.6117@nanako3.lavabit.com","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-08T09:24:50Z","receivedAt":"2009-12-08T09:24:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> @@ -519,6 +521,43 @@ get_saved_options () {\n>  \ttest -f \"$DOTEST\"/rebase-root && REBASE_ROOT=t\n>  }\n>  \n> +# Rearrange the todo list that has both \"pick sha1 msg\" and\n> +# \"pick sha1 !fixup/!squash msg\" appears in it so that the latter\n> +# comes immediately after the former, and change \"pick\" to\n> +# \"fixup\"/\"squash\".\n> +rearrange_squash () {\n> +\tsed -n -e 's/^pick \\([0-9a-f]*\\) !\\(squash\\) /\\1 \\2 /p' \\\n> +\t\t-e 's/^pick \\([0-9a-f]*\\) !\\(fixup\\) /\\1 \\2 /p' \\\n> +\t\t\"$1\" >\"$1.sq\"\n> +\ttest -s \"$1.sq\" || return\n> +\n> +\tsed -e '/^pick [0-9a-f]* !squash /d' \\\n> +\t\t-e '/^pick [0-9a-f]* !fixup /d' \\\n> +\t\t\"$1\" |\n> +\t(\n> +\t\tused=\n> +\t\twhile read pick sha1 message\n> +\t\tdo\n> +\t...\n> +\t\tdone >\"$1.rearranged\"\n> +\t)\n> +\tcat \"$1.rearranged\" >\"$1\"\n> +\trm -f \"$1.sq\"\n> +}\n\nThe logic to move the lines seem to have been improved since the last\nround, which is good.  I've amended this to remove \"$1.rearranged\" as well.\n\nUnlike the very initial round, but like the second round, this feature is\ncontrolled by an explicit command line option, so it should be reasonably\nsafe.\n\nI hate bikeshedding but somehow\n\n    git commit -m \"fixup! commit with this message\"\n\nfeels much more natural than having to write\n\n    git commit -m \"!fixup commit with this message\".\n"},{"id":"129515","messageId":"20091208093515.GA32655@sigill.intra.peff.net","threadId":"21857","inReplyTo":"7viqchhl7h.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-12-08T09:35:16Z","receivedAt":"2009-12-08T09:35:16Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Dec 08, 2009 at 01:24:50AM -0800, Junio C Hamano wrote:\n\n> I hate bikeshedding but somehow\n> \n>     git commit -m \"fixup! commit with this message\"\n> \n> feels much more natural than having to write\n> \n>     git commit -m \"!fixup commit with this message\".\n\nAlso:\n\n  $ bash\n  $ echo \"!fixup commit\"\n  bash: !fixup: event not found\n  $ echo \"fixup! commit\"\n  fixup! commit\n\n-Peff\n"},{"id":"129536","messageId":"fabb9a1e0912080551s32295cfahf05bdc715360360@mail.gmail.com","threadId":"21857","inReplyTo":"20091208093515.GA32655@sigill.intra.peff.net","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-12-08T13:51:14Z","receivedAt":"2009-12-08T13:51:14Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Tue, Dec 8, 2009 at 10:35, Jeff King <peff@peff.net> wrote:\n>  $ bash\n>  $ echo \"!fixup commit\"\n>  bash: !fixup: event not found\n>  $ echo \"fixup! commit\"\n>  fixup! commit\n\nSpeaking of which, must we use that annoying bang? I hate how bash\ngets in my way when I try to write a commit message with a a bang in\nit, I'd much rather use a different character that is not in risk of\nbeing mistreated by my shell. (Although it seems that bash does do TRT\nin the 'fixup!' case.)\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"129546","messageId":"vpqfx7l1qdi.fsf@bauges.imag.fr","threadId":"21857","inReplyTo":"20091208121314.6117@nanako3.lavabit.com","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2009-12-08T14:39:53Z","receivedAt":"2009-12-08T14:39:53Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> Teach a new option, --autosquash, to the interactive rebase.\n> When the commit log message begins with \"!fixup ...\", and there\n> is a commit whose title begins with the same ...\n\nYou should be clearer than \"title\" here. My understanding is that this\nis the _message_ (man git-commit talks about log message or commit\nmessage).\n\nIt's a detail, but I could make sense to allow putting something other\nthan the commit message here, like an object name:\n\ngit commit -m \"fixup! 66eb61bd\"\ngit commit -m \"fixup! HEAD^^\"\n\nThe last one is a bit tricky, since it should mean \"HEAD^^\" right\nbefore I did the commit.\n\n\nAll that said, I probably won't be a user of that particular feature\n(although I love the new \"fixup\" command for rebase -i), so don't see\nany complaint here, just food for thoughts ;-).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"129595","messageId":"20091209125555.6117@nanako3.lavabit.com","threadId":"21857","inReplyTo":"fabb9a1e0912080551s32295cfahf05bdc715360360@mail.gmail.com","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-12-09T03:55:55Z","receivedAt":"2009-12-09T03:55:55Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Sverre Rabbelier <srabbelier@gmail.com>\n\n> Heya,\n>\n> On Tue, Dec 8, 2009 at 10:35, Jeff King <peff@peff.net> wrote:\n>> $ bash\n>> $ echo \"!fixup commit\"\n>> bash: !fixup: event not found\n>> $ echo \"fixup! commit\"\n>> fixup! commit\n>\n> Speaking of which, must we use that annoying bang? I hate how bash\n> gets in my way when I try to write a commit message with a a bang in\n> it, I'd much rather use a different character that is not in risk of\n> being mistreated by my shell. (Although it seems that bash does do TRT\n> in the 'fixup!' case.)\n>\n> -- \n> Cheers,\n>\n> Sverre Rabbelier\n\nThere was a strong objection (I think from Johanes) against not \nusing 'unusual' letters during the initial round back in June \n2009. Even when explicitly giving '--auto-squash' from the \ncommand line, there can be commits with confusing titles \nlike \"fixup the ancient bug in cat-file\" in addition to \nthe ones you wanted to mark with the \"fixup!\" marker.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"129597","messageId":"727e50150912082041l4c4c1b73s30b64be7369adc21@mail.gmail.com","threadId":"21857","inReplyTo":"20091209125555.6117@nanako3.lavabit.com","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Aaron Cohen","fromEmail":"remleduff@gmail.com","sentAt":"2009-12-09T04:41:01Z","receivedAt":"2009-12-09T04:41:01Z","isPatch":true,"sender":{"key":"remleduff@gmail.com","avatar":null},"body":"On Tue, Dec 8, 2009 at 10:55 PM, Nanako Shiraishi <nanako3@lavabit.com> wrote:\n> Quoting Sverre Rabbelier <srabbelier@gmail.com>\n>\n>> Heya,\n>>\n>> On Tue, Dec 8, 2009 at 10:35, Jeff King <peff@peff.net> wrote:\n>>> $ bash\n>>> $ echo \"!fixup commit\"\n>>> bash: !fixup: event not found\n>>> $ echo \"fixup! commit\"\n>>> fixup! commit\n>>\n>> Speaking of which, must we use that annoying bang? I hate how bash\n>> gets in my way when I try to write a commit message with a a bang in\n>> it, I'd much rather use a different character that is not in risk of\n>> being mistreated by my shell. (Although it seems that bash does do TRT\n>> in the 'fixup!' case.)\n>>\n>> --\n>> Cheers,\n>>\n>> Sverre Rabbelier\n>\n> There was a strong objection (I think from Johanes) against not\n> using 'unusual' letters during the initial round back in June\n> 2009. Even when explicitly giving '--auto-squash' from the\n> command line, there can be commits with confusing titles\n> like \"fixup the ancient bug in cat-file\" in addition to\n> the ones you wanted to mark with the \"fixup!\" marker.\n>\n> --\n\nI'm sorry to pipe in with my perhaps half-baked idea from lurkerdom,\nbut would autosquash make more sense designed as a hook rather than as\na special case behavior of git-rebase?\n\nI think this feature could be implemented by having git-rebase call a\nhook if supplied the --autosquash command. The hook script would be\nsupplied with the id of the blobs being fixed up on standard input,\nand it could do whatever it wanted internally (including looking for\nmagic !commands in the commit messages of the blobs).\n\nThe result of the script should be the list of blobs to be commited as\na result of the script's munging, on standard output.\n"},{"id":"129606","messageId":"7vaaxsvfie.fsf@alter.siamese.dyndns.org","threadId":"21857","inReplyTo":"7viqchhl7h.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/3] Add a \"fix\" command to \"rebase --interactive\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-09T06:16:25Z","receivedAt":"2009-12-09T06:16:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Nanako Shiraishi <nanako3@lavabit.com> writes:\n>\n>> @@ -519,6 +521,43 @@ get_saved_options () {\n>>  \ttest -f \"$DOTEST\"/rebase-root && REBASE_ROOT=t\n>>  }\n>>  \n>> +# Rearrange the todo list that has both \"pick sha1 msg\" and\n>> +# \"pick sha1 !fixup/!squash msg\" appears in it so that the latter\n>> +# comes immediately after the former, and change \"pick\" to\n>> +# \"fixup\"/\"squash\".\n>> +rearrange_squash () {\n>> +\tsed -n -e 's/^pick \\([0-9a-f]*\\) !\\(squash\\) /\\1 \\2 /p' \\\n>> +\t\t-e 's/^pick \\([0-9a-f]*\\) !\\(fixup\\) /\\1 \\2 /p' \\\n>> +\t\t\"$1\" >\"$1.sq\"\n>> +\ttest -s \"$1.sq\" || return\n>> +\n>> +\tsed -e '/^pick [0-9a-f]* !squash /d' \\\n>> +\t\t-e '/^pick [0-9a-f]* !fixup /d' \\\n>> +\t\t\"$1\" |\n>> +\t(\n>> +\t\tused=\n>> +\t\twhile read pick sha1 message\n>> +\t\tdo\n>> +\t...\n>> +\t\tdone >\"$1.rearranged\"\n>> +\t)\n>> +\tcat \"$1.rearranged\" >\"$1\"\n>> +\trm -f \"$1.sq\"\n>> +}\n>\n> The logic to move the lines seem to have been improved since the last\n> round, which is good.  I've amended this to remove \"$1.rearranged\" as well.\n\nActually I think the logic in the version from the June is more correct;\ndoesn't this version drop commits that are marked as \"squash! <message>\"\nbut with a misspelled <message> part?  I think your old version, when it\ndidn't find a matching one in early part, left such an unmatched \"fixup\"\nin place.\n\nHere is a fix-up patch I think should be squashed in.  I added a test to\nmake sure that a mismatching \"squash!\" is kept in place.  Please double\ncheck for sanity.\n\nThanks.\n\n git-rebase--interactive.sh   |   38 ++++++++++++++++----------------------\n t/t3415-rebase-autosquash.sh |   15 +++++++++++++++\n 2 files changed, 31 insertions(+), 22 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex c68cc5b..935e9e1 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -531,29 +531,23 @@ rearrange_squash () {\n \t\t\"$1\" >\"$1.sq\"\n \ttest -s \"$1.sq\" || return\n \n-\tsed -e '/^pick [0-9a-f]* squash! /d' \\\n-\t\t-e '/^pick [0-9a-f]* fixup! /d' \\\n-\t\t\"$1\" |\n-\t(\n-\t\tused=\n-\t\twhile read pick sha1 message\n+\tused=\n+\twhile read pick sha1 message\n+\tdo\n+\t\tcase \" $used\" in\n+\t\t*\" $sha1 \"*) continue ;;\n+\t\tesac\n+\t\techo \"$pick $sha1 $message\"\n+\t\twhile read squash action msg\n \t\tdo\n-\t\t\techo \"$pick $sha1 $message\"\n-\t\t\twhile read squash action msg\n-\t\t\tdo\n-\t\t\t\tcase \" $used\" in\n-\t\t\t\t*\" $squash \"*)\n-\t\t\t\t\tcontinue ;;\n-\t\t\t\tesac\n-\t\t\t\tcase \"$message\" in\n-\t\t\t\t\"$msg\"*)\n-\t\t\t\t\techo \"$action $squash $action! $msg\"\n-\t\t\t\t\tused=\"$used$squash \"\n-\t\t\t\t\t;;\n-\t\t\t\tesac\n-\t\t\tdone <\"$1.sq\"\n-\t\tdone >\"$1.rearranged\"\n-\t)\n+\t\t\tcase \"$message\" in\n+\t\t\t\"$msg\"*)\n+\t\t\t\techo \"$action $squash $action! $msg\"\n+\t\t\t\tused=\"$used$squash \"\n+\t\t\t\t;;\n+\t\t\tesac\n+\t\tdone <\"$1.sq\"\n+\tdone >\"$1.rearranged\" <\"$1\"\n \tcat \"$1.rearranged\" >\"$1\"\n \trm -f \"$1.sq\" \"$1.rearranged\"\n }\ndiff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh\nindex f7a0f7a..b63f4e2 100755\n--- a/t/t3415-rebase-autosquash.sh\n+++ b/t/t3415-rebase-autosquash.sh\n@@ -55,4 +55,19 @@ test_expect_success 'auto squash' '\n \ttest 2 = $(git cat-file commit HEAD^ | grep first | wc -l)\n '\n \n+test_expect_success 'misspelled auto squash' '\n+\tgit reset --hard base &&\n+\techo 1 >file1 &&\n+\tgit add -u &&\n+\ttest_tick &&\n+\tgit commit -m \"squash! forst\"\n+\tgit tag final-missquash &&\n+\ttest_tick &&\n+\tgit rebase --autosquash -i HEAD^^^ &&\n+\tgit log --oneline >actual &&\n+\ttest 4 = $(wc -l <actual) &&\n+\tgit diff --exit-code final-missquash &&\n+\ttest 0 = $(git rev-list final-missquash...HEAD | wc -l)\n+'\n+\n test_done\n"}]}