nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] indentation has been changed to use only tabs


From: Benno Schulenberg
Subject: [Nano-devel] indentation has been changed to use only tabs
Date: Fri, 29 Dec 2017 21:44:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0


Hi all,

In the git repo, the files src/*.c and src/*.h and configure.ac
have been converted to use only tabs as indentation characters,
instead of a mixture of tabs and spaces.  This was done with the
following two seds:

    sed -i 's/^\(\t*\)/\1\1/'  src/*.[ch] co*ac
    sed -i 's/^\(\t*\)    /\1\t/'  src/*.[ch] co*ac

There is one disadvantage to using tabs of four spaces, though:
git diff still thinks that tabs are 8 spaces wide, which pushes
the ends of many lines off the screen.  How can I tell git to
display tabs as four spaces?

If you maintain a patch set, you could use the option
--ignore-whitespace when rebasing to master, but that would leave
the lines that you changed still with the old indentation scheme.
Instead, after checking out your branch, you can do this:

    rm 00*
    git rebase b574f73e

    (Resolve any conflicts before proceding.)

    git format-patch b574f73e
    sed -i 's/^\(.\)\(\t*\)/\1\2\2/'  00*
    sed -i 's/^\(.\)\(\t*\)    /\1\2\t/'  00*
    git checkout master
    git checkout -b somenewname
    git am 00*

This will give you in "somenewname" a copy of your branch updated
to the normalized indentation scheme.

If I've overlooked anything, please let me know.

Benno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]