Skip to content

Commit

Permalink
style: format
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelCurrin committed Aug 20, 2024
1 parent c7a33bb commit 65570d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/git/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async function _diffIndex(
"--find-renames",
"--find-copies",
"--no-color",
"-z",
...options,
"HEAD",
];
Expand All @@ -53,7 +54,7 @@ async function _diffIndex(
console.debug(`stderr for 'git ${cmd}' command:`, stderr);
}

const lines = stdout.split("\n");
const lines = stdout.split("\0");

return lines.filter(line => line !== "");
}
Expand Down
8 changes: 5 additions & 3 deletions src/git/parseOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ export function parseStatus(line: string): FileChange {
* than `undefined`).
*/
export function parseDiffIndex(line: string): FileChange {
// this was failing for some reason
// adding logging helps otherwise it is swallowed
if (line.length <= 4) {
throw new Error(
`Invalid input. Input string must be at least 4 characters. Got: '${line}'`,
);
const errorMsg = `Invalid input. Input string must be at least 4 characters. Got: '${line}'`;
console.error(errorMsg);
throw new Error(errorMsg);
}
const x = line[0];
const y = UNMODIFIED;
Expand Down

0 comments on commit 65570d4

Please sign in to comment.