-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows replacement inside of files using a regular expression. Change-Id: regex-replace
- Loading branch information
1 parent
a8834bf
commit ca6cc62
Showing
6 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
$ export TESTTMP=${PWD} | ||
|
||
$ cd ${TESTTMP} | ||
$ git init -q repo 1>/dev/null | ||
$ cd repo | ||
|
||
$ echo "hello world" > hw.txt | ||
$ mkdir subdir | ||
$ echo "hello moon" > subdir/hw.txt | ||
|
||
$ git add . | ||
$ git commit -m initial | ||
[master (root-commit) 79f224d] initial | ||
2 files changed, 2 insertions(+) | ||
create mode 100644 hw.txt | ||
create mode 100644 subdir/hw.txt | ||
|
||
$ git diff ${EMPTY_TREE}..HEAD | ||
diff --git a/hw.txt b/hw.txt | ||
new file mode 100644 | ||
index 0000000..3b18e51 | ||
--- /dev/null | ||
+++ b/hw.txt | ||
@@ -0,0 +1 @@ | ||
+hello world | ||
diff --git a/subdir/hw.txt b/subdir/hw.txt | ||
new file mode 100644 | ||
index 0000000..1b95c6e | ||
--- /dev/null | ||
+++ b/subdir/hw.txt | ||
@@ -0,0 +1 @@ | ||
+hello moon | ||
|
||
$ josh-filter -p ':replace="hello","bye":replace="^(?P<l>.*(?m))$","$l!"' | ||
:replace=hello,bye:replace="^(?P<l>.*(?m))$","$l!" | ||
$ josh-filter ':replace="hello","bye":replace="(?m)^(?P<l>.+)$","$l!"' | ||
|
||
$ git diff ${EMPTY_TREE}..FILTERED_HEAD | ||
diff --git a/hw.txt b/hw.txt | ||
new file mode 100644 | ||
index 0000000..9836695 | ||
--- /dev/null | ||
+++ b/hw.txt | ||
@@ -0,0 +1 @@ | ||
+bye world! | ||
diff --git a/subdir/hw.txt b/subdir/hw.txt | ||
new file mode 100644 | ||
index 0000000..cb72486 | ||
--- /dev/null | ||
+++ b/subdir/hw.txt | ||
@@ -0,0 +1 @@ | ||
+bye moon! |