For sure, you shouldn't touch upstream. But that commit hook should only touch files you're committing. That's what git diff-index --cached is doing. But you would still need to add some logic to restrict it to patches that change the end of the file. Still probably not worth it.