summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2021-02-23 13:11:56 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2021-02-23 22:11:01 +0100
commit4e745c57f7612123bc58d3ff96f95c472f9edc94 (patch)
tree293d74e935e47e97f7a83273e942f760cc1e591a /org.eclipse.jgit/src
parent927deed5a569bd09ad5d23e815bcc3d68d14de91 (diff)
downloadjgit-4e745c57f7612123bc58d3ff96f95c472f9edc94.tar.gz
jgit-4e745c57f7612123bc58d3ff96f95c472f9edc94.zip
FastIgnoreRule: include bad pattern in log message
When a .gitignore pattern cannot be parsed include the pattern in the log message. Just reporting "not closed bracket" isn't helpful if the user doesn't know in which pattern the problem occurred. Even better would be to include the full path of the .gitignore file that contained the offending pattern. This is not implemented in this change; it may need new API and needs more thought. Bug: 571143 Change-Id: Id5b16d9cf550544ba3ad409a02041946fa8516ab Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java1
2 files changed, 7 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
index d7e4f79d26..8b35406e3d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
@@ -14,8 +14,11 @@ import static org.eclipse.jgit.ignore.internal.Strings.isDirectoryPattern;
import static org.eclipse.jgit.ignore.internal.Strings.stripTrailing;
import static org.eclipse.jgit.ignore.internal.Strings.stripTrailingWhitespace;
+import java.text.MessageFormat;
+
import org.eclipse.jgit.errors.InvalidPatternException;
import org.eclipse.jgit.ignore.internal.PathMatcher;
+import org.eclipse.jgit.internal.JGitText;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -96,7 +99,9 @@ public class FastIgnoreRule {
Character.valueOf(PATH_SEPARATOR), dirOnly);
} catch (InvalidPatternException e) {
m = NO_MATCH;
- LOG.error(e.getMessage(), e);
+ LOG.error(MessageFormat.format(
+ JGitText.get().badIgnorePattern,
+ e.getPattern()), e);
}
this.matcher = m;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
index af7d50aae2..cf915afdc1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -58,6 +58,7 @@ public class JGitText extends TranslationBundle {
/***/ public String badEntryName;
/***/ public String badEscape;
/***/ public String badGroupHeader;
+ /***/ public String badIgnorePattern;
/***/ public String badObjectType;
/***/ public String badRef;
/***/ public String badSectionEntry;