Skip to content

Commit 2497953

Browse files
Merge pull request #9123 from matthiasblaesing/git-checkout-error
Git: Improve handling of ambigous ID input in checkout dialog
2 parents 57fc9ac + cc57eb1 commit 2497953

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

ide/git/src/org/netbeans/modules/git/ui/repository/RevisionInfoPanelController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.File;
2626
import java.text.DateFormat;
2727
import java.util.Date;
28+
import org.eclipse.jgit.errors.AmbiguousObjectException;
2829
import org.netbeans.modules.git.client.GitClient;
2930
import org.netbeans.libs.git.GitException;
3031
import org.netbeans.libs.git.GitRevisionInfo;
@@ -182,7 +183,7 @@ public void run () {
182183
mergedStatus = commonAncestor != null && commonAncestor.getRevision().equals(revisionInfo.getRevision());
183184
}
184185
} catch (GitException ex) {
185-
if (!(ex instanceof GitException.MissingObjectException)) {
186+
if (!(ex instanceof GitException.MissingObjectException || ex.getCause() instanceof AmbiguousObjectException)) {
186187
GitClientExceptionHandler.notifyException(ex, true);
187188
}
188189
revisionInfo = null;

ide/libs.git/src/org/netbeans/libs/git/jgit/Bundle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
# under the License.
1717

1818
MSG_Exception_IdNotACommit = The given id [{0}] is not a commit or an annotated tag.
19-
MSG_Exception_IdNotUnique = Given objectId [{0}] is not unique.
19+
MSG_Exception_IdAmbiguous = The given objectId [{0}] is ambiguous.

ide/libs.git/src/org/netbeans/libs/git/jgit/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public static ObjectId parseObjectId (Repository repository, String objectId) th
287287
} catch (RevisionSyntaxException ex) {
288288
throw new GitException.MissingObjectException(objectId, GitObjectType.COMMIT, ex);
289289
} catch (AmbiguousObjectException ex) {
290-
throw new GitException(MessageFormat.format(Utils.getBundle(Utils.class).getString("MSG_Exception_IdNotACommit"), objectId), ex); //NOI18N
290+
throw new GitException(MessageFormat.format(Utils.getBundle(Utils.class).getString("MSG_Exception_IdAmbiguous"), objectId), ex); //NOI18N
291291
} catch (IOException ex) {
292292
throw new GitException(ex);
293293
}

0 commit comments

Comments
 (0)