Skip to content

Commit d48d054

Browse files
committed
Use --stage instead of --format in git ls-files
1 parent 72c0b0e commit d48d054

11 files changed

+37
-33
lines changed

lib/analyze-action-post.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze-action.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/autobuild-action.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action-post.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/resolve-environment-action.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/setup-codeql-action.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/upload-lib.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/upload-sarif-action.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/git-utils.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,9 @@ test.serial("getFileOidsUnderPath returns correct file mapping", async (t) => {
347347
const runGitCommandStub = sinon
348348
.stub(gitUtils as any, "runGitCommand")
349349
.resolves(
350-
"30d998ded095371488be3a729eb61d86ed721a18_lib/git-utils.js\n" +
351-
"d89514599a9a99f22b4085766d40af7b99974827_lib/git-utils.js.map\n" +
352-
"a47c11f5bfdca7661942d2c8f1b7209fb0dfdf96_src/git-utils.ts",
350+
"100644 30d998ded095371488be3a729eb61d86ed721a18 0\tlib/git-utils.js\n" +
351+
"100644 d89514599a9a99f22b4085766d40af7b99974827 0\tlib/git-utils.js.map\n" +
352+
"100644 a47c11f5bfdca7661942d2c8f1b7209fb0dfdf96 0\tsrc/git-utils.ts",
353353
);
354354

355355
const result = await gitUtils.getFileOidsUnderPath("/fake/path");
@@ -362,7 +362,7 @@ test.serial("getFileOidsUnderPath returns correct file mapping", async (t) => {
362362

363363
t.deepEqual(runGitCommandStub.firstCall.args, [
364364
"/fake/path",
365-
["ls-files", "--recurse-submodules", "--format=%(objectname)_%(path)"],
365+
["ls-files", "--recurse-submodules", "--stage"],
366366
"Cannot list Git OIDs of tracked files.",
367367
]);
368368
});
@@ -371,9 +371,9 @@ test.serial("getFileOidsUnderPath handles quoted paths", async (t) => {
371371
sinon
372372
.stub(gitUtils as any, "runGitCommand")
373373
.resolves(
374-
"30d998ded095371488be3a729eb61d86ed721a18_lib/normal-file.js\n" +
375-
'd89514599a9a99f22b4085766d40af7b99974827_"lib/file with spaces.js"\n' +
376-
'a47c11f5bfdca7661942d2c8f1b7209fb0dfdf96_"lib/file\\twith\\ttabs.js"',
374+
"100644 30d998ded095371488be3a729eb61d86ed721a18 0\tlib/normal-file.js\n" +
375+
'100644 d89514599a9a99f22b4085766d40af7b99974827 0\t"lib/file with spaces.js"\n' +
376+
'100644 a47c11f5bfdca7661942d2c8f1b7209fb0dfdf96 0\t"lib/file\\twith\\ttabs.js"',
377377
);
378378

379379
const result = await gitUtils.getFileOidsUnderPath("/fake/path");
@@ -398,9 +398,9 @@ test.serial(
398398
sinon
399399
.stub(gitUtils as any, "runGitCommand")
400400
.resolves(
401-
"30d998ded095371488be3a729eb61d86ed721a18_lib/git-utils.js\n" +
401+
"100644 30d998ded095371488be3a729eb61d86ed721a18 0\tlib/git-utils.js\n" +
402402
"invalid-line-format\n" +
403-
"a47c11f5bfdca7661942d2c8f1b7209fb0dfdf96_src/git-utils.ts",
403+
"100644 a47c11f5bfdca7661942d2c8f1b7209fb0dfdf96 0\tsrc/git-utils.ts",
404404
);
405405

406406
await t.throwsAsync(

0 commit comments

Comments
 (0)