From 122237439daee43956fe9f4255365afd40823e21 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Sun, 28 Nov 2021 11:42:20 +0100 Subject: [PATCH] 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 --- org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index 507bd2bc9..4482beb0f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -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) {