Browse Source

Specify RevisionSyntaxException message in Repository#resolve

This does not address all cases where no message is specified, only
cases where Repository#isValidRefName returns false.

Change-Id: Ib88cdabfdcdf37be0053e06949b0e21ad87a9575
Signed-off-by: Grace Wang <gracewang92@gmail.com>
stable-4.6
Grace Wang 8 years ago committed by David Pursehouse
parent
commit
fe329f5db4
  1. 14
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

14
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

@ -652,7 +652,10 @@ public abstract class Repository implements AutoCloseable {
// detached // detached
name = Constants.HEAD; name = Constants.HEAD;
if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$ if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$
throw new RevisionSyntaxException(revstr); throw new RevisionSyntaxException(MessageFormat
.format(JGitText.get().invalidRefName,
name),
revstr);
Ref ref = getRef(name); Ref ref = getRef(name);
name = null; name = null;
if (ref == null) if (ref == null)
@ -702,7 +705,10 @@ public abstract class Repository implements AutoCloseable {
if (name.equals("")) //$NON-NLS-1$ if (name.equals("")) //$NON-NLS-1$
name = Constants.HEAD; name = Constants.HEAD;
if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$ if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$
throw new RevisionSyntaxException(revstr); throw new RevisionSyntaxException(MessageFormat
.format(JGitText.get().invalidRefName,
name),
revstr);
Ref ref = getRef(name); Ref ref = getRef(name);
name = null; name = null;
if (ref == null) if (ref == null)
@ -751,7 +757,9 @@ public abstract class Repository implements AutoCloseable {
return null; return null;
name = revstr.substring(done); name = revstr.substring(done);
if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$ if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$
throw new RevisionSyntaxException(revstr); throw new RevisionSyntaxException(
MessageFormat.format(JGitText.get().invalidRefName, name),
revstr);
if (getRef(name) != null) if (getRef(name) != null)
return name; return name;
return resolveSimple(name); return resolveSimple(name);

Loading…
Cancel
Save