{"thread":{"id":"20336","subject":"[PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing.","startedAt":"2009-08-01T16:57:08Z","lastAt":"2009-08-05T00:15:37Z","messageCount":3,"participants":["Thell Fowler","Nanako Shiraishi"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"119348","messageId":"f002290c0908010957pf14d18dv7c80270eb9af3c8@mail.gmail.com","threadId":"20336","inReplyTo":null,"subject":"[PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing.","fromName":"Thell Fowler","fromEmail":"tbfowler4@gmail.com","sentAt":"2009-08-01T16:57:08Z","receivedAt":"2009-08-01T16:57:08Z","isPatch":true,"sender":{"key":"tbfowler4@gmail.com","avatar":"https://gravatar.com/avatar/1b038b543b3facd3ae8cbfcc05ae06547e9f2015b5e661efbec68d662955a826?d=mp&s=160"},"body":"  - Added --allow-eof-whitelines to git apply to short-circuit removal\nof new empty lines when tailing-space is set.\n  - Added pass-through to apply from git-am.sh\n  - Added pass-through to git-am from git-rebase.sh\n  - Added the auto-completion entries.\n\nSigned-off-by: TBFowler <thell@almostautomated.com>\n---\n builtin-apply.c                        |    5 ++++-\n contrib/completion/git-completion.bash |    4 ++--\n git-am.sh                              |    3 +++\n git-rebase.sh                          |    3 +++\n 4 files changed, 12 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-apply.c b/builtin-apply.c\nindex dc0ff5e..79be05c 100644\n--- a/builtin-apply.c\n+++ b/builtin-apply.c\n@@ -43,6 +43,7 @@ static int apply = 1;\n static int apply_in_reverse;\n static int apply_with_reject;\n static int apply_verbosely;\n+static int keep_new_eof_whitelines;\n static int no_add;\n static const char *fake_ancestor;\n static int line_termination = '\\n';\n@@ -1996,7 +1997,7 @@ static int apply_one_fragment(struct image *img,\nstruct fragment *frag,\n \t\t\t\terror(\"invalid start of line: '%c'\", first);\n \t\t\treturn -1;\n \t\t}\n-\t\tif (added_blank_line)\n+\t\tif (added_blank_line && !keep_new_eof_whitelines)\n \t\t\tnew_blank_lines_at_end++;\n \t\telse\n \t\t\tnew_blank_lines_at_end = 0;\n@@ -3304,6 +3305,8 @@ int cmd_apply(int argc, const char **argv, const\nchar *unused_prefix)\n \t\t{ OPTION_CALLBACK, 0, \"whitespace\", &whitespace_option, \"action\",\n \t\t\t\"detect new or modified lines that have whitespace errors\",\n \t\t\t0, option_parse_whitespace },\n+\t\tOPT_BOOLEAN(0, \"allow-eof-whitelines\", &keep_new_eof_whitelines,\n+\t\t\t\"allow processing of whitespace fix but don't suppress new\nwhitelines at end of file\"),\n \t\tOPT_BOOLEAN('R', \"reverse\", &apply_in_reverse,\n \t\t\t\"apply the patch in reverse\"),\n \t\tOPT_BOOLEAN(0, \"unidiff-zero\", &unidiff_zero,\ndiff --git a/contrib/completion/git-completion.bash\nb/contrib/completion/git-completion.bash\nindex 745b5fb..512b14c 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -675,7 +675,7 @@ _git_am ()\n \t\t__gitcomp \"\n \t\t\t--3way --committer-date-is-author-date --ignore-date\n \t\t\t--interactive --keep --no-utf8 --signoff --utf8\n-\t\t\t--whitespace=\n+\t\t\t--whitespace= --allow-eof-whitelines\n \t\t\t\"\n \t\treturn\n \tesac\n@@ -695,7 +695,7 @@ _git_apply ()\n \t\t\t--stat --numstat --summary --check --index\n \t\t\t--cached --index-info --reverse --reject --unidiff-zero\n \t\t\t--apply --no-add --exclude=\n-\t\t\t--whitespace= --inaccurate-eof --verbose\n+\t\t\t--whitespace= --allow-eof-whitelines --inaccurate-eof --verbose\n \t\t\t\"\n \t\treturn\n \tesac\ndiff --git a/git-am.sh b/git-am.sh\nindex d64d997..5757674 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -16,6 +16,7 @@ s,signoff       add a Signed-off-by line to the commit message\n u,utf8          recode into utf8 (default)\n k,keep          pass -k flag to git-mailinfo\n whitespace=     pass it through git-apply\n+allow-eof-whitelines        pass it through git-apply\n directory=      pass it through git-apply\n C=              pass it through git-apply\n p=              pass it through git-apply\n@@ -299,6 +300,8 @@ do\n \t\tshift; resolvemsg=$1 ;;\n \t--whitespace|--directory)\n \t\tgit_apply_opt=\"$git_apply_opt $(sq \"$1=$2\")\"; shift ;;\n+\t--allow-eof-whitelines)\n+\t\tgit_apply_opt=\"$git_apply_opt $1\" ;;\n \t-C|-p)\n \t\tgit_apply_opt=\"$git_apply_opt $(sq \"$1$2\")\"; shift ;;\n \t--patch-format)\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 18bc694..1556224 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -333,6 +333,9 @@ do\n \t\t\t;;\n \t\tesac\n \t\t;;\n+\t--allow-eof-whitelines)\n+\t\tgit_am_opt=\"$git_am_opt $1\"\n+\t\t;;\n \t--committer-date-is-author-date|--ignore-date)\n \t\tgit_am_opt=\"$git_am_opt $1\"\n \t\tforce_rebase=t\n-- \n1.6.4.rc3.dirty\n"},{"id":"119522","messageId":"20090805061519.6117@nanako3.lavabit.com","threadId":"20336","inReplyTo":"f002290c0908010957pf14d18dv7c80270eb9af3c8@mail.gmail.com","subject":"Re: [PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing.","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-08-04T21:15:19Z","receivedAt":"2009-08-04T21:15:19Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Thell Fowler <tbfowler4@gmail.com>\n\n>   - Added --allow-eof-whitelines to git apply to short-circuit removal\n> of new empty lines when tailing-space is set.\n>   - Added pass-through to apply from git-am.sh\n>   - Added pass-through to git-am from git-rebase.sh\n>   - Added the auto-completion entries.\n>\n> Signed-off-by: TBFowler <thell@almostautomated.com>\n\nI like this new feature. However, this topic came up last week, and Junio said that whitespace checking should be controlled with the attributes mechanism.\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/124113/focus=124138\n\nPlease do not talk \"I did this, I did that\" in your proposed commit log\nmessage.  From Documentation/SubmittingPatches:\n\n\t- the body should provide a meaningful commit message, which:\n\t\t- uses the imperative, present tense: \"change\",\n\t\t  not \"changed\" or \"changes\".\n\t\t- includes motivation for the change, and contrasts\n\t\t  its implementation with previous behaviour\n\nIn other words, the messages are often written as if you are giving an order to the program to correct itself.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"119544","messageId":"1249431338.2774.59.camel@GWPortableVCS","threadId":"20336","inReplyTo":"20090805061519.6117@nanako3.lavabit.com","subject":"Re: [PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing.","fromName":"Thell Fowler","fromEmail":"tbfowler4@gmail.com","sentAt":"2009-08-05T00:15:37Z","receivedAt":"2009-08-05T00:15:37Z","isPatch":true,"sender":{"key":"tbfowler4@gmail.com","avatar":"https://gravatar.com/avatar/1b038b543b3facd3ae8cbfcc05ae06547e9f2015b5e661efbec68d662955a826?d=mp&s=160"},"body":"On Wed, 2009-08-05 at 06:15 +0900, Nanako Shiraishi wrote:\n> Quoting Thell Fowler <tbfowler4@gmail.com>\n> \n> >   - Added --allow-eof-whitelines to git apply to short-circuit removal\n> > of new empty lines when tailing-space is set.\n> >   - Added pass-through to apply from git-am.sh\n> >   - Added pass-through to git-am from git-rebase.sh\n> >   - Added the auto-completion entries.\n> >\n> > Signed-off-by: TBFowler <thell@almostautomated.com>\n> \n> I like this new feature. However, this topic came up last week, and Junio said that whitespace checking should be controlled with the attributes mechanism.\n> \n> http://thread.gmane.org/gmane.comp.version-control.git/124113/focus=124138\n> \nSeemed that the issue/resolution was still open for discussion.\nhttp://thread.gmane.org/gmane.comp.version-control.git/124113/focus=124138\n\nShould this be re-done as a whitespace attribute?\n\n\n> Please do not talk \"I did this, I did that\" in your proposed commit log\n> message.  From Documentation/SubmittingPatches:\n> \n> \t- the body should provide a meaningful commit message, which:\n> \t\t- uses the imperative, present tense: \"change\",\n> \t\t  not \"changed\" or \"changes\".\n> \t\t- includes motivation for the change, and contrasts\n> \t\t  its implementation with previous behaviour\n> \n> In other words, the messages are often written as if you are giving an order to the program to correct itself.\n> \n\nGot it. ...'giving an order'...  and the motivation; should be easy to remember.\n\nThank you for the feedback and instruction.\nThell\n"}]}