mattlqx / pre-commit-search-and-replace

Plugin for pre-commit for arbitrary search and replace on committed files.
MIT License
12 stars 6 forks source link

prevent multiple config replacements from making multiple moves #5

Closed mattlqx closed 3 years ago

mattlqx commented 3 years ago

if several replacement configurations have matches, a file will attempt to be moved more than once and cause an exception.

there's an additional problem in that if multiple patterns are run against the same file, only one can win as modifications are made against the source file and not a tempfile from a prior pattern. the easiest way to deal with this is to just adjust the source file after every match replacement.

Precommit-Verified: 2bec65525c5611178d36d021a60616514773ad0c71aefdeb9107a8d3c4d7e877