Using Perforce, I’d like to be able to reject submits which contain files with Windows line endings (\r\n IIRC, maybe just \r anywhere as really we only want files with Unix line endings).
Rather than dos2unix incoming files or similar, to help track down instances where users attempt to submit files with Windows line endings, I’d like to add a trigger to reject text submissions which contain files with non-Unix line endings.
Could someone demonstrate how the trigger itself could be written, perhaps with bash or python?
Thanks
Here’s the minimal edit I can thing of for the bash example found in the p4 docs:
The original example fails if the target is missing, this one fails if it’s present — just switching the
thenandelsebranches of theif. You could edit it further of course (e.g. givinggrep, orfgrep, the-qflag to suppress output, if your grep supports it as e.g. GNU’s does).