Skip to content

Commit 89a0e7d

Browse files
AndreiIurkoAndreiIurko
authored andcommitted
🐛 QD-12042 Remove command and arguments from output of git
1 parent 4245f9f commit 89a0e7d

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

vsts/QodanaScan/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79643,7 +79643,9 @@ var require_utils4 = __commonJS({
7964379643
tl2.warning(`Failed to run git command with arguments: ${args.join(" ")}`);
7964479644
throw error;
7964579645
});
79646-
result2.stdout = result2.stdout.replace("[command]/usr/bin/git " + args.join(" "), "").trim();
79646+
if (result2.stdout.startsWith("[command]")) {
79647+
result2.stdout.slice(result2.stdout.indexOf(" ") + 1).replace(args.join(" "), "").trim();
79648+
}
7964779649
return result2;
7964879650
});
7964979651
}

vsts/src/utils.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,14 @@ async function gitOutput(
273273
tl.warning(`Failed to run git command with arguments: ${args.join(' ')}`)
274274
throw error
275275
})
276-
result.stdout = result.stdout
277-
.replace('[command]/usr/bin/git ' + args.join(' '), '')
278-
.trim()
276+
if (result.stdout.startsWith('[command]')) {
277+
result.stdout
278+
// remove [command]/path/to/executable from output
279+
.slice(result.stdout.indexOf(' ') + 1)
280+
// remove arguments from output
281+
.replace(args.join(' '), '')
282+
.trim()
283+
}
279284
return result
280285
}
281286

0 commit comments

Comments
 (0)