Re: [PATCH] git-p4: replace each tab with 8 spaces for consistency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]