Browse Source

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: I8ed57d5aaed60aaab685fc11a8695e474e60215f
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v0.11.3
Stefan Lay 13 years ago
parent
commit
68064ed339
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java

+ 4
- 1
org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java View File

*/ */
public PullResult call() throws WrongRepositoryStateException, public PullResult call() throws WrongRepositoryStateException,
InvalidConfigurationException, DetachedHeadException, InvalidConfigurationException, DetachedHeadException,
InvalidRemoteException, CanceledException {
InvalidRemoteException, CanceledException, RefNotFoundException {
checkCallable(); checkCallable();


monitor.beginTask(JGitText.get().pullTaskName, 2); monitor.beginTask(JGitText.get().pullTaskName, 2);
} else { } else {
try { try {
commitToMerge = repo.resolve(remoteBranchName); commitToMerge = repo.resolve(remoteBranchName);
if (commitToMerge == null)
throw new RefNotFoundException(MessageFormat.format(
JGitText.get().refNotResolved, remoteBranchName));
} catch (IOException e) { } catch (IOException e) {
throw new JGitInternalException( throw new JGitInternalException(
JGitText.get().exceptionCaughtDuringExecutionOfPullCommand, JGitText.get().exceptionCaughtDuringExecutionOfPullCommand,

Loading…
Cancel
Save