Skip to content

Commit

Permalink
fix(changedPackages): allow getting changed packages without previous…
Browse files Browse the repository at this point in the history
… git tag

AFFECTS: northbrook
  • Loading branch information
TylorS committed Jan 21, 2017
1 parent 93f19f1 commit a4770de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/northbrook/changedPackages/changedPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export function changedPackages (
{
const rawCommits: Promise<Array<Commit>> =
gitLatestTag(cwd, io, latestTagSpawn)
.then(commitHash => gitRawCommits(commitHash, io, cwd, rawCommitsSpawn));
.then(commitHash => gitRawCommits(commitHash, io, cwd, rawCommitsSpawn))
.catch(() => gitRawCommits(void 0, io, cwd, rawCommitsSpawn));

return rawCommits.then(getAffectedPackages);
}
Expand Down
6 changes: 5 additions & 1 deletion src/northbrook/changedPackages/gitRawCommits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export function gitRawCommits(
_spawn = spawn): Promise<Array<Commit>>
{
const cmd = `git`;
const args = [`log`, `--format=${format}`, `${fromCommitHash}..HEAD`];
const args = [
`log`,
`--format=${format}`,
fromCommitHash !== void 0 ? `${fromCommitHash}..HEAD` : ``,
];

return execute(cmd, args, io, cwd, _spawn).then(({ stdout }) => {
const hashesAndMessages = stdout.split(separator);
Expand Down

0 comments on commit a4770de

Please sign in to comment.