Browse Source

Remove costly quoting test in DiffFormatter

QuotedString.GIT_PATH returns the input reference exactly if
the string does not require quoting, otherwise it returns a
copy that contains the quotes on either end, plus escapes in
the middle where necessary to meet conventions.

Testing the return against '"' + name + '"' is always false,
because GIT_PATH will never return it that way.  The only way
we have quotes on either end is if there is an escape in the
middle, in which case the string isn't equal anyway.

Change-Id: I4d21d8e5c7da0d7df9792c01ce719548fa2df16b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
tags/v0.9.1
Shawn O. Pearce 13 years ago
parent
commit
34a755f1df
1 changed files with 1 additions and 2 deletions
  1. 1
    2
      org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java

+ 1
- 2
org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java View File

@@ -600,8 +600,7 @@ public class DiffFormatter {
}

private static String quotePath(String name) {
String q = QuotedString.GIT_PATH.quote(name);
return ('"' + name + '"').equals(q) ? name : q;
return QuotedString.GIT_PATH.quote(name);
}

/**

Loading…
Cancel
Save