From: Phil Hord <hordp@cisco.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Andrew Garber <andrew@andrewgarber.com>, git@vger.kernel.org
Subject: Re: [PATCH] git-p4: replace each tab with 8 spaces for consistency
Date: Thu, 07 Apr 2011 12:35:48 -0400 [thread overview]
Message-ID: <4D9DE7E4.1030808@cisco.com> (raw)
In-Reply-To: <7vhbaafr7r.fsf@alter.siamese.dyndns.org>
On 04/07/2011 03:36 AM, Junio C Hamano wrote:
> Mixing tabs and spaces can lead to hard-to-find bugs, I agree.
>
> I just threw this in to my .git/info/attributes:
>
> contrib/fast-import/git-p4 whitespace=!indent,tail,tab-in-indent
>
> and then did this:
>
> $ >contrib/fast-import/git-p4
> $ git diff -R | git apply --whitespace=fix
> $ git diff
>
> The changes I get out of the last step seem to exactly match your patch.
Junio! Thanks for that recipe.
I suspected there must be some way to employ git-apply's whitespace=fix
feature to ws-normalize my code, but I was clueless how to do that. I
wound up cobbling together a python script that reimplements the same
fixes (hopefully).
I wish this (the git-apply trick) was documented somewhere and/or made
more prominent. Is it, and I have also overlooked it?
This is what I want:
git fix-whitespace # fix new ws errors in workdir
git fix-whitespace --all # fix all ws errors in workdir
git fix-whitespace foo # fix new ws errors since foo
git fix-whitespace --cached # fix new ws errors in the index
etc.
Is this already implemented somewhere in the git porcelain?
Phil
next prev parent reply other threads:[~2011-04-07 16:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-07 6:01 [PATCH] git-p4: replace each tab with 8 spaces for consistency Andrew Garber
2011-04-07 7:36 ` Junio C Hamano
2011-04-07 16:35 ` Phil Hord [this message]
2011-04-07 18:45 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2011-04-07 6:01 Andrew Garber
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=4D9DE7E4.1030808@cisco.com \
--to=hordp@cisco.com \
--cc=andrew@andrewgarber.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.