mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-11-07 09:20:29 +00:00
73e91edecc
Make it easy for users to search and replace text throughout the repository history. Instead of inventing some new syntax, reuse the same syntax used by BFG repo filter's --replace-text option, namely, a file with one expression per line of the form [regex:|glob:|literal:]$MATCH_EXPR[==>$REPLACEMENT_EXPR] Where "$MATCH_EXPR" is by default considered to be literal text, but could be a regex or a glob if the appropriate prefix is used. Also, $REPLACEMENT_EXPR defaults to '***REMOVED***' if not specified. If you want a literal '==>' to be part of your $MATCH_EXPR, then you must also manually specify a replacement expression instead of taking the default. Some examples: sup3rs3kr3t (replaces 'sup3rs3kr3t' with '***REMOVED***') HeWhoShallNotBeNamed==>Voldemort (replaces 'HeWhoShallNotBeNamed' with 'Voldemort') very==> (replaces 'very' with the empty string) regex:(\d{2})/(\d{2})/(\d{4})==>\2/\1/\3 (replaces '05/17/2012' with '17/05/2012', and vice-versa) The format for regex is as from re.sub(<pattern>, <repl>, <string>) from https://docs.python.org/2/library/re.html The <string> comes from file contents of the repo, and you specify the <pattern> and <repl>. glob:Copy*t==>Cartel (replaces 'Copyright' or 'Copyleft' or 'Copy my st' with 'Cartel') Signed-off-by: Elijah Newren <newren@gmail.com> |
||
---|---|---|
.. | ||
t9390 | ||
t9391 | ||
t9390-filter-repo.sh | ||
t9391-filter-repo-lib-usage.sh | ||
test-lib-functions.sh | ||
test-lib.sh |