From 34a755f1df959bd34f9426143765e650665b1afb Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 3 Sep 2010 12:59:53 -0700 Subject: [PATCH] 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 --- org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java index dfd399dc4..8e92c8995 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java @@ -600,8 +600,7 @@ private String format(AbbreviatedObjectId id) { } 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); } /**