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>
This commit is contained in:
Stefan Lay 2011-02-16 15:46:26 +01:00
parent 18e822a7fe
commit 68459b646e
1 changed files with 4 additions and 1 deletions

View File

@ -138,7 +138,7 @@ public PullCommand setCredentialsProvider(
*/
public PullResult call() throws WrongRepositoryStateException,
InvalidConfigurationException, DetachedHeadException,
InvalidRemoteException, CanceledException {
InvalidRemoteException, CanceledException, RefNotFoundException {
checkCallable();
monitor.beginTask(JGitText.get().pullTaskName, 2);
@ -248,6 +248,9 @@ public PullResult call() throws WrongRepositoryStateException,
} 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,