diff options
author | Stefan Lay <stefan.lay@sap.com> | 2011-02-16 15:46:26 +0100 |
---|---|---|
committer | Stefan Lay <stefan.lay@sap.com> | 2011-02-16 15:46:26 +0100 |
commit | 68459b646e6c8243dc5650cbe08ce1bcdb8a621d (patch) | |
tree | 9eed3ac8d76445faa741711070bd8ec56336454b /org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java | |
parent | 18e822a7fefb35e4a68ca4b337541c0a1a222a43 (diff) | |
download | jgit-68459b646e6c8243dc5650cbe08ce1bcdb8a621d.tar.gz jgit-68459b646e6c8243dc5650cbe08ce1bcdb8a621d.zip |
Fix NullPointer when pulling from a deleted local branch
A checked Exception is thrown instead.
The reason for throwing an Exception is that the state of the
repository is inconsistent in this case: There is a merge
configuration containing a non-existing local branch. Ideally the
deletion of a local branch should also delete the corresponding
merge configuration.
Bug: 337315
Change-Id: I71e56ffb90e11e6e3c1bbd964ad63972d67990c0
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java | 5 |
1 files changed, 4 insertions, 1 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 f505674117..1c86bd6638 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java @@ -138,7 +138,7 @@ public class PullCommand extends GitCommand<PullResult> { */ public PullResult call() throws WrongRepositoryStateException, InvalidConfigurationException, DetachedHeadException, - InvalidRemoteException, CanceledException { + InvalidRemoteException, CanceledException, RefNotFoundException { checkCallable(); monitor.beginTask(JGitText.get().pullTaskName, 2); @@ -248,6 +248,9 @@ public class PullCommand extends GitCommand<PullResult> { } else { try { commitToMerge = repo.resolve(remoteBranchName); + if (commitToMerge == null) + throw new RefNotFoundException(MessageFormat.format( + JGitText.get().refNotResolved, remoteBranchName)); } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfPullCommand, |