Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/main/java/jenkins/plugins/git/GitSCMFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
Expand Down Expand Up @@ -115,7 +116,17 @@
cacheEntry = AbstractGitSCMSource.getCacheEntry(remote);
listener = new LogTaskListener(LOGGER, Level.FINER);
this.client = client;
commitId = rev == null ? invoke((Repository repository) -> repository.findRef(head).getObjectId()) : ObjectId.fromString(rev.getHash());
if (rev == null) {
commitId = invoke((Repository repository) -> {
Ref ref = repository.findRef(head);
if (ref == null) {

Check warning on line 122 in src/main/java/jenkins/plugins/git/GitSCMFileSystem.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 122 is only partially covered, one branch is missing
throw new IOException("Expected ref " + head + " was not created by preceding git fetch");

Check warning on line 123 in src/main/java/jenkins/plugins/git/GitSCMFileSystem.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 123 is not covered by tests
}
return repository.findRef(head).getObjectId();
});
} else {
commitId = ObjectId.fromString(rev.getHash());
}
}

@Override
Expand Down
Loading