FS: debug logging only if system config file cannot be found

The command 'git config --system --show-origin --list -z' fails if
the system config doesn't exist. Use debug logging instead of a
warning for failures of that command. Typically the user cannot do
anything about it anyway, and JGit will just work without system
config.

Bug: 577492
Change-Id: If628ab376182183aea57a385c169e144d371bbb2
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
This commit is contained in:
Thomas Wolf 2021-11-28 11:42:20 +01:00 committed by Matthias Sohn
parent 6aa29d1166
commit 122237439d
1 changed files with 5 additions and 1 deletions

View File

@ -1522,6 +1522,7 @@ protected File discoverGitSystemConfig() {
String w;
try {
// This command prints the path even if it doesn't exist
w = readPipe(gitExe.getParentFile(),
new String[] { gitExe.getPath(), "config", "--system", //$NON-NLS-1$ //$NON-NLS-2$
"--edit" }, //$NON-NLS-1$
@ -1544,7 +1545,10 @@ protected File discoverGitSystemConfig() {
"--show-origin", "--list", "-z" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Charset.defaultCharset().name());
} catch (CommandFailedException e) {
LOG.warn(e.getMessage());
// This command fails if the system config doesn't exist
if (LOG.isDebugEnabled()) {
LOG.debug(e.getMessage());
}
return null;
}
if (w == null) {