X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=ls-tree.c;h=d7c7e750fbf08363731e7bafdc6b2b1b058ccc38;hb=706fe6ae03e2c1452d59892944701c56237b903f;hp=dd642e0bf059cdf969d370fc1155fb189a0c89ce;hpb=0d0b7c237af0846123bef73879d65a3e78a56461;p=git.git diff --git a/ls-tree.c b/ls-tree.c index dd642e0b..d7c7e750 100644 --- a/ls-tree.c +++ b/ls-tree.c @@ -6,6 +6,7 @@ #include "cache.h" #include "blob.h" #include "tree.h" +#include "quote.h" static int line_termination = '\n'; #define LS_RECURSIVE 1 @@ -156,8 +157,11 @@ static int show_entry(struct tree_entry_list *e, int level, char *pathbuf) int err = 0; if (e != &root_entry) { - printf("%06o %s %s %s%s", e->mode, entry_type(e), - entry_hex(e), pathbuf, e->name); + int pathlen = strlen(pathbuf); + printf("%06o %s %s ", + e->mode, entry_type(e), entry_hex(e)); + write_name_quoted(pathbuf, pathlen, e->name, + line_termination, stdout); putchar(line_termination); }