Skip to content

Commit

Permalink
Merge pull request #1262 from 10hendersonm/1261-determineNextVersion_…
Browse files Browse the repository at this point in the history
…optional_args

fix(git): Prevents getLastTagNotInBaseBranch from returning a commit hash
  • Loading branch information
hipstersmoothie authored May 28, 2020
2 parents 7c99241 + 3f87c8a commit fd3e10d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
8 changes: 0 additions & 8 deletions packages/core/src/__tests__/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,6 @@ describe("github", () => {
});

describe("getTagNotInBaseBranch", () => {
test("works with no tags, defaults to first commit", async () => {
const gh = new Git(options);
gh.getTags = () => Promise.resolve([]);
expect(await gh.getTagNotInBaseBranch("branch")).toBe(
"0b2af75d8b55c8869cda93d0e5589ad9f2677e18"
);
});

test("finds greatest tag not in base branch", async () => {
const gh = new Git(options);

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,9 @@ export default class Auto {
const initialForkCommit = (forkPoints[forkPoints.length - 1] || "").slice(1);
const lastRelease =
initialForkCommit || (await this.git.getLatestRelease());
const lastTag = await this.git.getLastTagNotInBaseBranch(currentBranch!);
const lastTag =
(await this.git.getLastTagNotInBaseBranch(currentBranch!)) ||
(await this.git.getFirstCommit());
const fullReleaseNotes = await this.release.generateReleaseNotes(
lastRelease
);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,10 @@ export default class Git {
this.logger.verbose.info("Tags found in branch:", branchTags);
this.logger.verbose.info(
`${options.first ? "First" : "Latest"} tag in branch:`,
firstGreatestUnique
firstGreatestUnique || "Not Found"
);

return firstGreatestUnique || this.getFirstCommit();
return firstGreatestUnique;
}

/** Get the last tag that isn't in the base branch */
Expand Down

0 comments on commit fd3e10d

Please sign in to comment.