Skip to content

Commit

Permalink
When a repository is freshly cloned and no other actions have been ta…
Browse files Browse the repository at this point in the history
…ken (like pull) ORIG_HEAD is not available. Using HEAD as a fallback works to find the committers.
  • Loading branch information
pstreef committed Jan 28, 2024
1 parent 9c715c7 commit 5d5709b
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,11 @@ private static EOL getEOF(Repository repository) {
private static List<Committer> getCommitters(Repository repository) {
try (Git git = Git.open(repository.getDirectory())) {
ObjectId head = repository.readOrigHead();
if(head == null) {
return emptyList();
if (head == null) {
head = repository.getRefDatabase().findRef("HEAD").getObjectId();
if (head == null) {
return emptyList();
}
}

Map<String, Committer> committers = new TreeMap<>();
Expand Down

0 comments on commit 5d5709b

Please sign in to comment.