git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xdiff: Do not consider lines starting by # hunkworthy
@ 2006-10-25  0:07 Petr Baudis
  2006-10-25  0:16 ` Junio C Hamano
  2006-10-25  0:17 ` [PATCH] xdiff: Do not consider lines starting by # hunkworthy Jakub Narebski
  0 siblings, 2 replies; 6+ messages in thread
From: Petr Baudis @ 2006-10-25  0:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This will be probably controversial but in my personal experience, the
amount of time this is the right thing to do because of #defines is negligible
compared to amount of time it is wrong, especially because of #ifs and #endifs
in the middle of functions and also because of comments at the line start when
it concerns non-C files.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 xdiff/xemit.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/xdiff/xemit.c b/xdiff/xemit.c
index 714c563..4f20075 100644
--- a/xdiff/xemit.c
+++ b/xdiff/xemit.c
@@ -86,8 +86,7 @@ static void xdl_find_func(xdfile_t *xf, 
 		if (len > 0 &&
 		    (isalpha((unsigned char)*rec) || /* identifier? */
 		     *rec == '_' ||	/* also identifier? */
-		     *rec == '(' ||	/* lisp defun? */
-		     *rec == '#')) {	/* #define? */
+		     *rec == '(')) {	/* #define? */
 			if (len > sz)
 				len = sz;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] xdiff: Do not consider lines starting by # hunkworthy
  2006-10-25  0:07 [PATCH] xdiff: Do not consider lines starting by # hunkworthy Petr Baudis
@ 2006-10-25  0:16 ` Junio C Hamano
  2006-10-25  0:28   ` [PATCH] xdiff: Match GNU diff behaviour when deciding hunk comment worthiness of lines Petr Baudis
  2006-10-25  0:17 ` [PATCH] xdiff: Do not consider lines starting by # hunkworthy Jakub Narebski
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2006-10-25  0:16 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> writes:

> This will be probably controversial but in my personal experience, the
> amount of time this is the right thing to do because of #defines is negligible
> compared to amount of time it is wrong, especially because of #ifs and #endifs
> in the middle of functions and also because of comments at the line start when
> it concerns non-C files.
>
> Signed-off-by: Petr Baudis <pasky@suse.cz>
> ---
>
>  xdiff/xemit.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/xdiff/xemit.c b/xdiff/xemit.c
> index 714c563..4f20075 100644
> --- a/xdiff/xemit.c
> +++ b/xdiff/xemit.c
> @@ -86,8 +86,7 @@ static void xdl_find_func(xdfile_t *xf, 
>  		if (len > 0 &&
>  		    (isalpha((unsigned char)*rec) || /* identifier? */
>  		     *rec == '_' ||	/* also identifier? */
> -		     *rec == '(' ||	/* lisp defun? */
> -		     *rec == '#')) {	/* #define? */
> +		     *rec == '(')) {	/* #define? */
>  			if (len > sz)
>  				len = sz;
>  			if (len && rec[len - 1] == '\n')

I'd either omit the opening parenthesis or fix the comment ;-).

More seriously, I'd rather just match default GNU diff behaviour
to use isalpha, underscore or '$'.  I do not particularly like
to have '$' but I feel it is the easiest to match a prior art in
cases like this because I do not have to defend my position when
somebody says "Why do you include '#'???  It makes no sense!".
Since I do not care too much about it, being able to just say
"Well we match what GNU diff does by default." is a good thing.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xdiff: Do not consider lines starting by # hunkworthy
  2006-10-25  0:07 [PATCH] xdiff: Do not consider lines starting by # hunkworthy Petr Baudis
  2006-10-25  0:16 ` Junio C Hamano
@ 2006-10-25  0:17 ` Jakub Narebski
  1 sibling, 0 replies; 6+ messages in thread
From: Jakub Narebski @ 2006-10-25  0:17 UTC (permalink / raw)
  To: git

Petr Baudis wrote:

> -                    *rec == '(' ||     /* lisp defun? */
> -                    *rec == '#')) {    /* #define? */
> +                    *rec == '(')) {    /* #define? */
>                         if (len > sz)

Shouldn't it be:

+                    *rec == '(')) {    /* lisp defun? */
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] xdiff: Match GNU diff behaviour when deciding hunk comment worthiness of lines
  2006-10-25  0:16 ` Junio C Hamano
@ 2006-10-25  0:28   ` Petr Baudis
  2006-10-25  1:33     ` Horst H. von Brand
  0 siblings, 1 reply; 6+ messages in thread
From: Petr Baudis @ 2006-10-25  0:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This removes the '#' and '(' tests and adds a '$' test instead although I have
no idea what it is actually good for - but hey, if that's what GNU diff does...

Pasky only went and did as Junio sayeth.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 xdiff/xemit.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/xdiff/xemit.c b/xdiff/xemit.c
index 714c563..4139d55 100644
--- a/xdiff/xemit.c
+++ b/xdiff/xemit.c
@@ -86,8 +86,7 @@ static void xdl_find_func(xdfile_t *xf, 
 		if (len > 0 &&
 		    (isalpha((unsigned char)*rec) || /* identifier? */
 		     *rec == '_' ||	/* also identifier? */
-		     *rec == '(' ||	/* lisp defun? */
-		     *rec == '#')) {	/* #define? */
+		     *rec == '$')) {	/* mysterious GNU diff's invention */
 			if (len > sz)
 				len = sz;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] xdiff: Match GNU diff behaviour when deciding hunk comment worthiness of lines
  2006-10-25  0:28   ` [PATCH] xdiff: Match GNU diff behaviour when deciding hunk comment worthiness of lines Petr Baudis
@ 2006-10-25  1:33     ` Horst H. von Brand
  2006-10-25  2:18       ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Horst H. von Brand @ 2006-10-25  1:33 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Junio C Hamano, git

Petr Baudis <pasky@suse.cz> wrote:
> This removes the '#' and '(' tests and adds a '$' test instead although I
> have no idea what it is actually good for - but hey, if that's what GNU
> diff does...

$ starts a shell (or Perl) variable...

> Pasky only went and did as Junio sayeth.

Horst adds a guesse...
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xdiff: Match GNU diff behaviour when deciding hunk comment worthiness of lines
  2006-10-25  1:33     ` Horst H. von Brand
@ 2006-10-25  2:18       ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2006-10-25  2:18 UTC (permalink / raw)
  To: Horst H. von Brand; +Cc: Petr Baudis, git

"Horst H. von Brand" <vonbrand@inf.utfsm.cl> writes:

> Petr Baudis <pasky@suse.cz> wrote:
>> This removes the '#' and '(' tests and adds a '$' test instead although I
>> have no idea what it is actually good for - but hey, if that's what GNU
>> diff does...
>
> $ starts a shell (or Perl) variable...
>
>> Pasky only went and did as Junio sayeth.
>
> Horst adds a guesse...

If I have to guess, I think that is from VMS.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-25  2:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-25  0:07 [PATCH] xdiff: Do not consider lines starting by # hunkworthy Petr Baudis
2006-10-25  0:16 ` Junio C Hamano
2006-10-25  0:28   ` [PATCH] xdiff: Match GNU diff behaviour when deciding hunk comment worthiness of lines Petr Baudis
2006-10-25  1:33     ` Horst H. von Brand
2006-10-25  2:18       ` Junio C Hamano
2006-10-25  0:17 ` [PATCH] xdiff: Do not consider lines starting by # hunkworthy Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).