All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Ian Hilt <Ian.Hilt@gmx.com>
Cc: Christian Holtje <docwhat@gmail.com>,
	git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH] pre-commit hook should ignore carriage returns at EOL
Date: Tue, 24 Jun 2008 22:09:06 +0200	[thread overview]
Message-ID: <200806242209.07135.jnareb@gmail.com> (raw)
In-Reply-To: <alpine.LFD.1.10.0806241548140.32759@sys-0.hiltweb.site>

On Tue, 24 Jun 2008, Ian Hilt wrote:
> On Tue, 24 Jun 2008 at 12:05pm -0700, Jakub Narebski wrote:
> 
> > I don't think so, because you want next to test for whitespace
> > where it _doesn't_ end in \r, i.e. this condition is here
> > because of the 'else' clause.  IIRC.
> 
> What I'm suggesting is this,
> 
> 	if (/\s\r$/) {
> 		bad_line("trailing whitespace", $_);
> 	} else {
> 		if (/\s$/) {
> 			bad_line("trailing whitespace", $_);
> 		}
> 	}
> 
> Why only test for \r when all you want to know is whether there is
> whitespace before \r ?  If there isn't whitespace and \r at the end
> of a line, then only test for whitespace at the end of a line.

Unfortunately \r matches \s (is whitespace), so if line ends with CR LF
("\r\n") it wouldn't match first regexp, so it would go to 'else' 
clause, where it would match /\s$/ and it shouldn't.

-- 
Jakub Narebski
Poland

  reply	other threads:[~2008-06-24 20:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-24 16:23 [PATCH] pre-commit hook should ignore carriage returns at EOL Christian Holtje
2008-06-24 18:22 ` Alf Clement
2008-06-24 18:26 ` Ian Hilt
2008-06-24 19:05   ` Jakub Narebski
2008-06-24 19:54     ` Ian Hilt
2008-06-24 20:09       ` Jakub Narebski [this message]
2008-06-24 20:36         ` Ian Hilt
2008-06-24 19:16   ` Christian Holtje
2008-06-24 22:31     ` Junio C Hamano
2008-06-24 23:25       ` Christian Holtje
2008-06-24 23:34         ` Jakub Narebski
2008-06-24 23:39           ` Junio C Hamano
2008-06-25  0:19             ` Christian Holtje
2008-06-24 23:59         ` Junio C Hamano
2008-06-25  2:09           ` [PATCH] Ship sample hooks with .sample suffix Junio C Hamano
2008-06-25  2:48             ` Junio C Hamano
2008-06-25  6:51               ` Johannes Sixt
2008-06-25  8:09                 ` Junio C Hamano
2008-06-26  7:19               ` Johannes Sixt
2008-06-26  7:28                 ` Junio C Hamano
2008-06-25  5:18             ` Peter Baumann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200806242209.07135.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=Ian.Hilt@gmx.com \
    --cc=docwhat@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.