@matheusbsbs / matheus-bagliano / commits / a94d9948da
Fork 0

update-index: work with c-quoted name

update-index --stdin did not work with c-style quoted names even though update-index --index-info did. This fixes the inconsistency. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Jan 11, 2006 at 13:36 UTC a94d9948da539fdafc26c74afb335b2fe9f8f21d
1 file changed +8 -1
update-index.c
+8 -1
@@ -534,10 +534,17 @@ int main(int argc, const char **argv)
534 struct strbuf buf;
535 strbuf_init(&buf);
536 while (1) {
537 + char *path_name;
538 read_line(&buf, stdin, line_termination);
539 if (buf.eof)
540 break;
540 - update_one(buf.buf, prefix, prefix_length);
541 + if (line_termination && buf.buf[0] == '"')
542 + path_name = unquote_c_style(buf.buf, NULL);
543 + else
544 + path_name = buf.buf;
545 + update_one(path_name, prefix, prefix_length);
546 + if (path_name != buf.buf)
547 + free(path_name);
548 }
549 }
550 if (active_cache_changed) {