Skip to content

Commit 1de4005

Browse files
author
Simon Renoult
committed
refactor: make git command easier to read
1 parent d4ca525 commit 1de4005

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/count-commits-per-file.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,18 @@ function assertIsGitRootDirectory(directory: string): void {
5353
}
5454

5555
function buildCommand(directory, { firstParent, since }): string {
56-
const firstParentFlag = firstParent ? "--first-parent" : "";
57-
const sinceParameter = since ? `--since="${since}"` : "";
5856
return [
59-
`git -C ${directory} log ${sinceParameter} ${firstParentFlag} --name-only --format='' '*.[tj]s'`,
57+
[
58+
"git",
59+
`-C ${directory}`,
60+
`log`,
61+
`--follow`,
62+
`--name-only`,
63+
`--format=''`,
64+
since ? `--since="${since}"` : "",
65+
firstParent ? "--first-parent" : "",
66+
"'*.[tj]s'"
67+
].join(" "),
6068
"sort",
6169
"uniq --count"
6270
].join(" | ");

0 commit comments

Comments
 (0)