Skip to content

Commit

Permalink
Changing master reference constan, to just master
Browse files Browse the repository at this point in the history
 * refs/heads/master may not exist, perhaps its refs/remotes/origin/master
  • Loading branch information
tomasbjerre committed Nov 21, 2015
1 parent 8c95fd4 commit c655cbd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

Changelog of Git Changelog.

## Next release
### Other changes

[6031f794be34eb8](https://github.com/tomasbjerre/git-changelog-lib/commit/6031f794be34eb8) Tomas Bjerre *2015-11-21 15:35:14*

Changing master reference constan, to just master

* refs/heads/master may not exist, perhaps its refs/remotes/origin/master

[8c95fd4870872d4](https://github.com/tomasbjerre/git-changelog-lib/commit/8c95fd4870872d4) Tomas Bjerre *2015-11-21 14:24:35*

doc


## 1.10
### Other changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public final class GitChangelogApiConstants {

public static final String ZERO_COMMIT = "0000000000000000000000000000000000000000";
public static final String REF_MASTER = "refs/heads/master";
public static final String REF_MASTER = "master";
public static final String DEFAULT_FILE = "git-changelog-settings.json";
public static final boolean DEFAULT_REMOVE_ISSUE = true;
public static final String DEFAULT_TIMEZONE = "UTC";
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/se/bjurr/gitchangelog/api/FakeGitRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public String apply(GitCommit input) {
}

@Override
public ObjectId getRef(String fromRef) {
if (fromRef.equals("refs/heads/master")) {
public ObjectId getRef(String ref) {
if (ref.endsWith("master")) {
return fromString(commits.get(0).getHash());
}
Map<String, GitTag> tagsMap = uniqueIndex(tags, new Function<GitTag, String>() {
Expand All @@ -65,8 +65,8 @@ public String apply(GitTag input) {
return input.getGitCommit().getHash();
}
});
return fromString(checkNotNull(tagsMap.get(fromRef),
"Not found: " + fromRef + " in:\n" + on("\n").join(tagsMap.keySet())).getGitCommit().getHash());
return fromString(checkNotNull(tagsMap.get(ref), "Not found: " + ref + " in:\n" + on("\n").join(tagsMap.keySet()))
.getGitCommit().getHash());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static org.junit.Assert.assertEquals;
import static se.bjurr.gitchangelog.api.GitChangelogApi.gitChangelogApiBuilder;
import static se.bjurr.gitchangelog.api.GitChangelogApi.setFakeGitRepo;
import static se.bjurr.gitchangelog.api.GitChangelogApiConstants.REF_MASTER;
import static se.bjurr.gitchangelog.api.GitChangelogApiConstants.ZERO_COMMIT;
import static se.bjurr.gitchangelog.main.Main.PARAM_OUTPUT_STDOUT;
import static se.bjurr.gitchangelog.main.Main.PARAM_SETTINGS_FILE;
Expand Down Expand Up @@ -60,7 +61,7 @@ public void rendersTo(String file) throws Exception {
gitChangelogApiBuilder()
.withFromRepo(".")
.withFromCommit(ZERO_COMMIT)
.withToRef("refs/heads/master")
.withToRef(REF_MASTER)
.withIgnoreCommitsWithMesssage("^\\[maven-release-plugin\\].*|^\\[Gradle Release Plugin\\].*|^Merge.*")
.withReadableTagName("/([^/]+?)$")
.withDateFormat("YYYY-MM-dd HH:mm:ss")
Expand Down

0 comments on commit c655cbd

Please # to comment.