quote.c: substitute path_relative with relative_path
[gitweb.git] / builtin / ls-files.c
index 22020729cbc35dc5fe11d2a3194fe5994fe67ff9..67e3713cd331dd878f579400c17964ce4c31e9ce 100644 (file)
@@ -48,8 +48,13 @@ static const char *tag_resolve_undo = "";
 
 static void write_name(const char* name, size_t len)
 {
-       write_name_quoted_relative(name, len, prefix, prefix_len, stdout,
-                       line_terminator);
+       /*
+        * With "--full-name", prefix_len=0; write_name_quoted_relative()
+        * ignores prefix_len, so this caller needs to pass empty string
+        * in that case (a NULL is good for "").
+        */
+       write_name_quoted_relative(name, len, prefix_len ? prefix : NULL,
+                       prefix_len, stdout, line_terminator);
 }
 
 static void show_dir_entry(const char *tag, struct dir_entry *ent)