| | |
| | | }
|
| | |
|
| | | /**
|
| | | * Retrieves a Java Date from a Git commit.
|
| | | * |
| | | * @param commit
|
| | | * @return date of the commit or Date(0) if the commit is null
|
| | | */
|
| | | public static Date getAuthorDate(RevCommit commit) {
|
| | | if (commit == null) {
|
| | | return new Date(0);
|
| | | }
|
| | | return commit.getAuthorIdent().getWhen();
|
| | | }
|
| | |
|
| | | /**
|
| | | * Returns the specified commit from the repository. If the repository does
|
| | | * not exist or is empty, null is returned.
|
| | | *
|
| | |
| | |
|
| | | RevWalk rw = new RevWalk(repository);
|
| | | rw.markStart(rw.parseCommit(endRange));
|
| | | rw.markUninteresting(rw.parseCommit(startRange));
|
| | | if (startRange.equals(ObjectId.zeroId())) {
|
| | | // maybe this is a tag or an orphan branch
|
| | | list.add(rw.parseCommit(endRange));
|
| | | rw.dispose();
|
| | | return list;
|
| | | } else {
|
| | | rw.markUninteresting(rw.parseCommit(startRange));
|
| | | }
|
| | |
|
| | | Iterable<RevCommit> revlog = rw;
|
| | | for (RevCommit rev : revlog) {
|