Stripping ALL tabs from the code

Bron Gondwana brong at
Sun Jun 14 20:48:47 EDT 2015

On Tue, Jun 9, 2015, at 08:42 PM, Bron Gondwana wrote:
> The big news from yesterday's meeting is that we are going to check in a single massive commit which strips all leading tabs from the code, everywhere.  The new coding standard is 4 spaces for each level of indent, and spaces for all alignment within code as well.
> I've pushed a small perl script to master which performs the necessary surgery.  it has the smarts to know when a tab isn't on a multiple-of-8 boundary and substitute fewer spaces.
> The code still builds and passes tests afterwards, so I'm pretty sure it's good.
> I will be running the on master on June 14th (Sunday) night Melbourne time.  That's weekend for everyone, everywhere in the world.  I will immediately push the result back to master (after running the tests again of course).
> If you have a patch series lying around that you want to apply, it might be a good idea to do it before then!  Alternatively, you can patch with -l or --ignore-whitespace to apply your patches to the tree, and then run tools/ on the resulting tree to remove the tabs again.
> Enjoy your new, simpler coding style with no trailing whitespace left!

This has been done - I didn't quite finish the instructions last night, so I did the work this morning.

The commits themselves tell you this as well, but just in case anyone has old git branches lying around:

    If you have a branch which you want to convert all the commits
    into the new spacing style for easy rebase/cherry-pick, then
    you can run:
       1) git checkout <mybranch>
       2) git rebase pretab
       3) git filter-branch --tree-filter tools/ pretab^..HEAD
       4) git rebase posttab
    NOTE the "pretab^".  It is very important that you keep the ^ so that
    this commit is the one that collects all the whitespace changes.
    This will rewrite all the commits on your branch to the new whitespace
    style and then rebase it on top of the posttab commit.  Since the
    empty pretab commit will be rewritten to match posttab exactly by the
    filter-branch process, the rebase will be clean and will skip the
    pretab commit.
    NOTE: you may need to make fixes at step 2 if your branch is old and
    won't rebase cleanly on top of pretab.  Step 3 is noisy and slow, but
    should always run correctly.

And that's that!  Enjoy your new tab-free world :)


  Bron Gondwana
  brong at

More information about the Cyrus-devel mailing list