git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "\"Peter Valdemar Mørch (Lists)\"" <4ux6as402@sneakemail.com>
To: git@vger.kernel.org
Subject: How to fix (and find) many git-* --check errors?
Date: Fri, 08 Aug 2008 14:49:00 +0200	[thread overview]
Message-ID: <489C40BC.8000008@sneakemail.com> (raw)

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

             reply	other threads:[~2008-08-08 12:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-08 12:49 "Peter Valdemar Mørch (Lists)" [this message]
2008-08-08 13:23 ` How to fix (and find) many git-* --check errors? 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)"

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=489C40BC.8000008@sneakemail.com \
    --to=4ux6as402@sneakemail.com \
    --cc=git@vger.kernel.org \
    /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 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).