-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Labels
Description
I noticed this as VSCode gives an error when staging only selected changes.
For this, VSCode calls git hash-object
and continues to use the output of this command.
Natively, git hash-object
yields a single string, e.g. "b7a2640fdd1d5ead24cc6340275b849e801bf6fe"
(no ending newline).
However, the output of wslgit hash-object
for the same file will be "b7a2640fdd1d5ead24cc6340275b849e801bf6fe\n"
(with ending newline).
This then leads to the error in VSCode.
Reason is line 98-100 where the git output is split into lines, translated, and then printed out (via println
).
If the original git output is only a single line without newline character, wslgit will still add a newline character due to println
As a Rust noob, I quick-fixed it with
let output_list: Vec<String> = output_str.lines().map(translate_path_to_win).collect();
print!("{}", output_list.join("\n"));