Skip to content

Commit

Permalink
Sorting tags by committime, not committime formatted string
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Jan 31, 2016
1 parent 283c20a commit a9fc5a3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

Changelog of Git Changelog.

## Next release
### Other changes

[6b753199a81f9fb](https://github.com/tomasbjerre/git-changelog-lib/commit/6b753199a81f9fb) Tomas Bjerre *2016-01-31 10:30:01*

Sorting tags by committime, not committime formatted string

[283c20a3ae4b7b6](https://github.com/tomasbjerre/git-changelog-lib/commit/283c20a3ae4b7b6) Tomas Bjerre *2016-01-31 10:10:30*

Implementing toString on API mode objects

[e529afb2a911123](https://github.com/tomasbjerre/git-changelog-lib/commit/e529afb2a911123) Tomas Bjerre *2016-01-31 08:04:33*

Lgging exception in rest client


## 1.22
### Other changes

Expand Down
9 changes: 8 additions & 1 deletion src/main/java/se/bjurr/gitchangelog/api/model/Commit.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ public class Commit {
private final String authorName;
private final String authorEmailAddress;
private final String commitTime;
private final Long commitTimeLong;
private final String message;
private final String hash;

public Commit(String authorName, String authorEmailAddress, String commitTime, String message, String hash) {
public Commit(String authorName, String authorEmailAddress, String commitTime, Long commitTimeLong, String message,
String hash) {
this.authorName = checkNotNull(authorName, "authorName");
this.authorEmailAddress = checkNotNull(authorEmailAddress, "authorEmailAddress");
this.message = checkNotNull(message, "message").trim();
this.commitTime = checkNotNull(commitTime, "commitTime");
this.commitTimeLong = checkNotNull(commitTimeLong, "commitTimeLong");
this.hash = checkNotNull(hash, "hash");
}

Expand All @@ -33,6 +36,10 @@ public String getCommitTime() {
return commitTime;
}

public Long getCommitTimeLong() {
return commitTimeLong;
}

public String getMessage() {
return message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private List<Tag> order(Iterable<Tag> tags) {
return Ordering.from(new Comparator<Tag>() {
@Override
public int compare(Tag o1, Tag o2) {
return o2.getCommit().getCommitTime().compareTo(o1.getCommit().getCommitTime());
return o2.getCommit().getCommitTimeLong().compareTo(o1.getCommit().getCommitTimeLong());
}
}).sortedCopy(tags);
}
Expand Down Expand Up @@ -174,6 +174,7 @@ private Commit toCommit(GitCommit gitCommit) {
gitCommit.getAuthorName(), //
gitCommit.getAuthorEmailAddress(), //
format(gitCommit.getCommitTime()), //
gitCommit.getCommitTime().getTime(), //
toMessage(gitCommit.getMessage()), //
gitCommit.getHash());
}
Expand Down

0 comments on commit a9fc5a3

Please # to comment.