Skip to content

Commit

Permalink
chore: Fix tests.
Browse files Browse the repository at this point in the history
Closes #17
  • Loading branch information
joberstein committed Jul 30, 2023
1 parent 5ea835f commit 188e106
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
1 change: 0 additions & 1 deletion dist/events/gitEvent.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/events/gitEvent.test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions dist/events/push.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/events/push.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/events/gitEvent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe("src/events/gitEvent", () => {

it("Validates a git event with no target ref", async () => {
const event = new GitEvent({ target: '' }, options);
console.log(execSync('git log', options).toString());

await expect(event.validateCommits()).resolves.not.toThrow();

Expand Down
10 changes: 7 additions & 3 deletions src/events/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@ export default class Push extends GitEvent {
const { ref } = this.#args;
const { options } = this;

const refsToExclude = execSync(`git for-each-ref --format="%(refname)" refs/heads`, options)
const refs = execSync(`git for-each-ref --format="%(refname)" refs/heads`, options)
.toString()
.trim()
.split('\n')
.split('\n');

console.log(refs);

const refsToExclude = refs
.filter(seenRef => ref !== seenRef)
.join(' ');

const [commit, ] = execSync(`git rev-list --no-merges --not '${refsToExclude}' '${ref}'`, options)
const [commit, ] = execSync(`git rev-list --no-merges '${ref}' --not ${refsToExclude}`, options)
.toString()
.trim()
.split('\n')
Expand Down

0 comments on commit 188e106

Please sign in to comment.