tags:

views:

60

answers:

1

I've used a perl script to modify all tab characters in a php git repository and changed them all to 4 spaces.

$ find -iname \*.php -exec perl -pi -e "s/\t/ /g" {} \;

I can commit this change with git commit, but it will mark me as the author of all changed lines inside git blame after this commit is made.

Is there any way to commit this massive change that doesn't mark me as the author of the changed lines? but retains the original author? Thats a lot of history we don't really want to loose in our project...

Thanks,

UPDATE: Our purpose in replacing tabs with 4 spaces is not to make things appear different in git blame, but to follow proper PEAR coding standards. i.e... no tabs, use 4 spaces for indentation.

+6  A: 

It isn't the responsibility of the commit command to decide how to treat whitespaces, but the responsibility of the blame command because it is blame which analyzes the differences between versions to get the author of each line. So searching for an option to ignore whitespace in blame:

The option -w is defined as: "Ignore whitespace when comparing the parent's version and the child's to find where the lines came from." http://kernel.org/pub/software/scm/git/docs/git-blame.html

CodeInChaos
We're trying to follow good PEAR coding standards, which insist on 4 spaces for indentation instead of tab characters. This makes things much nicer for unification across OS/IDE implementations too...
nookni
I think you misunderstood my answer. I'm saying that you should tell blame to ignore the changes in whitespace(and thus indirectly that commit), instead of trying to explicitly mark the commit so it doesn't appear in *blame*.
CodeInChaos