{"thread":{"id":"6018","subject":"[PATCH] xdiff/xemit.c (xdl_find_func): Elide trailing white space in a context header.","startedAt":"2006-10-23T20:22:25Z","lastAt":"2006-10-23T21:15:27Z","messageCount":6,"participants":["Jim Meyering","Linus Torvalds","Petr Baudis","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"29756","messageId":"87y7r63hq6.fsf@rho.meyering.net","threadId":"6018","inReplyTo":null,"subject":"[PATCH] xdiff/xemit.c (xdl_find_func): Elide trailing white space in a context header.","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2006-10-23T20:22:25Z","receivedAt":"2006-10-23T20:22:25Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"This removes trailing blanks from git-generated diff headers\nthe same way a similar patch did that for GNU diff:\n\n  http://article.gmane.org/gmane.comp.gnu.utils.bugs/13839\n\nSigned-off-by: Jim Meyering <jim@meyering.net>\n---\n xdiff/xemit.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/xdiff/xemit.c b/xdiff/xemit.c\nindex 714c563..1bca639 100644\n--- a/xdiff/xemit.c\n+++ b/xdiff/xemit.c\n@@ -92,6 +92,8 @@ static void xdl_find_func(xdfile_t *xf,\n \t\t\t\tlen = sz;\n \t\t\tif (len && rec[len - 1] == '\\n')\n \t\t\t\tlen--;\n+\t\t\twhile (0 < len && isspace ((unsigned char) rec[len - 1]))\n+\t\t\t\tlen--;\n \t\t\tmemcpy(buf, rec, len);\n \t\t\t*ll = len;\n \t\t\treturn;\n--\n1.4.3.1.g178e-dirty\n"},{"id":"29760","messageId":"Pine.LNX.4.64.0610231347490.3962@g5.osdl.org","threadId":"6018","inReplyTo":"87y7r63hq6.fsf@rho.meyering.net","subject":"Re: [PATCH] xdiff/xemit.c (xdl_find_func): Elide trailing white space in a context header.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-10-23T20:49:37Z","receivedAt":"2006-10-23T20:49:37Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 23 Oct 2006, Jim Meyering wrote:\n>\n> This removes trailing blanks from git-generated diff headers\n> the same way a similar patch did that for GNU diff:\n\nNO!\n\nThis is _wrong_\n\nYou should only remove the space IF IT IS THE ONLY THING ON THE WHOLE \nLINE!\n\nYou must not remove white-space in general.\n\nSo the patch should check something like\n\n\tif (len == 1 && rec[0] == ' ')\n\t\tlen = 0;\n\nand not like you did it.\n\nOtherwise the patch will simply not even _apply_.\n\n\t\tLinus\n"},{"id":"29763","messageId":"20061023210327.GT20017@pasky.or.cz","threadId":"6018","inReplyTo":"Pine.LNX.4.64.0610231347490.3962@g5.osdl.org","subject":"Re: [PATCH] xdiff/xemit.c (xdl_find_func): Elide trailing white space in a context header.","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-10-23T21:03:28Z","receivedAt":"2006-10-23T21:03:28Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Mon, Oct 23, 2006 at 10:49:37PM CEST, I got a letter\nwhere Linus Torvalds <torvalds@osdl.org> said that...\n> \n> \n> On Mon, 23 Oct 2006, Jim Meyering wrote:\n> >\n> > This removes trailing blanks from git-generated diff headers\n> > the same way a similar patch did that for GNU diff:\n> \n> NO!\n> \n> This is _wrong_\n> \n> You should only remove the space IF IT IS THE ONLY THING ON THE WHOLE \n> LINE!\n> \n> You must not remove white-space in general.\n> \n> So the patch should check something like\n> \n> \tif (len == 1 && rec[0] == ' ')\n> \t\tlen = 0;\n> \n> and not like you did it.\n> \n> Otherwise the patch will simply not even _apply_.\n\nNot really - mind you, this is only about the diff headers. Actually, it\nis only about the hunk headers, specifically when we append the function\nname to the hunk header. A trailing whitespace can come out of that even\nif the source does not have any trailing whitespaces since we trim the\nline at 40 bytes.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"},{"id":"29766","messageId":"ehjari$vda$1@sea.gmane.org","threadId":"6018","inReplyTo":"Pine.LNX.4.64.0610231347490.3962@g5.osdl.org","subject":"Re: [PATCH] xdiff/xemit.c (xdl_find_func): Elide trailing white space in a context header.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-23T21:06:20Z","receivedAt":"2006-10-23T21:06:20Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Linus Torvalds wrote:\n\n> On Mon, 23 Oct 2006, Jim Meyering wrote:\n>>\n>> This removes trailing blanks from git-generated diff headers\n>> the same way a similar patch did that for GNU diff:\n> \n> NO!\n> \n> This is _wrong_\n> \n> You should only remove the space IF IT IS THE ONLY THING ON THE WHOLE \n> LINE!\n\nIf I understand the description of this patch given by the mentioned article\nand example therein (Jim, you should include appropriate parts of mentioned\nemail in commit message, not just provide link to it), trailing spaces are\nremoved from extended diff header, i.e. the \"which function are we in\",\ndiff -p header. Not from diff body.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"29767","messageId":"Pine.LNX.4.64.0610231409430.3962@g5.osdl.org","threadId":"6018","inReplyTo":"20061023210327.GT20017@pasky.or.cz","subject":"Re: [PATCH] xdiff/xemit.c (xdl_find_func): Elide trailing white space in a context header.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-10-23T21:10:50Z","receivedAt":"2006-10-23T21:10:50Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 23 Oct 2006, Petr Baudis wrote:\n> \n> Not really - mind you, this is only about the diff headers. Actually, it\n> is only about the hunk headers, specifically when we append the function\n> name to the hunk header.\n\nAhh. I totally misunderstood, looking at just the diff, and not the bigger \ncontext of it.\n\nRemoving whitespace from the \"comment\" in the hunk header is obviously \nfine.\n\nSorry for the noise.\n\n\t\tLinus\n"},{"id":"29768","messageId":"ehjbcl$vda$2@sea.gmane.org","threadId":"6018","inReplyTo":"Pine.LNX.4.64.0610231409430.3962@g5.osdl.org","subject":"Re: [PATCH] xdiff/xemit.c (xdl_find_func): Elide trailing white space in a context header.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-23T21:15:27Z","receivedAt":"2006-10-23T21:15:27Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Linus Torvalds wrote:\n\n> On Mon, 23 Oct 2006, Petr Baudis wrote:\n>> \n>> Not really - mind you, this is only about the diff headers. Actually, it\n>> is only about the hunk headers, specifically when we append the function\n>> name to the hunk header.\n> \n> Ahh. I totally misunderstood, looking at just the diff, and not the bigger \n> context of it.\n> \n> Removing whitespace from the \"comment\" in the hunk header is obviously \n> fine.\n> \n> Sorry for the noise.\n\nWell, this points out that commit message was not clear enough.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}