git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to fix (and find) many git-* --check errors?
@ 2008-08-08 12:49 "Peter Valdemar Mørch (Lists)"
  2008-08-08 13:23 ` Jeff King
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: "Peter Valdemar Mørch (Lists)" @ 2008-08-08 12:49 UTC (permalink / raw)
  To: git

We have > 37000 white space "errors" in HEAD, mostly trailing 
whitespace, and I'm looking for a

$ git diff --check | git??? --whitespace=fix

command.

Is there such a beast?

I see that git-apply has a --whitespace=<action> option, but I don't 
seem to grock how to be able to use it for fixing my working directory.

Details follow:

I can create a perl script that does this for me (e.g. inspired by 
1.5.6's hooks/pre-commit's perl version of git diff --check) and post it 
here if anybody would like it, but I'd rather use some well-tested 
method if one exists. And it seems git-apply has the functionality somehow.

Of course, I can also:

$ git diff --check > tmpcfile
# (Or some other command to find all of them under ./)
$ vim
:cfile tmpcfile

Thank you for --check having a handy output format, BTW! But I prefer 
automation (and automated auditing of the results) for 37000 lines.

Also the way I found them is like this:

$ git diff --check $(git log --pretty=format:%H | tail -1)..HEAD .

(The diff between "the empty commit" and HEAD - well between the first 
commit and HEAD anyway. Is there a ref for "totally empty" or the 
revision before the first commit? Or a more elegant way to get this list?)

Peter
-- 
Peter Valdemar Mørch
http://www.morch.com

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

end of thread, other threads:[~2008-08-09  7:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-08 12:49 How to fix (and find) many git-* --check errors? "Peter Valdemar Mørch (Lists)"
2008-08-08 13:23 ` Jeff King
2008-08-08 13:28 ` Björn Steinbrink
2008-08-08 14:57 ` "Peter Valdemar Mørch (Lists)"
2008-08-08 19:27 ` Junio C Hamano
2008-08-09  7:28   ` "Peter Valdemar Mørch (Lists)"

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