Skip to content

Commit

Permalink
fix(git): fetch tags to ensure up-to-date git
Browse files Browse the repository at this point in the history
  • Loading branch information
Bender committed Sep 19, 2022
1 parent c447488 commit 3193d29
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/cli/shipit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ interface Props {

export const shipitHandler = async ({ gitEmail, gitUser, tagPrefix, failOnMissingCommit, forceBump, releaseBranchPrefix }: Props) => {
const git = simpleGit()
await git.pull()

const tags = await git.tags({ '--sort': '-creatordate' })
// Fetch tags to ensure we have the latest ones.
const tags = await git.fetch(['--tags']).tags({ '--sort': '-creatordate' })
const log = await git.log({ '--max-count': 20 })
const branch = await git.branch()
const [remote] = await git.getRemotes()
Expand All @@ -35,6 +35,7 @@ export const shipitHandler = async ({ gitEmail, gitUser, tagPrefix, failOnMissin
throw new Error('Latest commit was not found!')
}

// @TODO: Fetch all in case from is 0.0.0 (non-existent).
const commits = await git.log({
from: tags.latest,
to: latestCommit,
Expand All @@ -57,7 +58,7 @@ export const shipitHandler = async ({ gitEmail, gitUser, tagPrefix, failOnMissin

console.log('Bumps: ', bumps)

// Bump minor in case nothing is found.
// Bump patch in case nothing is found.
if (bumps.length < 1 && forceBump) {
console.log('Forcing patch bump!')
bumps.push(BumpType.Patch)
Expand Down

0 comments on commit 3193d29

Please sign in to comment.