Skip to content

Commit 110fe70

Browse files
committed
feat: log filtered commits in debug
relates #29
1 parent 6930cb6 commit 110fe70

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/getCommitsFiltered.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const execa = require("execa");
44
const { check, ValueError } = require("./blork");
55
const getStream = require("get-stream");
66
const cleanPath = require("./cleanPath");
7+
const debug = require("debug")("msr:commitsFilter");
78

89
/**
910
* 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.
@@ -43,10 +44,8 @@ async function getCommitsFiltered(cwd, dir, lastHead = undefined, branch = "mast
4344

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

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

57+
debug("git log filter query: %o", gitLogFilterQuery);
58+
debug("filtered commits: %O", commits);
59+
5860
// Return the commits.
5961
return commits;
6062
}

0 commit comments

Comments
 (0)