diff options
author | Markus Duft <markus.duft@ssi-schaefer.com> | 2018-08-30 08:27:37 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-09-10 22:21:15 +0200 |
commit | 303adeb8bf45412b30d77db3e5575e91b428abda (patch) | |
tree | b363b2e79eda37a82060f82e19d6e1f88c443de0 | |
parent | c857e7f09bf1f4f4ab89888bd4e7c17d29981b40 (diff) | |
download | jgit-303adeb8bf45412b30d77db3e5575e91b428abda.tar.gz jgit-303adeb8bf45412b30d77db3e5575e91b428abda.zip |
Fix replacement quoting for replaceAll in filter command
According to String.replaceAll JavaDoc:
"Note that backslashes (\) and dollar signs ($) in the replacement
string may cause the results to be different than if it were being
treated as a literal replacement string; see Matcher.replaceAll. Use
java.util.regex.Matcher.quoteReplacement to suppress the special meaning
of these characters, if desired."
Bug: 536318
Change-Id: Ib70cfec41bf73e14d23d94d14aee05a25b1e87f6
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java index 82675859dd..69303d6ee3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java @@ -50,6 +50,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Set; +import java.util.regex.Matcher; import org.eclipse.jgit.annotations.Nullable; import org.eclipse.jgit.api.errors.JGitInternalException; @@ -1438,7 +1439,8 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { return null; } return filterCommand.replaceAll("%f", //$NON-NLS-1$ - QuotedString.BOURNE.quote((getPathString()))); + Matcher.quoteReplacement( + QuotedString.BOURNE.quote((getPathString())))); } /** |