{"thread":{"id":"43348","subject":"Re: [PATCH] xdiff: Do not consider lines starting by # hunkworthy","startedAt":"2006-10-25T00:07:08Z","lastAt":"2006-10-25T00:28:55Z","messageCount":4,"participants":["Junio C Hamano","Petr Baudis","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"295556","messageId":"20061025000708.2753.74523.stgit@machine.or.cz","threadId":"43348","inReplyTo":null,"subject":"[PATCH] xdiff: Do not consider lines starting by # hunkworthy","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-10-25T00:07:08Z","receivedAt":"2006-10-25T00:07:08Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This will be probably controversial but in my personal experience, the\namount of time this is the right thing to do because of #defines is negligible\ncompared to amount of time it is wrong, especially because of #ifs and #endifs\nin the middle of functions and also because of comments at the line start when\nit concerns non-C files.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n xdiff/xemit.c |    3 +--\n 1 files changed, 1 insertions(+), 2 deletions(-)\n\ndiff --git a/xdiff/xemit.c b/xdiff/xemit.c\nindex 714c563..4f20075 100644\n--- a/xdiff/xemit.c\n+++ b/xdiff/xemit.c\n@@ -86,8 +86,7 @@ static void xdl_find_func(xdfile_t *xf, \n \t\tif (len > 0 &&\n \t\t    (isalpha((unsigned char)*rec) || /* identifier? */\n \t\t     *rec == '_' ||\t/* also identifier? */\n-\t\t     *rec == '(' ||\t/* lisp defun? */\n-\t\t     *rec == '#')) {\t/* #define? */\n+\t\t     *rec == '(')) {\t/* #define? */\n \t\t\tif (len > sz)\n \t\t\t\tlen = sz;\n"},{"id":"294435","messageId":"7vmz7lfdwj.fsf@assigned-by-dhcp.cox.net","threadId":"43348","inReplyTo":"20061025000708.2753.74523.stgit@machine.or.cz","subject":"Re: [PATCH] xdiff: Do not consider lines starting by # hunkworthy","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-25T00:16:28Z","receivedAt":"2006-10-25T00:16:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> This will be probably controversial but in my personal experience, the\n> amount of time this is the right thing to do because of #defines is negligible\n> compared to amount of time it is wrong, especially because of #ifs and #endifs\n> in the middle of functions and also because of comments at the line start when\n> it concerns non-C files.\n>\n> Signed-off-by: Petr Baudis <pasky@suse.cz>\n> ---\n>\n>  xdiff/xemit.c |    3 +--\n>  1 files changed, 1 insertions(+), 2 deletions(-)\n>\n> diff --git a/xdiff/xemit.c b/xdiff/xemit.c\n> index 714c563..4f20075 100644\n> --- a/xdiff/xemit.c\n> +++ b/xdiff/xemit.c\n> @@ -86,8 +86,7 @@ static void xdl_find_func(xdfile_t *xf, \n>  \t\tif (len > 0 &&\n>  \t\t    (isalpha((unsigned char)*rec) || /* identifier? */\n>  \t\t     *rec == '_' ||\t/* also identifier? */\n> -\t\t     *rec == '(' ||\t/* lisp defun? */\n> -\t\t     *rec == '#')) {\t/* #define? */\n> +\t\t     *rec == '(')) {\t/* #define? */\n>  \t\t\tif (len > sz)\n>  \t\t\t\tlen = sz;\n>  \t\t\tif (len && rec[len - 1] == '\\n')\n\nI'd either omit the opening parenthesis or fix the comment ;-).\n\nMore seriously, I'd rather just match default GNU diff behaviour\nto use isalpha, underscore or '$'.  I do not particularly like\nto have '$' but I feel it is the easiest to match a prior art in\ncases like this because I do not have to defend my position when\nsomebody says \"Why do you include '#'???  It makes no sense!\".\nSince I do not care too much about it, being able to just say\n\"Well we match what GNU diff does by default.\" is a good thing.\n\n\n\n"},{"id":"298460","messageId":"ehmadg$rkj$1@sea.gmane.org","threadId":"43348","inReplyTo":"20061025000708.2753.74523.stgit@machine.or.cz","subject":"Re: [PATCH] xdiff: Do not consider lines starting by # hunkworthy","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-25T00:17:20Z","receivedAt":"2006-10-25T00:17:20Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Petr Baudis wrote:\n\n> -                    *rec == '(' ||     /* lisp defun? */\n> -                    *rec == '#')) {    /* #define? */\n> +                    *rec == '(')) {    /* #define? */\n>                         if (len > sz)\n\nShouldn't it be:\n\n+                    *rec == '(')) {    /* lisp defun? */\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"297246","messageId":"20061025002855.4738.1088.stgit@machine.or.cz","threadId":"43348","inReplyTo":"7vmz7lfdwj.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] xdiff: Match GNU diff behaviour when deciding hunk comment worthiness of lines","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-10-25T00:28:55Z","receivedAt":"2006-10-25T00:28:55Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This removes the '#' and '(' tests and adds a '$' test instead although I have\nno idea what it is actually good for - but hey, if that's what GNU diff does...\n\nPasky only went and did as Junio sayeth.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n xdiff/xemit.c |    3 +--\n 1 files changed, 1 insertions(+), 2 deletions(-)\n\ndiff --git a/xdiff/xemit.c b/xdiff/xemit.c\nindex 714c563..4139d55 100644\n--- a/xdiff/xemit.c\n+++ b/xdiff/xemit.c\n@@ -86,8 +86,7 @@ static void xdl_find_func(xdfile_t *xf, \n \t\tif (len > 0 &&\n \t\t    (isalpha((unsigned char)*rec) || /* identifier? */\n \t\t     *rec == '_' ||\t/* also identifier? */\n-\t\t     *rec == '(' ||\t/* lisp defun? */\n-\t\t     *rec == '#')) {\t/* #define? */\n+\t\t     *rec == '$')) {\t/* mysterious GNU diff's invention */\n \t\t\tif (len > sz)\n \t\t\t\tlen = sz;\n"}]}