0
Every once in a while I happen to accidentally commit code containing console.log
or debugger;
to my svn trunk. Obviously this is not ideal and I'd like to add checks that'd prevent me from committing code like this in the first place.
Can I prevent a commit if my code contains certain keywords?
My svn client of choice is TortoiseSVN. I've been searching on the web for a solution but I mostly found stuff that relates to server-side hooks. My goal is to only run this client-side.
You might be able to set up a pre-commit hook script which greps the file for those values and blocks it. A quick search found this: https://www.codeproject.com/Articles/528302/TortoiseSVN-pre-commit-hook-in-Csharp-Save-yoursel you can set up commit hooks in the TortoiseSVN settings right click settings menu. (Deleted my answer as it was unrelated and I don't have a complete answer)
– Mokubai – 2018-08-30T07:45:11.063You can do it with a wrapper script. Subversion doesn't support client-side hooks. – uzsolt – 2018-08-30T09:39:04.313
@uzsolt Subversion itself does not support client side hooks, but the TortoiseSVN client does. – Mokubai – 2018-08-30T10:01:34.200
Oh, I don't use TortoiseSVN. – uzsolt – 2018-08-30T14:05:05.127