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>tags/v5.11.0.202102240950-m3
badEntryName=Bad entry name: {0} | badEntryName=Bad entry name: {0} | ||||
badEscape=Bad escape: {0} | badEscape=Bad escape: {0} | ||||
badGroupHeader=Bad group header | badGroupHeader=Bad group header | ||||
badIgnorePattern=Cannot parse .gitignore pattern ''{0}'' | |||||
badObjectType=Bad object type: {0} | badObjectType=Bad object type: {0} | ||||
badRef=Bad ref: {0}: {1} | badRef=Bad ref: {0}: {1} | ||||
badSectionEntry=Bad section entry: {0} | badSectionEntry=Bad section entry: {0} |
import static org.eclipse.jgit.ignore.internal.Strings.stripTrailing; | import static org.eclipse.jgit.ignore.internal.Strings.stripTrailing; | ||||
import static org.eclipse.jgit.ignore.internal.Strings.stripTrailingWhitespace; | import static org.eclipse.jgit.ignore.internal.Strings.stripTrailingWhitespace; | ||||
import java.text.MessageFormat; | |||||
import org.eclipse.jgit.errors.InvalidPatternException; | import org.eclipse.jgit.errors.InvalidPatternException; | ||||
import org.eclipse.jgit.ignore.internal.PathMatcher; | import org.eclipse.jgit.ignore.internal.PathMatcher; | ||||
import org.eclipse.jgit.internal.JGitText; | |||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
Character.valueOf(PATH_SEPARATOR), dirOnly); | Character.valueOf(PATH_SEPARATOR), dirOnly); | ||||
} catch (InvalidPatternException e) { | } catch (InvalidPatternException e) { | ||||
m = NO_MATCH; | m = NO_MATCH; | ||||
LOG.error(e.getMessage(), e); | |||||
LOG.error(MessageFormat.format( | |||||
JGitText.get().badIgnorePattern, | |||||
e.getPattern()), e); | |||||
} | } | ||||
this.matcher = m; | this.matcher = m; | ||||
} | } |
/***/ public String badEntryName; | /***/ public String badEntryName; | ||||
/***/ public String badEscape; | /***/ public String badEscape; | ||||
/***/ public String badGroupHeader; | /***/ public String badGroupHeader; | ||||
/***/ public String badIgnorePattern; | |||||
/***/ public String badObjectType; | /***/ public String badObjectType; | ||||
/***/ public String badRef; | /***/ public String badRef; | ||||
/***/ public String badSectionEntry; | /***/ public String badSectionEntry; |