git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* white spaces in a patch
@ 2008-12-17  7:31 Mark Ryden
  2008-12-17  7:34 ` Junio C Hamano
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Ryden @ 2008-12-17  7:31 UTC (permalink / raw)
  To: git

Hello,

It occurred to me that I prepared some patch for a git tree, and
then when testing git-apply on it (on the original tree) I saw
some "white spaces" errors.
I know that I can run:
"git --whitespace=fix apply" on my patch and than create the patch
again ; in this way it will be created without white spaces.

Suppose I create a patch file (let's say : patch.txt)
1) Is there a way to check whether there are white spaces in this
file without running git-apply?
2) Is there a way to get some messages about that there are white spaces
when creating a git patch?

Regards,
Mark

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

* Re: white spaces in a patch
  2008-12-17  7:31 white spaces in a patch Mark Ryden
@ 2008-12-17  7:34 ` Junio C Hamano
  2008-12-17 11:44   ` Mark Ryden
  2008-12-17 12:08   ` Johannes Schindelin
  0 siblings, 2 replies; 12+ messages in thread
From: Junio C Hamano @ 2008-12-17  7:34 UTC (permalink / raw)
  To: Mark Ryden; +Cc: git

"Mark Ryden" <markryde@gmail.com> writes:

> 1) Is there a way to check whether there are white spaces in this
> file without running git-apply?

"sed -n -e '/^+.*[ 	]$/p' patch.txt" perhaps?

> 2) Is there a way to get some messages about that there are white spaces
> when creating a git patch?

Doesn't "git diff" highlight whitespace errors?  That way, you can catch
errors  before you make a commit that has them.

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

* Re: white spaces in a patch
  2008-12-17  7:34 ` Junio C Hamano
@ 2008-12-17 11:44   ` Mark Ryden
  2008-12-17 12:13     ` Sverre Rabbelier
  2008-12-17 12:08   ` Johannes Schindelin
  1 sibling, 1 reply; 12+ messages in thread
From: Mark Ryden @ 2008-12-17 11:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hello,

I tried:
git apply patch1.txt
patch1.txt:34: trailing whitespace.
				
patch1.txt:53: trailing whitespace.

And
"git diff"  show differences but **does not**
highlight anything.
I tried in tchs and in Bash.

Any ideas ? does "git diff" does  highlight for anyone ?

Rgs,
Mark


On Wed, Dec 17, 2008 at 9:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
> "Mark Ryden" <markryde@gmail.com> writes:
>
>> 1) Is there a way to check whether there are white spaces in this
>> file without running git-apply?
>
> "sed -n -e '/^+.*[      ]$/p' patch.txt" perhaps?
>
>> 2) Is there a way to get some messages about that there are white spaces
>> when creating a git patch?
>
> Doesn't "git diff" highlight whitespace errors?  That way, you can catch
> errors  before you make a commit that has them.
>

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

* Re: white spaces in a patch
  2008-12-17  7:34 ` Junio C Hamano
  2008-12-17 11:44   ` Mark Ryden
@ 2008-12-17 12:08   ` Johannes Schindelin
  2008-12-17 12:10     ` Mark Ryden
  1 sibling, 1 reply; 12+ messages in thread
From: Johannes Schindelin @ 2008-12-17 12:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Mark Ryden, git

Hi,

On Tue, 16 Dec 2008, Junio C Hamano wrote:

> "Mark Ryden" <markryde@gmail.com> writes:
> 
> > 2) Is there a way to get some messages about that there are white 
> >    spaces when creating a git patch?
> 
> Doesn't "git diff" highlight whitespace errors?  That way, you can catch 
> errors before you make a commit that has them.

Not to mention "git diff --check", which should catch them, too.

Ciao,
Dscho

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

* Re: white spaces in a patch
  2008-12-17 12:08   ` Johannes Schindelin
@ 2008-12-17 12:10     ` Mark Ryden
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Ryden @ 2008-12-17 12:10 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git

Hello,
Thanks!

"git diff --check" indeed tells about trailing whitespace
Mark

On Wed, Dec 17, 2008 at 2:08 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Tue, 16 Dec 2008, Junio C Hamano wrote:
>
>> "Mark Ryden" <markryde@gmail.com> writes:
>>
>> > 2) Is there a way to get some messages about that there are white
>> >    spaces when creating a git patch?
>>
>> Doesn't "git diff" highlight whitespace errors?  That way, you can catch
>> errors before you make a commit that has them.
>
> Not to mention "git diff --check", which should catch them, too.
>
> Ciao,
> Dscho
>
>

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

* Re: white spaces in a patch
  2008-12-17 11:44   ` Mark Ryden
@ 2008-12-17 12:13     ` Sverre Rabbelier
  2008-12-17 12:13       ` Mark Ryden
  0 siblings, 1 reply; 12+ messages in thread
From: Sverre Rabbelier @ 2008-12-17 12:13 UTC (permalink / raw)
  To: Mark Ryden; +Cc: Junio C Hamano, git

On Wed, Dec 17, 2008 at 12:44, Mark Ryden <markryde@gmail.com> wrote:
> Any ideas ? does "git diff" does  highlight for anyone ?

Do you have color on?

-- 
Cheers,

Sverre Rabbelier

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

* Re: white spaces in a patch
  2008-12-17 12:13     ` Sverre Rabbelier
@ 2008-12-17 12:13       ` Mark Ryden
  2008-12-17 12:15         ` Thomas Jarosch
  2008-12-17 12:16         ` Sverre Rabbelier
  0 siblings, 2 replies; 12+ messages in thread
From: Mark Ryden @ 2008-12-17 12:13 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Junio C Hamano, git

What do you mean ?
where ? how ?
Mark

On Wed, Dec 17, 2008 at 2:13 PM, Sverre Rabbelier <srabbelier@gmail.com> wrote:
> On Wed, Dec 17, 2008 at 12:44, Mark Ryden <markryde@gmail.com> wrote:
>> Any ideas ? does "git diff" does  highlight for anyone ?
>
> Do you have color on?
>
> --
> Cheers,
>
> Sverre Rabbelier
>

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

* Re: white spaces in a patch
  2008-12-17 12:13       ` Mark Ryden
@ 2008-12-17 12:15         ` Thomas Jarosch
  2008-12-17 12:22           ` Mark Ryden
  2008-12-17 12:22           ` Jeff King
  2008-12-17 12:16         ` Sverre Rabbelier
  1 sibling, 2 replies; 12+ messages in thread
From: Thomas Jarosch @ 2008-12-17 12:15 UTC (permalink / raw)
  To: Mark Ryden; +Cc: Sverre Rabbelier, Junio C Hamano, git

On Wednesday, 17. December 2008 13:13:34 Mark Ryden wrote:
[colors in diff]
> What do you mean ?
> where ? how ?

This should do the trick:

git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto

Thomas

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

* Re: white spaces in a patch
  2008-12-17 12:13       ` Mark Ryden
  2008-12-17 12:15         ` Thomas Jarosch
@ 2008-12-17 12:16         ` Sverre Rabbelier
  1 sibling, 0 replies; 12+ messages in thread
From: Sverre Rabbelier @ 2008-12-17 12:16 UTC (permalink / raw)
  To: Mark Ryden; +Cc: Junio C Hamano, git

On Wed, Dec 17, 2008 at 13:13, Mark Ryden <markryde@gmail.com> wrote:
> On Wed, Dec 17, 2008 at 2:13 PM, Sverre Rabbelier <srabbelier@gmail.com> wrote:
>> Do you have color on?

$ git config color.diff true


-- 
Cheers,

Sverre Rabbelier

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

* Re: white spaces in a patch
  2008-12-17 12:15         ` Thomas Jarosch
@ 2008-12-17 12:22           ` Mark Ryden
  2008-12-17 20:02             ` Matthieu Moy
  2008-12-17 12:22           ` Jeff King
  1 sibling, 1 reply; 12+ messages in thread
From: Mark Ryden @ 2008-12-17 12:22 UTC (permalink / raw)
  To: Thomas Jarosch; +Cc: Sverre Rabbelier, Junio C Hamano, git

Thnks!
In fact, the first line was enough!
git config --global color.diff auto
Mark



On Wed, Dec 17, 2008 at 2:15 PM, Thomas Jarosch
<thomas.jarosch@intra2net.com> wrote:
> On Wednesday, 17. December 2008 13:13:34 Mark Ryden wrote:
> [colors in diff]
>> What do you mean ?
>> where ? how ?
>
> This should do the trick:
>
> git config --global color.diff auto
> git config --global color.status auto
> git config --global color.branch auto
>
> Thomas
>
>

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

* Re: white spaces in a patch
  2008-12-17 12:15         ` Thomas Jarosch
  2008-12-17 12:22           ` Mark Ryden
@ 2008-12-17 12:22           ` Jeff King
  1 sibling, 0 replies; 12+ messages in thread
From: Jeff King @ 2008-12-17 12:22 UTC (permalink / raw)
  To: Thomas Jarosch; +Cc: Mark Ryden, Sverre Rabbelier, Junio C Hamano, git

On Wed, Dec 17, 2008 at 01:15:56PM +0100, Thomas Jarosch wrote:

> This should do the trick:
> 
> git config --global color.diff auto
> git config --global color.status auto
> git config --global color.branch auto

These days we have

  git config --global color.ui auto

-Peff

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

* Re: white spaces in a patch
  2008-12-17 12:22           ` Mark Ryden
@ 2008-12-17 20:02             ` Matthieu Moy
  0 siblings, 0 replies; 12+ messages in thread
From: Matthieu Moy @ 2008-12-17 20:02 UTC (permalink / raw)
  To: Mark Ryden; +Cc: Thomas Jarosch, Sverre Rabbelier, Junio C Hamano, git

"Mark Ryden" <markryde@gmail.com> writes:

> Thnks!
> In fact, the first line was enough!
> git config --global color.diff auto

Yes, but you may appreciate color in other commands (log,
status, ...).  Then, "color.ui = auto" is your friend.

-- 
Matthieu

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

end of thread, other threads:[~2008-12-17 20:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-17  7:31 white spaces in a patch Mark Ryden
2008-12-17  7:34 ` Junio C Hamano
2008-12-17 11:44   ` Mark Ryden
2008-12-17 12:13     ` Sverre Rabbelier
2008-12-17 12:13       ` Mark Ryden
2008-12-17 12:15         ` Thomas Jarosch
2008-12-17 12:22           ` Mark Ryden
2008-12-17 20:02             ` Matthieu Moy
2008-12-17 12:22           ` Jeff King
2008-12-17 12:16         ` Sverre Rabbelier
2008-12-17 12:08   ` Johannes Schindelin
2008-12-17 12:10     ` Mark Ryden

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).