Skip to content

Commit b1c090b

Browse files
committed
refactor: update cli.ts
1 parent a0ab292 commit b1c090b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/git/cli.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { Repository } from "../api/git";
99

1010
const exec = util.promisify(_exec);
1111

12+
// Ensure Git will show special characters literally without quoting the string and escaping characters.
13+
const QUOTE_PATH = "-c 'core.quotePath=false'"
14+
1215
const DIFF_INDEX_CMD = "diff-index";
1316
const DIFF_INDEX_OPTIONS = [
1417
"--name-status",
@@ -21,7 +24,7 @@ const DIFF_INDEX_OPTIONS = [
2124
* Run a `git` subcommand and return the result, with stdout and stderr available.
2225
*/
2326
function _execute(cwd: string, subcommand: string, options: string[] = []) {
24-
const command = `git -c 'core.quotePath=false' ${subcommand} ${options.join(" ")}`;
27+
const command = `git ${QUOTE_PATH} ${subcommand} ${options.join(" ")}`;
2528

2629
console.debug(`Running command: ${command}, cwd: ${cwd}`);
2730

0 commit comments

Comments
 (0)