diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2014-09-24 00:06:48 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2014-09-24 15:27:36 +0200 |
commit | 00802b6317469a26efc94ae56366d12da79466f1 (patch) | |
tree | f267ab73d03c99cd1bddf9f73bd3e1e216645453 | |
parent | 3f0d9795ea95bb5ae3af392efaed769a0f0f625e (diff) | |
download | jgit-00802b6317469a26efc94ae56366d12da79466f1.tar.gz jgit-00802b6317469a26efc94ae56366d12da79466f1.zip |
[cli] Use chaining credentials provider to enable .netrc
If available use credentials in .netrc otherwise prompt the user
if jgit command line needs credentials for remote operations.
Change-Id: Iea1f595618edfb87a37137db08bac8ca2d500ebc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r-- | org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java index 91034fd2cc..a01fd86b4d 100644 --- a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java +++ b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java @@ -48,8 +48,10 @@ package org.eclipse.jgit.console; import java.io.Console; import org.eclipse.jgit.errors.UnsupportedCredentialItem; +import org.eclipse.jgit.transport.ChainingCredentialsProvider; import org.eclipse.jgit.transport.CredentialItem; import org.eclipse.jgit.transport.CredentialsProvider; +import org.eclipse.jgit.transport.NetRCCredentialsProvider; import org.eclipse.jgit.transport.URIish; /** Interacts with the user during authentication by using the text console. */ @@ -60,7 +62,9 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { if (c.cons == null) throw new NoClassDefFoundError( ConsoleText.get().noSystemConsoleAvailable); - CredentialsProvider.setDefault(c); + CredentialsProvider cp = new ChainingCredentialsProvider( + new NetRCCredentialsProvider(), c); + CredentialsProvider.setDefault(cp); } private final Console cons = System.console(); |