I'd like to use Eclipse's formatter to fix some poorly styled code, but there's a huge downside to killing all the metadata in the repository about who is responsible for what. Any thoughts on ways to get around this? Perhaps it is just completely impossible...
You can tell blame to ignore whitespace changes:
svn blame -x -w file/path
Of course that only works if your style fix doesn't change more than whitespaces.
svn blame -x -w -x --ignore-eol-style
. See svn help blame
and this question. –
Ramage The history is still there, you'll just have to look at a blame prior to the cleanup revision.
This is one good reason to have a style standard. Indentation changes can cause a lot of merge conflicts, etc. "Poorly styled" to one is well written to another.
When reformatting code, I usually only fix the indentation. There are just too many cases where the automatic formatter ruins a carefully hand-formatted section.
Another solution would be to add a pre-commit hook that compare the committed file with its formatted version. If there is no difference, the commit is accepted.
Otherwise, a simple message "Code not formatted : commit rejected" would inform your developers to style their modified files prior to commit.
Combined with the Stefan's answer, you still can use blame with -w option and moreover, you do not override the developer's names.
One drawback is that you won't be able to style your whole repository is one pass. Files will be styled as they are modified. Often used files will be quickly styled whereas some might never been updated.
© 2022 - 2024 — McMap. All rights reserved.