{"thread":{"id":"17802","subject":"[PATCH] git diff ignore-space options should ignore missing EOL at EOF differences","startedAt":"2009-02-15T14:09:12Z","lastAt":"2009-02-25T09:35:06Z","messageCount":6,"participants":["demerphq","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"104777","messageId":"9b18b3110902150609q13333619k98f87a4a36a09030@mail.gmail.com","threadId":"17802","inReplyTo":null,"subject":"[PATCH] git diff ignore-space options should ignore missing EOL at EOF differences","fromName":"demerphq","fromEmail":"demerphq@gmail.com","sentAt":"2009-02-15T14:09:12Z","receivedAt":"2009-02-15T14:09:12Z","isPatch":true,"sender":{"key":"demerphq@gmail.com","avatar":null},"body":"Fix bug where the diff library complains about missing EOL at EOF\nmismatches even when run under the various ignore whitespace options.\n\nUnfortunately the routine that needs the whitespace flags doesn't get\npassed them directly, and is part of the API for the diff library, so\ncan't be modified.\n\nTherefore it seems the best solution is to modify the xdemitcb_t struct\nso that the flags are available inside the emit routine and then copy\nthem over at a suitable point in the call tree to ensure that they are\nalways the same.\n\nThis also adds a new flag to control this behavior independently of the\nother whitespace options, and a new switch '--ignore-space-at-eof' to\ngit diff to expose the flag, as well as some slight clarifying language\nto document the implications of the different whitespace options.\n\nAlso includes new tests to exercise each of the possible whitespace\noptions and verify that the EOF mismatch detection works as expected,\nand is correctly suppressed by the relevant options.\n\nSigned-off-by: Yves Orton <demerphq@gmail.com>\n---\n Documentation/diff-options.txt         |    9 ++-\n contrib/completion/git-completion.bash |    1 +\n diff.c                                 |    2 +\n t/t4015-diff-whitespace.sh             |   79 ++++++++++++++++++++++++++++++++\n xdiff/xdiff.h                          |   10 ++++-\n xdiff/xdiffi.c                         |    3 +\n xdiff/xutils.c                         |    5 ++-\n 7 files changed, 104 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 813a7b1..6bc40e5 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -207,14 +207,17 @@ override configuration settings.\n --text::\n \tTreat all files as text.\n\n+--ignore-space-at-eof::\n+\tIgnore changes in whitespace at EOF.\n+\n --ignore-space-at-eol::\n-\tIgnore changes in whitespace at EOL.\n+\tIgnore changes in whitespace at EOL (including EOF).\n\n -b::\n --ignore-space-change::\n \tIgnore changes in amount of whitespace.  This ignores whitespace\n-\tat line end, and considers all other sequences of one or\n-\tmore whitespace characters to be equivalent.\n+\tat line and file end, and considers all other sequences of one\n+\tor more whitespace characters to be equivalent.\n\n -w::\n --ignore-all-space::\ndiff --git a/contrib/completion/git-completion.bash\nb/contrib/completion/git-completion.bash\nindex 412d2c0..5c6b942 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -801,6 +801,7 @@ __git_diff_common_options=\"--stat --numstat\n--shortstat --summary\n \t\t\t--full-index --binary --abbrev --diff-filter=\n \t\t\t--find-copies-harder\n \t\t\t--text --ignore-space-at-eol --ignore-space-change\n+\t\t\t--ignore-space-at-eof\n \t\t\t--ignore-all-space --exit-code --quiet --ext-diff\n \t\t\t--no-ext-diff\n \t\t\t--no-prefix --src-prefix= --dst-prefix=\ndiff --git a/diff.c b/diff.c\nindex 006aa01..51a0c90 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2572,6 +2572,8 @@ int diff_opt_parse(struct diff_options *options,\nconst char **av, int ac)\n \t\toptions->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;\n \telse if (!strcmp(arg, \"--ignore-space-at-eol\"))\n \t\toptions->xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL;\n+\telse if (!strcmp(arg, \"--ignore-space-at-eof\"))\n+\t\toptions->xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOF;\n \telse if (!strcmp(arg, \"--patience\"))\n \t\toptions->xdl_opts |= XDF_PATIENCE_DIFF;\n\ndiff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\nindex 6d13da3..1ba851e 100755\n--- a/t/t4015-diff-whitespace.sh\n+++ b/t/t4015-diff-whitespace.sh\n@@ -51,6 +51,85 @@ test_expect_success \"Ray's example with -w\"\n'test_cmp expect out'\n git diff -b > out\n test_expect_success \"Ray's example with -b\" 'test_cmp expect out'\n\n+# newline at eof tests (original has no newline)\n+IGNORE_SPACE_AT_EOF_OPTS=\"-w -b --ignore-all-space\n--ignore-space-change --ignore-space-at-eol --ignore-space-at-eof\"\n+tr -d \"\\n\" << EOF > x\n+this file has no newline at end of file\n+EOF\n+\n+git update-index x\n+\n+cat << EOF > x\n+this file does have a newline at the end of file\n+EOF\n+\n+cat << EOF > expect\n+diff --git a/x b/x\n+index 7668968..95ce259 100644\n+--- a/x\n++++ b/x\n+@@ -1 +1 @@\n+-this file has no newline at end of file\n++this file does have a newline at the end of file\n+EOF\n+for opt in $IGNORE_SPACE_AT_EOF_OPTS; do\n+    git diff $opt > out\n+    test_expect_success \"diff $opt must not warn about trailing\nwhitespace (add newline case)\" 'test_cmp expect out'\n+done\n+\n+cat << EOF > expect\n+diff --git a/x b/x\n+index 7668968..95ce259 100644\n+--- a/x\n++++ b/x\n+@@ -1 +1 @@\n+-this file has no newline at end of file\n+\\ No newline at end of file\n++this file does have a newline at the end of file\n+EOF\n+git diff > out\n+test_expect_success 'standard diff must warn about trailing\nwhitespace (add newline case)' 'test_cmp expect out'\n+\n+# newline at eof tests (replacement has no newline)\n+cat << EOF > x\n+this file does have a newline at the end of file\n+EOF\n+\n+git update-index x\n+\n+tr -d \"\\n\" << EOF > x\n+this file has no newline at end of file\n+EOF\n+\n+cat << EOF > expect\n+diff --git a/x b/x\n+index 95ce259..7668968 100644\n+--- a/x\n++++ b/x\n+@@ -1 +1 @@\n+-this file does have a newline at the end of file\n++this file has no newline at end of file\n+EOF\n+for opt in $IGNORE_SPACE_AT_EOF_OPTS; do\n+    git diff $opt > out\n+    test_expect_success \"diff $opt must not warn about trailing\nwhitespace (remove newline case)\" 'test_cmp expect out'\n+done\n+\n+cat << EOF > expect\n+diff --git a/x b/x\n+index 95ce259..7668968 100644\n+--- a/x\n++++ b/x\n+@@ -1 +1 @@\n+-this file does have a newline at the end of file\n++this file has no newline at end of file\n+\\ No newline at end of file\n+EOF\n+git diff > out\n+test_expect_success 'plain diff must warn about trailing whitespace\n(remove newline case)' 'test_cmp expect out'\n+\n+# end newline at eof tests\n+\n tr 'Q' '\\015' << EOF > x\n whitespace at beginning\n whitespace change\ndiff --git a/xdiff/xdiff.h b/xdiff/xdiff.h\nindex 4da052a..00367af 100644\n--- a/xdiff/xdiff.h\n+++ b/xdiff/xdiff.h\n@@ -33,7 +33,14 @@ extern \"C\" {\n #define XDF_IGNORE_WHITESPACE_CHANGE (1 << 3)\n #define XDF_IGNORE_WHITESPACE_AT_EOL (1 << 4)\n #define XDF_PATIENCE_DIFF (1 << 5)\n-#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE |\nXDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL)\n+#define XDF_IGNORE_WHITESPACE_AT_EOF (1 << 6)\n+/*\n+ * note this is deliberately a different define from XDF_WHITESPACE_FLAGS as\n+ * there could be a new whitespace related flag which would not be part of\n+ * the XDF_IGNORE_WHITESPACE_AT_EOF_ANY flags.\n+ */\n+#define XDF_IGNORE_WHITESPACE_AT_EOF_ANY\n(XDF_IGNORE_WHITESPACE_AT_EOL | XDF_IGNORE_WHITESPACE_CHANGE |\nXDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_AT_EOF)\n+#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE |\nXDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL |\nXDF_IGNORE_WHITESPACE_AT_EOF)\n\n #define XDL_PATCH_NORMAL '-'\n #define XDL_PATCH_REVERSE '+'\n@@ -79,6 +86,7 @@ typedef struct s_xpparam {\n typedef struct s_xdemitcb {\n \tvoid *priv;\n \tint (*outf)(void *, mmbuffer_t *, int);\n+\tlong flags; /* whitespace flags */\n } xdemitcb_t;\n\n typedef long (*find_func_t)(const char *line, long line_len, char\n*buffer, long buffer_size, void *priv);\ndiff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c\nindex 3e97462..93dd284 100644\n--- a/xdiff/xdiffi.c\n+++ b/xdiff/xdiffi.c\n@@ -556,6 +556,9 @@ int xdl_diff(mmfile_t *mf1, mmfile_t *mf2,\nxpparam_t const *xpp,\n \t\treturn -1;\n \t}\n \tif (xscr) {\n+\t\t/* copy the whitespace flags over so they can be made available\n+\t\t * to emit api code that only gets ecb */\n+\t\tecb->flags = xpp->flags;\n \t\tif (ef(&xe, xscr, ecb, xecfg) < 0) {\n\n \t\t\txdl_free_script(xscr);\ndiff --git a/xdiff/xutils.c b/xdiff/xutils.c\nindex 04ad468..88591b7 100644\n--- a/xdiff/xutils.c\n+++ b/xdiff/xutils.c\n@@ -52,7 +52,10 @@ int xdl_emit_diffrec(char const *rec, long size,\nchar const *pre, long psize,\n \tmb[1].ptr = (char *) rec;\n \tmb[1].size = size;\n \tif (size > 0 && rec[size - 1] != '\\n') {\n-\t\tmb[2].ptr = (char *) \"\\n\\\\ No newline at end of file\\n\";\n+\t\tif (ecb->flags & XDF_IGNORE_WHITESPACE_AT_EOF_ANY)\n+\t\t\tmb[2].ptr = (char *) \"\\n\";\n+\t\telse\n+\t\t\tmb[2].ptr = (char *) \"\\n\\\\ No newline at end of file\\n\";\n \t\tmb[2].size = strlen(mb[2].ptr);\n \t\ti++;\n \t}\n-- \n1.6.0.3\n"},{"id":"104779","messageId":"alpine.DEB.1.00.0902151554000.10279@pacific.mpi-cbg.de","threadId":"17802","inReplyTo":"9b18b3110902150609q13333619k98f87a4a36a09030@mail.gmail.com","subject":"Re: [PATCH] git diff ignore-space options should ignore missing EOL at EOF differences","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-15T14:55:42Z","receivedAt":"2009-02-15T14:55:42Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 15 Feb 2009, demerphq wrote:\n\n>  t/t4015-diff-whitespace.sh             |   79 ++++++++++++++++++++++++++++++++\n\nPhew, you certainly want to make sure that it works...\n\n> @@ -33,7 +33,14 @@ extern \"C\" {\n>  #define XDF_IGNORE_WHITESPACE_CHANGE (1 << 3)\n>  #define XDF_IGNORE_WHITESPACE_AT_EOL (1 << 4)\n>  #define XDF_PATIENCE_DIFF (1 << 5)\n> -#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE |\n> XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL)\n> +#define XDF_IGNORE_WHITESPACE_AT_EOF (1 << 6)\n> +/*\n> + * note this is deliberately a different define from XDF_WHITESPACE_FLAGS as\n> + * there could be a new whitespace related flag which would not be part of\n> + * the XDF_IGNORE_WHITESPACE_AT_EOF_ANY flags.\n> + */\n> +#define XDF_IGNORE_WHITESPACE_AT_EOF_ANY\n> (XDF_IGNORE_WHITESPACE_AT_EOL | XDF_IGNORE_WHITESPACE_CHANGE |\n> XDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_AT_EOF)\n> +#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE |\n> XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL |\n> XDF_IGNORE_WHITESPACE_AT_EOF)\n\nAs I told you on IRC, I do not follow that reasoning.  Rather, I would add \nthe exceptions to xemit.c, when -- and if(!) -- they are needed.\n\nCiao,\nDscho\n"},{"id":"104781","messageId":"9b18b3110902150713q62a73febs3d76ebf6e0d93c46@mail.gmail.com","threadId":"17802","inReplyTo":"alpine.DEB.1.00.0902151554000.10279@pacific.mpi-cbg.de","subject":"Re: [PATCH] git diff ignore-space options should ignore missing EOL at EOF differences","fromName":"demerphq","fromEmail":"demerphq@gmail.com","sentAt":"2009-02-15T15:13:50Z","receivedAt":"2009-02-15T15:13:50Z","isPatch":true,"sender":{"key":"demerphq@gmail.com","avatar":null},"body":"2009/2/15 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> Hi,\n>\n> On Sun, 15 Feb 2009, demerphq wrote:\n>\n>>  t/t4015-diff-whitespace.sh             |   79 ++++++++++++++++++++++++++++++++\n>\n> Phew, you certainly want to make sure that it works...\n\nYeah, Exhaustive testing is good. (When it doesn't take hours and\nhours to run :-)\n\n>\n>> @@ -33,7 +33,14 @@ extern \"C\" {\n>>  #define XDF_IGNORE_WHITESPACE_CHANGE (1 << 3)\n>>  #define XDF_IGNORE_WHITESPACE_AT_EOL (1 << 4)\n>>  #define XDF_PATIENCE_DIFF (1 << 5)\n>> -#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE |\n>> XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL)\n>> +#define XDF_IGNORE_WHITESPACE_AT_EOF (1 << 6)\n>> +/*\n>> + * note this is deliberately a different define from XDF_WHITESPACE_FLAGS as\n>> + * there could be a new whitespace related flag which would not be part of\n>> + * the XDF_IGNORE_WHITESPACE_AT_EOF_ANY flags.\n>> + */\n>> +#define XDF_IGNORE_WHITESPACE_AT_EOF_ANY\n>> (XDF_IGNORE_WHITESPACE_AT_EOL | XDF_IGNORE_WHITESPACE_CHANGE |\n>> XDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_AT_EOF)\n>> +#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE |\n>> XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL |\n>> XDF_IGNORE_WHITESPACE_AT_EOF)\n>\n> As I told you on IRC, I do not follow that reasoning.  Rather, I would add\n> the exceptions to xemit.c, when -- and if(!) -- they are needed.\n\nYeah I know you said that, and I *think* I followed all your advice\n(much appreciated by the way) except for that point as I've been\nnailed by inappropriate addition of flags to masks before, and well,\nyou know, once bitten twice shy, and patchers perogative and all that\neh? :-)\n\nFor instance what happens if someone adds XDF_IGNORE_WHITESPACE_AT_SOL\n(start of line) or XDF_IGNORE_SPACES_WHERE_TABS_EXPECTED in the\nfuture, and then adds it to XDF_IGNORE_WHITESPACE_FLAGS? And\npersonally such options seem quite reasonable to me. It just happens\nto be coincidence that all of the currently existing flags also impact\nthis particular behaviour, IMO it wouldnt have been so strange to find\none that didn't.\n\nAnd thanks again for your handholding on this patch. I hope the\npasting of it inline was correct. I'm not sure where I should have\nsaid that it was a patch against the master branch without it also\nappearing in the commit body. Should I haved attached the format-patch\nfile as well?\n\nAlso, on a related note I personally would have reorganized the flags\nso that the ones relating to whitespace control are in a different bit\nrange than the ones that have to do with other things. The precedent\nin the file appeared to not follow this approach as the patience flag\nwas \"at the end\", so i didnt modify this, and just stuck the new flag\nalso at the end. I think it would be better to do a lowbit moving up\nand highbit moving down approach or something like that as otherwise\nwhen new flags get added over time the different types of flags are\ninterspersed and it becomes a real mess to maintain and understand. In\nfact, I dont really \"get\" the whitespace flags as currently\nimplemented. Why does \"ignore all whitespace\" get its own bit?\nShouldn't it just be a mask of all the other whitespace bits?\n\ncheers,\nYves\n\n\n-- \nperl -Mre=debug -e \"/just|another|perl|hacker/\"\n"},{"id":"104782","messageId":"alpine.DEB.1.00.0902151615400.10279@pacific.mpi-cbg.de","threadId":"17802","inReplyTo":"9b18b3110902150713q62a73febs3d76ebf6e0d93c46@mail.gmail.com","subject":"Re: [PATCH] git diff ignore-space options should ignore missing EOL at EOF differences","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-15T15:17:49Z","receivedAt":"2009-02-15T15:17:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 15 Feb 2009, demerphq wrote:\n\n> 2009/2/15 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> > Hi,\n> >\n> > On Sun, 15 Feb 2009, demerphq wrote:\n> >\n> >>  t/t4015-diff-whitespace.sh             |   79 ++++++++++++++++++++++++++++++++\n> >\n> > Phew, you certainly want to make sure that it works...\n> \n> Yeah, Exhaustive testing is good. (When it doesn't take hours and\n> hours to run :-)\n\nYou read my mind.\n\n> >> @@ -33,7 +33,14 @@ extern \"C\" {\n> >>  #define XDF_IGNORE_WHITESPACE_CHANGE (1 << 3)\n> >>  #define XDF_IGNORE_WHITESPACE_AT_EOL (1 << 4)\n> >>  #define XDF_PATIENCE_DIFF (1 << 5)\n> >> -#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE |\n> >> XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL)\n> >> +#define XDF_IGNORE_WHITESPACE_AT_EOF (1 << 6)\n> >> +/*\n> >> + * note this is deliberately a different define from XDF_WHITESPACE_FLAGS as\n> >> + * there could be a new whitespace related flag which would not be part of\n> >> + * the XDF_IGNORE_WHITESPACE_AT_EOF_ANY flags.\n> >> + */\n> >> +#define XDF_IGNORE_WHITESPACE_AT_EOF_ANY\n> >> (XDF_IGNORE_WHITESPACE_AT_EOL | XDF_IGNORE_WHITESPACE_CHANGE |\n> >> XDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_AT_EOF)\n> >> +#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE |\n> >> XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL |\n> >> XDF_IGNORE_WHITESPACE_AT_EOF)\n> >\n> > As I told you on IRC, I do not follow that reasoning.  Rather, I would add\n> > the exceptions to xemit.c, when -- and if(!) -- they are needed.\n> \n> Yeah I know you said that, and I *think* I followed all your advice\n> (much appreciated by the way) except for that point as I've been\n> nailed by inappropriate addition of flags to masks before, and well,\n> you know, once bitten twice shy, and patchers perogative and all that\n> eh? :-)\n\nI understand that, but IMHO it is overengineered.  I am not really \nconvinced that ignore-whitespace-at-sol makes sense, either...\n\nCiao,\nDscho\n"},{"id":"106109","messageId":"9b18b3110902241343v11bf015ftad5c90259007a243@mail.gmail.com","threadId":"17802","inReplyTo":"alpine.DEB.1.00.0902151615400.10279@pacific.mpi-cbg.de","subject":"Re: [PATCH] git diff ignore-space options should ignore missing EOL at EOF differences","fromName":"demerphq","fromEmail":"demerphq@gmail.com","sentAt":"2009-02-24T21:43:37Z","receivedAt":"2009-02-24T21:43:37Z","isPatch":true,"sender":{"key":"demerphq@gmail.com","avatar":null},"body":"2009/2/15 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> Hi,\n>\n> On Sun, 15 Feb 2009, demerphq wrote:\n>\n>> 2009/2/15 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n>> > Hi,\n>> >\n>> > On Sun, 15 Feb 2009, demerphq wrote:\n>> >\n>> >>  t/t4015-diff-whitespace.sh             |   79 ++++++++++++++++++++++++++++++++\n>> >\n>> > Phew, you certainly want to make sure that it works...\n>>\n>> Yeah, Exhaustive testing is good. (When it doesn't take hours and\n>> hours to run :-)\n>\n> You read my mind.\n>\n>> >> @@ -33,7 +33,14 @@ extern \"C\" {\n>> >>  #define XDF_IGNORE_WHITESPACE_CHANGE (1 << 3)\n>> >>  #define XDF_IGNORE_WHITESPACE_AT_EOL (1 << 4)\n>> >>  #define XDF_PATIENCE_DIFF (1 << 5)\n>> >> -#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE |\n>> >> XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL)\n>> >> +#define XDF_IGNORE_WHITESPACE_AT_EOF (1 << 6)\n>> >> +/*\n>> >> + * note this is deliberately a different define from XDF_WHITESPACE_FLAGS as\n>> >> + * there could be a new whitespace related flag which would not be part of\n>> >> + * the XDF_IGNORE_WHITESPACE_AT_EOF_ANY flags.\n>> >> + */\n>> >> +#define XDF_IGNORE_WHITESPACE_AT_EOF_ANY\n>> >> (XDF_IGNORE_WHITESPACE_AT_EOL | XDF_IGNORE_WHITESPACE_CHANGE |\n>> >> XDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_AT_EOF)\n>> >> +#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE |\n>> >> XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL |\n>> >> XDF_IGNORE_WHITESPACE_AT_EOF)\n>> >\n>> > As I told you on IRC, I do not follow that reasoning.  Rather, I would add\n>> > the exceptions to xemit.c, when -- and if(!) -- they are needed.\n>>\n>> Yeah I know you said that, and I *think* I followed all your advice\n>> (much appreciated by the way) except for that point as I've been\n>> nailed by inappropriate addition of flags to masks before, and well,\n>> you know, once bitten twice shy, and patchers perogative and all that\n>> eh? :-)\n>\n> I understand that, but IMHO it is overengineered.  I am not really\n> convinced that ignore-whitespace-at-sol makes sense, either...\n\nWell, if there is a consensus that it is overengineered to add a new\ndefine that will prevent hard to detect future bugs, then ill change\nthe code. Although id feel more comfortable with hearing this from\nJunio himself. But before I put together a new patch is there any\nother feedback?\n\nYves\n\n-- \nperl -Mre=debug -e \"/just|another|perl|hacker/\"\n"},{"id":"106185","messageId":"7v8wnu7tbp.fsf@gitster.siamese.dyndns.org","threadId":"17802","inReplyTo":"9b18b3110902150609q13333619k98f87a4a36a09030@mail.gmail.com","subject":"Re: [PATCH] git diff ignore-space options should ignore missing EOL at EOF differences","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-25T09:35:06Z","receivedAt":"2009-02-25T09:35:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"demerphq <demerphq@gmail.com> writes:\n\n> Fix bug where the diff library complains about missing EOL at EOF\n> mismatches even when run under the various ignore whitespace options.\n\nHmm.  Perhaps I am not reading the problem description correctly, but this\nis not certainly you are talking about, right?\n\n    $ printf \"abcde \" >one\n    $ git add one\n    $ printf \"abcde  \" >one\n    $ git diff -w one\n    diff --git a/one b/one\n    index c1401e2..9f6f8e6 100644\n    $ echo \"abcde  \" >one\n    $ git diff -w one\n    index c1401e2..21ee909 100644\n    $ exit\n\n\n\n    \n"}]}