sparse-checkout: use C-style quotes in 'list' subcommand

When in cone mode, the 'git sparse-checkout list' subcommand lists
the directories included in the sparse cone. When these directories
contain odd characters, such as a backslash, then we need to use
C-style quotes similar to 'git ls-tree'.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Derrick Stolee
2020-01-31 20:16:12 +00:00
committed by Junio C Hamano
parent bd64de42de
commit e55682ea26
2 changed files with 9 additions and 4 deletions

View File

@ -78,8 +78,10 @@ static int sparse_checkout_list(int argc, const char **argv)
string_list_sort(&sl);
for (i = 0; i < sl.nr; i++)
printf("%s\n", sl.items[i].string);
for (i = 0; i < sl.nr; i++) {
quote_c_style(sl.items[i].string, NULL, stdout, 0);
printf("\n");
}
return 0;
}