get date and author
This commit is contained in:
parent
199e9a7eb1
commit
7b8c22b410
@ -7,8 +7,11 @@ public class Commit {
|
||||
private Date date;
|
||||
private String author;
|
||||
|
||||
public Commit(String message) {
|
||||
public Commit(String message, String author, Date date) {
|
||||
this.message = message;
|
||||
this.author = author;
|
||||
this.date = date;
|
||||
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
|
@ -11,7 +11,9 @@ import org.springframework.stereotype.Service;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.logging.log4j.util.Strings.isBlank;
|
||||
@ -68,7 +70,10 @@ public class GitRepositoryService {
|
||||
|
||||
List<Commit> list = new ArrayList<>();
|
||||
for (RevCommit commit : commits) {
|
||||
Commit fullMessage = new Commit(commit.getFullMessage());
|
||||
Commit fullMessage = new Commit(
|
||||
commit.getFullMessage(),
|
||||
commit.getAuthorIdent().getName(),
|
||||
Date.from(Instant.ofEpochSecond(commit.getCommitTime())));
|
||||
list.add(fullMessage);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user