{"thread":{"id":"34291","subject":"[PATCH] lib-rebase: use write_script","startedAt":"2013-06-27T18:30:25Z","lastAt":"2013-07-01T16:56:43Z","messageCount":6,"participants":["Andrew Pimlott","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"222119","messageId":"1372357825-21824-1-git-send-email-andrew@pimlott.net","threadId":"34291","inReplyTo":null,"subject":"[PATCH] lib-rebase: use write_script","fromName":"Andrew Pimlott","fromEmail":"andrew@pimlott.net","sentAt":"2013-06-27T18:30:25Z","receivedAt":"2013-06-27T18:30:25Z","isPatch":true,"sender":{"key":"andrew@pimlott.net","avatar":null},"body":"\nSigned-off-by: Andrew Pimlott <andrew@pimlott.net>\n---\n t/lib-rebase.sh |    4 +---\n 1 file changed, 1 insertion(+), 3 deletions(-)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 0b41155..7b42199 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -24,8 +24,7 @@\n #   \">\" -- Add a blank line.\n \n set_fake_editor () {\n-\techo \"#!$SHELL_PATH\" >fake-editor.sh\n-\tcat >> fake-editor.sh <<\\EOF\n+\twrite_script fake-editor.sh <<\\EOF\n case \"$1\" in\n */COMMIT_EDITMSG)\n \ttest -z \"$EXPECT_HEADER_COUNT\" ||\n@@ -65,7 +64,6 @@ cat \"$1\"\n EOF\n \n \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n-\tchmod a+x fake-editor.sh\n }\n \n # After set_cat_todo_editor, rebase -i will write the todo list (ignoring\n-- \n1.7.10.4\n"},{"id":"222120","messageId":"7va9mbs8lw.fsf@alter.siamese.dyndns.org","threadId":"34291","inReplyTo":"1372357825-21824-1-git-send-email-andrew@pimlott.net","subject":"Re: [PATCH] lib-rebase: use write_script","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-27T18:37:31Z","receivedAt":"2013-06-27T18:37:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Pimlott <andrew@pimlott.net> writes:\n\n> Signed-off-by: Andrew Pimlott <andrew@pimlott.net>\n> ---\n>  t/lib-rebase.sh |    4 +---\n>  1 file changed, 1 insertion(+), 3 deletions(-)\n>\n> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\n> index 0b41155..7b42199 100644\n> --- a/t/lib-rebase.sh\n> +++ b/t/lib-rebase.sh\n> @@ -24,8 +24,7 @@\n>  #   \">\" -- Add a blank line.\n>  \n>  set_fake_editor () {\n> -\techo \"#!$SHELL_PATH\" >fake-editor.sh\n> -\tcat >> fake-editor.sh <<\\EOF\n> +\twrite_script fake-editor.sh <<\\EOF\n>  case \"$1\" in\n>  */COMMIT_EDITMSG)\n>  \ttest -z \"$EXPECT_HEADER_COUNT\" ||\n> @@ -65,7 +64,6 @@ cat \"$1\"\n>  EOF\n>  \n>  \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n> -\tchmod a+x fake-editor.sh\n>  }\n>  \n>  # After set_cat_todo_editor, rebase -i will write the todo list (ignoring\n\nThanks, but it should probably be\n\n\twrite_script fake-editor.sh <<-\\EOF\n        case \"$1\" in\n        ...\n        EOF\n\n        test_set_editor ...\n\nif the aim is to modernize this part.\n"},{"id":"222124","messageId":"1372359086-sup-9704@pimlott.net","threadId":"34291","inReplyTo":"7va9mbs8lw.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] lib-rebase: use write_script","fromName":"Andrew Pimlott","fromEmail":"andrew@pimlott.net","sentAt":"2013-06-27T19:02:45Z","receivedAt":"2013-06-27T19:02:45Z","isPatch":true,"sender":{"key":"andrew@pimlott.net","avatar":null},"body":"Excerpts from Junio C Hamano's message of Thu Jun 27 11:37:31 -0700 2013:\n> Thanks, but it should probably be\n> \n>     write_script fake-editor.sh <<-\\EOF\n>         case \"$1\" in\n>         ...\n>         EOF\n> \n>         test_set_editor ...\n> \n> if the aim is to modernize this part.\n\nYes, the goal is to make that file consistently use the current\npractice.  (My syntax highlighting doesn't like it, but...)  I should\nupdate the function I introduced first.  I will re-submit the rebase -i\n--autosquash  patch and wait for acceptance before trying to fix other\nthings.\n\nAndrew\n"},{"id":"222132","messageId":"7vvc4zqnve.fsf@alter.siamese.dyndns.org","threadId":"34291","inReplyTo":"1372359086-sup-9704@pimlott.net","subject":"Re: [PATCH] lib-rebase: use write_script","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-27T20:50:45Z","receivedAt":"2013-06-27T20:50:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Pimlott <andrew@pimlott.net> writes:\n\n> I should update the function I introduced first.  I will re-submit\n> the rebase -i --autosquash patch and wait for acceptance before\n> trying to fix other things.\n\nThanks.\n"},{"id":"222282","messageId":"1372695617-sup-5251@pimlott.net","threadId":"34291","inReplyTo":"7vvc4zqnve.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] lib-rebase: use write_script","fromName":"Andrew Pimlott","fromEmail":"andrew@pimlott.net","sentAt":"2013-07-01T16:23:38Z","receivedAt":"2013-07-01T16:23:38Z","isPatch":true,"sender":{"key":"andrew@pimlott.net","avatar":null},"body":"Excerpts from Junio C Hamano's message of Thu Jun 27 13:50:45 -0700 2013:\n> Andrew Pimlott <andrew@pimlott.net> writes:\n> \n> > I should update the function I introduced first.  I will re-submit\n> > the rebase -i --autosquash patch and wait for acceptance before\n> > trying to fix other things.\n> \n> Thanks.\n\nApplies on top of rebase -i patch already accepted.  Mostly whitespace\nchanges.\n\nThanks for your other help.\n\nAndrew\n\n---8<---\nSubject: [PATCH] lib-rebase: style: use write_script, <<-\\EOF\n\n\nSigned-off-by: Andrew Pimlott <andrew@pimlott.net>\n---\n t/lib-rebase.sh |   74 +++++++++++++++++++++++++++----------------------------\n 1 file changed, 36 insertions(+), 38 deletions(-)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 7f119e2..8ff87fb 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -24,48 +24,46 @@\n #   \">\" -- Add a blank line.\n \n set_fake_editor () {\n-\techo \"#!$SHELL_PATH\" >fake-editor.sh\n-\tcat >> fake-editor.sh <<\\EOF\n-case \"$1\" in\n-*/COMMIT_EDITMSG)\n-\ttest -z \"$EXPECT_HEADER_COUNT\" ||\n-\t\ttest \"$EXPECT_HEADER_COUNT\" = \"$(sed -n '1s/^# This is a combination of \\(.*\\) commits\\./\\1/p' < \"$1\")\" ||\n+\twrite_script fake-editor.sh <<-\\EOF\n+\tcase \"$1\" in\n+\t*/COMMIT_EDITMSG)\n+\t\ttest -z \"$EXPECT_HEADER_COUNT\" ||\n+\t\t\ttest \"$EXPECT_HEADER_COUNT\" = \"$(sed -n '1s/^# This is a combination of \\(.*\\) commits\\./\\1/p' < \"$1\")\" ||\n+\t\t\texit\n+\t\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n+\t\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n \t\texit\n-\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n-\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n-\texit\n-\t;;\n-esac\n-test -z \"$EXPECT_COUNT\" ||\n-\ttest \"$EXPECT_COUNT\" = $(sed -e '/^#/d' -e '/^$/d' < \"$1\" | wc -l) ||\n-\texit\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-\tcase $line in\n-\tsquash|fixup|edit|reword)\n-\t\taction=\"$line\";;\n-\texec*)\n-\t\techo \"$line\" | sed 's/_/ /g' >> \"$1\";;\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+\t\t;;\n \tesac\n-done\n-echo 'rebase -i script after editing:'\n-cat \"$1\"\n-EOF\n+\ttest -z \"$EXPECT_COUNT\" ||\n+\t\ttest \"$EXPECT_COUNT\" = $(sed -e '/^#/d' -e '/^$/d' < \"$1\" | wc -l) ||\n+\t\texit\n+\ttest -z \"$FAKE_LINES\" && exit\n+\tgrep -v '^#' < \"$1\" > \"$1\".tmp\n+\trm -f \"$1\"\n+\techo 'rebase -i script before editing:'\n+\tcat \"$1\".tmp\n+\taction=pick\n+\tfor line in $FAKE_LINES; do\n+\t\tcase $line in\n+\t\tsquash|fixup|edit|reword)\n+\t\t\taction=\"$line\";;\n+\t\texec*)\n+\t\t\techo \"$line\" | sed 's/_/ /g' >> \"$1\";;\n+\t\t\"#\")\n+\t\t\techo '# comment' >> \"$1\";;\n+\t\t\">\")\n+\t\t\techo >> \"$1\";;\n+\t\t*)\n+\t\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n+\t\t\taction=pick;;\n+\t\tesac\n+\tdone\n+\techo 'rebase -i script after editing:'\n+\tcat \"$1\"\n+\tEOF\n \n \ttest_set_editor \"$(pwd)/fake-editor.sh\"\n-\tchmod a+x fake-editor.sh\n }\n \n # After set_cat_todo_editor, rebase -i will write the todo list (ignoring\n-- \n1.7.10.4\n"},{"id":"222288","messageId":"7vsizygqwk.fsf@alter.siamese.dyndns.org","threadId":"34291","inReplyTo":"1372695617-sup-5251@pimlott.net","subject":"Re: [PATCH] lib-rebase: use write_script","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-01T16:56:43Z","receivedAt":"2013-07-01T16:56:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Pimlott <andrew@pimlott.net> writes:\n\n> Applies on top of rebase -i patch already accepted.  Mostly whitespace\n> changes.\n\nThanks, will queue.\n"}]}