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

Re: [OT] CVS diff: hard vs. soft tabs



Nori Heikkinen wrote:

right, that would have been nice ... but, as you say, i just inherited
this one.  not much i could have done about setting conventions first.


For things like indenting, etc, you could always adjust what you
have your tabstop set to.


what i have my tabstop set to doesn't matter -- that's how my editor
interprets hard tabs on disk.  what i have is _no_ hard tabs on disk,
and i want to put them there.  that's more complex, right?

Indeed it is. What you're essentially saying is along the lines of
"I've made sweeping format changes to the code before working on it, and now I only want to commit the actual code changes. How do I do that?", right?


I'm not sure how well this would work, but you could try something like this:

Checkout the original, unaltered file you started with. Do a

diff -uNrw originalfile newfile > changes.diff

patch -p0 < changes.diff

This should (I've only done some basic, rudimentary tests) only change the orignial file in the way that you want. In other words, the original file should be formated in its original state, but your new code should now be in it. Please make backups/check the output.

Keep in mind that you may want to go back and reformat your bits of code so that the styles match, but this should get you most of the way there.


My general rule of thumb is that unless I'm taking over the code for an extended period, I simply preserve the style it is written in. Its easier to deal with that way, especially if you know you're either not going to work on it again, or infrequently.


--

Mental (Mental@NeverLight.com)

"The Torah...  The Gospels...  The Koran...
Each claimed as the infallible word of GOD.
Misquoted, misinterpreted, misunderstood, and misapplied.
Maybe that's why he doesn't do any more interviews." - sinfest.net

CARPE NOCTEM, QUAM MINIMUM CREDULA POSTERO.

GPG public key: http://www.neverlight.com/pas/Mental.asc


Attachment: pgpAMDyk1s0h1.pgp
Description: PGP signature


Reply to: