Browse Source

RepoCommand: Skip RemoteReader when encountering a full SHA-1

There is no point in calling back to the RemoteReader to resolve a
40-digit hex SHA-1 to itself.  We already skip that call when not
ignoring remote failures; skip it when ignoring remote failures, too.

This should simplify RemoteReader implementations.

Reported-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I7566968ed1f39b1ad73574fa903faf3ee308eb87
stable-4.10
Jonathan Nieder 7 years ago
parent
commit
04b8168beb
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

3
org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

@ -534,8 +534,7 @@ public class RepoCommand extends GitCommand<RevCommit> {
String path = proj.getPath(); String path = proj.getPath();
String nameUri = proj.getName(); String nameUri = proj.getName();
ObjectId objectId; ObjectId objectId;
if (ObjectId.isId(proj.getRevision()) if (ObjectId.isId(proj.getRevision())) {
&& !ignoreRemoteFailures) {
objectId = ObjectId.fromString(proj.getRevision()); objectId = ObjectId.fromString(proj.getRevision());
} else { } else {
objectId = callback.sha1(nameUri, proj.getRevision()); objectId = callback.sha1(nameUri, proj.getRevision());

Loading…
Cancel
Save