Skip to content

Commit

Permalink
feat: log filtered commits in debug
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Jul 24, 2020
1 parent f62f0cf commit c64b8e1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/getCommitsFiltered.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const execa = require("execa");
const { check, ValueError } = require("./blork");
const getStream = require("get-stream");
const cleanPath = require("./cleanPath");
const debug = require("debug")("msr:commitsFilter");

/**
* Retrieve the list of commits on the current branch since the commit sha associated with the last release, or all the commits of the current branch if there is no last released version.
Expand Down Expand Up @@ -43,10 +44,8 @@ async function getCommitsFiltered(cwd, dir, lastHead = undefined, branch = "mast

// Use git-log-parser to get the commits.
const relpath = relative(root, dir);
const stream = gitLogParser.parse(
{ _: ["--first-parent", branch, lastHead ? `${lastHead}..HEAD` : "HEAD", "--", relpath] },
{ cwd, env: process.env }
);
const gitLogFilterQuery = ["--first-parent", branch, lastHead ? `${lastHead}..HEAD` : "HEAD", "--", relpath];
const stream = gitLogParser.parse({ _: gitLogFilterQuery }, { cwd, env: process.env });
const commits = await getStream.array(stream);

// Trim message and tags.
Expand All @@ -55,6 +54,9 @@ async function getCommitsFiltered(cwd, dir, lastHead = undefined, branch = "mast
commit.gitTags = commit.gitTags.trim();
});

debug("git log filter query: %o", gitLogFilterQuery);
debug("filtered commits: %O", commits);

// Return the commits.
return commits;
}
Expand Down

0 comments on commit c64b8e1

Please sign in to comment.