0

I'm looking for a way / post-commit hook to go through all committed files on every commit and remove some "known" confidential information from those files - like passwords with sed. After this cleanup is done I would like to have those files commited into a seperate repository where another team can pick up the changes with just updating their repo.

Does someone have a handy shell script to achieve this ? Or provide me some documentation how to access the actual commited files and work them?

Thanks in advance

- mat1010

bahrep
  • 29,961
  • 12
  • 103
  • 150
mat1010
  • 756
  • 1
  • 9
  • 17
  • Maybe this direction can help: http://stackoverflow.com/questions/446518/using-svn-post-commit-hook-to-update-only-files-that-have-been-commited Not exactly the same, but it seems to be a good starting point. – Lajos Veres Dec 21 '15 at 21:42

1 Answers1

0

You can reject a commit using hook, but don't modify its contents. Let me cite SVNBook:

While hook scripts can do almost anything, there is one dimension in which hook script authors should show restraint: do not modify a commit transaction using hook scripts. While it might be tempting to use hook scripts to automatically correct errors, shortcomings, or policy violations present in the files being committed, doing so can cause problems. Subversion keeps client-side caches of certain bits of repository data, and if you change a commit transaction in this way, those caches become indetectably stale. This inconsistency can lead to surprising and unexpected behavior. Instead of modifying the transaction, you should simply validate the transaction in the pre-commit hook and reject the commit if it does not meet the desired requirements. As a bonus, your users will learn the value of careful, compliance-minded work habits.

bahrep
  • 29,961
  • 12
  • 103
  • 150