diff options
author | Mathias Kinzler <mathias.kinzler@sap.com> | 2011-02-08 08:56:19 +0100 |
---|---|---|
committer | Mathias Kinzler <mathias.kinzler@sap.com> | 2011-02-08 08:56:19 +0100 |
commit | 724af77c65c27eb24d41989bed3229910dbe063c (patch) | |
tree | 151dcf62ad5da23ae7cd50661b7196286de4d21d | |
parent | 0180946bc885436be2d3c205c7444bcdd57d85cd (diff) | |
download | jgit-724af77c65c27eb24d41989bed3229910dbe063c.tar.gz jgit-724af77c65c27eb24d41989bed3229910dbe063c.zip |
PullCommand: use default remote instead of throwing Exception
When pulling into a local branch that has no upstream configuration,
pull should try to used the default remote ("origin") instead of
throwing an Exception.
Bug: 336504
Change-Id: Ife75858e89ea79c0d6d88ba73877fe8400448e34
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java index db07918655..f505674117 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java @@ -166,15 +166,12 @@ public class PullCommand extends GitCommand<PullResult> { // get the configured remote for the currently checked out branch // stored in configuration key branch.<branch name>.remote Config repoConfig = repo.getConfig(); - final String remote = repoConfig.getString( + String remote = repoConfig.getString( ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REMOTE); - if (remote == null) { - String missingKey = ConfigConstants.CONFIG_BRANCH_SECTION + DOT - + branchName + DOT + ConfigConstants.CONFIG_KEY_REMOTE; - throw new InvalidConfigurationException(MessageFormat.format( - JGitText.get().missingConfigurationForKey, missingKey)); - } + if (remote == null) + // fall back to default remote + remote = Constants.DEFAULT_REMOTE_NAME; // get the name of the branch in the remote repository // stored in configuration key branch.<branch name>.merge |