Removing trailing whitespace [was Re: Patch for Issue #830]

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Removing trailing whitespace [was Re: Patch for Issue #830]

Trevor D-2

Carl Sorensen wrote Monday, December 21, 2009 4:41 PM

> On 12/21/09 9:11 AM, "Trevor Daniels" <[hidden email]>
> wrote:
>
>> Carl Sorensen wrote" <[hidden email]>
>>
>>> so you can do
>>>
>>> git rebase --whitespace=fix HEAD^
>>
>> Hhm.  I don't think this works.
>>
>> The whitespace option is simply passed to apply
>> for actioning, but in this case apply is never
>> invoked as HEAD is already up to date.  But
>> please correct me if you find it does work, as
>> this would certainly be an easier option.
>
> On my system it works:
[snip]
> Have I missed something?

No; it was I that missed something - as Reinhold
pointed out I missed the ^.  Sorry.

I also learned something.  Using --whitespace=warn
does nothing, because apply is not invoked, but
--whitespace=fix forces a rebase, and hence apply
is invoked.  So how does this sound:

To remove trailing whitespace during git am use

git am --whitespace=fix ...

To remove trailing whitespace from the last
commit in master use

git rebase --whitespace=fix HEAD^

To remove training whitespace from all divergent
commits in branch <branch> during a branch
rebase use

git rebase --whitespace=fix master <branch>

(The latter is already in CG in git as of this morning)

Trevor




---
----
Join the Frogs!

Loading...