Skip to content

Commit e7fbbc7

Browse files
committed
fix: update input validation in parseStatus and parseDiffIndex functions
1 parent fd325a6 commit e7fbbc7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/git/parseOutput.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const GIT_STATUS_SPLIT = " -> ";
1717
* Parse a line which was produced by the `git status --short` command.
1818
*/
1919
export function parseStatus(line: string): FileChange {
20-
if (line.length <= 4) {
20+
if (line.length < 4) {
2121
throw new Error(
2222
`Input string must be at least 4 characters. Got: '${line}'`,
2323
);
@@ -54,7 +54,7 @@ export function parseStatus(line: string): FileChange {
5454
* than `undefined`).
5555
*/
5656
export function parseDiffIndex(line: string): FileChange {
57-
if (line.length <= 4) {
57+
if (line.length < 4) {
5858
const errorMsg = `Invalid input. Input string must be at least 4 characters. Got: '${line}'`;
5959
console.error(errorMsg);
6060
throw new Error(errorMsg);

0 commit comments

Comments
 (0)