{"thread":{"id":"22181","subject":"[PATCHv2 0/3] rebase-i: Ignore comments and blank lines among squash/fixup commands","startedAt":"2010-01-12T15:38:33Z","lastAt":"2010-01-13T06:55:50Z","messageCount":6,"participants":["Michael Haggerty","Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"131376","messageId":"cover.1263310175.git.mhagger@alum.mit.edu","threadId":"22181","inReplyTo":"7vr5pw3pwp.fsf@alter.siamese.dyndns.org","subject":"[PATCHv2 0/3] rebase-i: Ignore comments and blank lines among squash/fixup commands","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2010-01-12T15:38:33Z","receivedAt":"2010-01-12T15:38:33Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"Here is v2 of the patch (now patch series) for making \"rebase -i\"\nignore comments and blank lines while it is processing blocks of\nsquash/fixup commands.\n\nPlease note that this version applies to \"next\", not \"master\", because\nit depends on some changes to t/t3404-rebase-interactive.sh that were\nmade in mh/rebase-fixup.  (This dependency is superficial and could be\nremoved if necessary.)\n\nThe first patch in this series is not essential to the functionality\nbut I found it useful when debugging the tests.\n\nMichael Haggerty (3):\n  lib-rebase: Provide clearer debugging info about what the editor did\n  lib-rebase: Allow comments and blank lines to be added to the rebase\n    script\n  rebase-i: Ignore comments and blank lines in peek_next_command\n\n git-rebase--interactive.sh    |    2 +-\n t/lib-rebase.sh               |   26 +++++++++++++++++++-------\n t/t3404-rebase-interactive.sh |   24 ++++++++++++++++++++++++\n 3 files changed, 44 insertions(+), 8 deletions(-)\n"},{"id":"131377","messageId":"a6ef19853c00263c2875026cb438ce46d3fcf950.1263310175.git.mhagger@alum.mit.edu","threadId":"22181","inReplyTo":"7vr5pw3pwp.fsf@alter.siamese.dyndns.org","subject":"[PATCHv2 1/3] lib-rebase: Provide clearer debugging info about what the editor did","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2010-01-12T15:38:34Z","receivedAt":"2010-01-12T15:38:34Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"(For testing \"rebase -i\"): Output the \"rebase -i\" command script\nbefore and after the edits, to make it clearer what the editor did.\n\nSigned-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\n t/lib-rebase.sh |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex f4dda02..0fce595 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -29,6 +29,7 @@ test -z \"$EXPECT_COUNT\" ||\n test -z \"$FAKE_LINES\" && exit\n grep -v '^#' < \"$1\" > \"$1\".tmp\n rm -f \"$1\"\n+echo 'rebase -i script before editing:'\n cat \"$1\".tmp\n action=pick\n for line in $FAKE_LINES; do\n@@ -36,12 +37,12 @@ for line in $FAKE_LINES; do\n \tsquash|fixup|edit|reword)\n \t\taction=\"$line\";;\n \t*)\n-\t\techo sed -n \"${line}s/^pick/$action/p\"\n-\t\tsed -n \"${line}p\" < \"$1\".tmp\n \t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n \t\taction=pick;;\n \tesac\n done\n+echo 'rebase -i script after editing:'\n+cat \"$1\"\n EOF\n \n \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n-- \n1.6.6.140.ga53ad\n"},{"id":"131378","messageId":"253943b83514372775e375575bba9d7de33c0b28.1263310175.git.mhagger@alum.mit.edu","threadId":"22181","inReplyTo":"7vr5pw3pwp.fsf@alter.siamese.dyndns.org","subject":"[PATCHv2 2/3] lib-rebase: Allow comments and blank lines to be added to the rebase script","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2010-01-12T15:38:35Z","receivedAt":"2010-01-12T15:38:35Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"(For testing \"rebase -i\"): Support new action types in $FAKE_LINES to\nallow comments and blank lines to be added to the \"rebase -i\" command\nlist.\n\nSigned-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\n t/lib-rebase.sh |   21 ++++++++++++++++-----\n 1 files changed, 16 insertions(+), 5 deletions(-)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 0fce595..0db8250 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -5,13 +5,20 @@\n # - override the commit message with $FAKE_COMMIT_MESSAGE,\n # - amend the commit message with $FAKE_COMMIT_AMEND\n # - check that non-commit messages have a certain line count with $EXPECT_COUNT\n-# - rewrite a rebase -i script with $FAKE_LINES in the form\n+# - rewrite a rebase -i script as directed by $FAKE_LINES.\n+#   $FAKE_LINES consists of a sequence of words separated by spaces.\n+#   The following word combinations are possible:\n #\n-#\t\"[<lineno1>] [<lineno2>]...\"\n+#   \"<lineno>\" -- add a \"pick\" line with the SHA1 taken from the\n+#       specified line.\n #\n-#   If a line number is prefixed with \"squash\", \"fixup\", \"edit\", or\n-#   \"reword\", the respective line's command will be replaced with the\n-#   specified one.\n+#   \"<cmd> <lineno>\" -- add a line with the specified command\n+#       (\"squash\", \"fixup\", \"edit\", or \"reword\") and the SHA1 taken\n+#       from the specified line.\n+#\n+#   \"#\" -- Add a comment line.\n+#\n+#   \">\" -- Add a blank line.\n \n set_fake_editor () {\n \techo \"#!$SHELL_PATH\" >fake-editor.sh\n@@ -36,6 +43,10 @@ for line in $FAKE_LINES; do\n \tcase $line in\n \tsquash|fixup|edit|reword)\n \t\taction=\"$line\";;\n+\t\"#\")\n+\t\techo '# comment' >> \"$1\";;\n+\t\">\")\n+\t\techo >> \"$1\";;\n \t*)\n \t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n \t\taction=pick;;\n-- \n1.6.6.140.ga53ad\n"},{"id":"131379","messageId":"39d924c84c79adc0dc0df9933ccf6f19dfa6937c.1263310175.git.mhagger@alum.mit.edu","threadId":"22181","inReplyTo":"7vr5pw3pwp.fsf@alter.siamese.dyndns.org","subject":"[PATCHv2 3/3] rebase-i: Ignore comments and blank lines in peek_next_command","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2010-01-12T15:38:36Z","receivedAt":"2010-01-12T15:38:36Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"Previously, blank lines and/or comments within a series of\nsquash/fixup commands would confuse \"git rebase -i\" into thinking that\nthe series was finished.  It would therefore require the user to edit\nthe commit message for the squash/fixup commits seen so far.  Then,\nafter continuing, it would ask the user to edit the commit message\nagain.\n\nIgnore comments and blank lines within a group of squash/fixup\ncommands, allowing them to be processed in one go.\n\nSigned-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\n git-rebase--interactive.sh    |    2 +-\n t/t3404-rebase-interactive.sh |   24 ++++++++++++++++++++++++\n 2 files changed, 25 insertions(+), 1 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 27479db..2e56e64 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -340,7 +340,7 @@ make_squash_message () {\n }\n \n peek_next_command () {\n-\tsed -n \"1s/ .*$//p\" < \"$TODO\"\n+\tsed -n -e \"/^#/d\" -e \"/^$/d\" -e \"s/ .*//p\" -e \"q\" < \"$TODO\"\n }\n \n do_next () {\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex ea26115..d9382e4 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -265,6 +265,30 @@ test_expect_success 'squash and fixup generate correct log messages' '\n \tgit branch -D squash-fixup\n '\n \n+test_expect_success 'squash ignores comments' '\n+\tgit checkout -b skip-comments E &&\n+\tbase=$(git rev-parse HEAD~4) &&\n+\tFAKE_COMMIT_AMEND=\"ONCE\" FAKE_LINES=\"# 1 # squash 2 # squash 3 # squash 4 #\" \\\n+\t\tEXPECT_HEADER_COUNT=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 skip-comments\n+'\n+\n+test_expect_success 'squash ignores blank lines' '\n+\tgit checkout -b skip-blank-lines E &&\n+\tbase=$(git rev-parse HEAD~4) &&\n+\tFAKE_COMMIT_AMEND=\"ONCE\" FAKE_LINES=\"> 1 > squash 2 > squash 3 > squash 4 >\" \\\n+\t\tEXPECT_HEADER_COUNT=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 skip-blank-lines\n+'\n+\n test_expect_success 'squash works as expected' '\n \tfor n in one two three four\n \tdo\n-- \n1.6.6.140.ga53ad\n"},{"id":"131389","messageId":"alpine.DEB.1.00.1001121737310.4985@pacific.mpi-cbg.de","threadId":"22181","inReplyTo":"cover.1263310175.git.mhagger@alum.mit.edu","subject":"Re: [PATCHv2 0/3] rebase-i: Ignore comments and blank lines among squash/fixup commands","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-01-12T16:37:47Z","receivedAt":"2010-01-12T16:37:47Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 12 Jan 2010, Michael Haggerty wrote:\n\n> Here is v2 of the patch (now patch series) for making \"rebase -i\" ignore \n> comments and blank lines while it is processing blocks of squash/fixup \n> commands.\n\nMe likee.\n\nThanks,\nDscho\n"},{"id":"131427","messageId":"7vd41etrwp.fsf@alter.siamese.dyndns.org","threadId":"22181","inReplyTo":"a6ef19853c00263c2875026cb438ce46d3fcf950.1263310175.git.mhagger@alum.mit.edu","subject":"Re: [PATCHv2 1/3] lib-rebase: Provide clearer debugging info about what the editor did","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-13T06:55:50Z","receivedAt":"2010-01-13T06:55:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Very nice; thanks.\n"}]}