Browse Source

Remove deprecated Repository#getRef

Use Repository#exactRef(String) or Repository#findRef(String) instead.

Change-Id: I5c547a26604b4cd792111c699df5f3c9d955d3f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.0
Matthias Sohn 7 years ago
parent
commit
e1cfe09bfa
  1. 26
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

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

@ -486,7 +486,7 @@ public abstract class Repository implements AutoCloseable {
try (RevWalk rw = new RevWalk(this)) { try (RevWalk rw = new RevWalk(this)) {
Object resolved = resolve(rw, revstr); Object resolved = resolve(rw, revstr);
if (resolved instanceof String) { if (resolved instanceof String) {
final Ref ref = getRef((String)resolved); final Ref ref = findRef((String) resolved);
return ref != null ? ref.getLeaf().getObjectId() : null; return ref != null ? ref.getLeaf().getObjectId() : null;
} else { } else {
return (ObjectId) resolved; return (ObjectId) resolved;
@ -709,7 +709,7 @@ public abstract class Repository implements AutoCloseable {
.format(JGitText.get().invalidRefName, .format(JGitText.get().invalidRefName,
name), name),
revstr); revstr);
Ref ref = getRef(name); Ref ref = findRef(name);
name = null; name = null;
if (ref == null) if (ref == null)
return null; return null;
@ -762,7 +762,7 @@ public abstract class Repository implements AutoCloseable {
.format(JGitText.get().invalidRefName, .format(JGitText.get().invalidRefName,
name), name),
revstr); revstr);
Ref ref = getRef(name); Ref ref = findRef(name);
name = null; name = null;
if (ref == null) if (ref == null)
return null; return null;
@ -813,7 +813,7 @@ public abstract class Repository implements AutoCloseable {
throw new RevisionSyntaxException( throw new RevisionSyntaxException(
MessageFormat.format(JGitText.get().invalidRefName, name), MessageFormat.format(JGitText.get().invalidRefName, name),
revstr); revstr);
if (getRef(name) != null) if (findRef(name) != null)
return name; return name;
return resolveSimple(name); return resolveSimple(name);
} }
@ -1053,24 +1053,6 @@ public abstract class Repository implements AutoCloseable {
return Collections.emptySet(); return Collections.emptySet();
} }
/**
* Get a ref by name.
*
* @param name
* the name of the ref to lookup. May be a short-hand form, e.g.
* "master" which is is automatically expanded to
* "refs/heads/master" if "refs/heads/master" already exists.
* @return the Ref with the given name, or {@code null} if it does not exist
* @throws java.io.IOException
* @deprecated Use {@link #exactRef(String)} or {@link #findRef(String)}
* instead.
*/
@Deprecated
@Nullable
public Ref getRef(final String name) throws IOException {
return findRef(name);
}
/** /**
* Get a ref by name. * Get a ref by name.
* *

Loading…
Cancel
Save