Merge branch 'js/fast-export-paths-with-spaces' into maint
authorJunio C Hamano <gitster@pobox.com>
Sun, 22 Jul 2012 20:00:45 +0000 (13:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 22 Jul 2012 20:00:45 +0000 (13:00 -0700)
"git fast-export" produced an input stream for fast-import without
properly quoting pathnames when they contain SPs in them.

* js/fast-export-paths-with-spaces:
fast-export: quote paths with spaces

builtin/fast-export.c
t/t9350-fast-export.sh
index ef7c0120949c4ce1667c9d1d8e74a9c63c8adc02..9ab6db3fb042d0cb7ee3a1919788b9a6cd26a3d6 100644 (file)
@@ -185,6 +185,8 @@ static void print_path(const char *path)
        int need_quote = quote_c_style(path, NULL, NULL, 0);
        if (need_quote)
                quote_c_style(path, NULL, stdout, 0);
+       else if (strchr(path, ' '))
+               printf("\"%s\"", path);
        else
                printf("%s", path);
 }
index 77447b70f4020a456f2ba3cac154cedf9162dea6..3e821f958bf10afc739e014ed854254a625affd9 100755 (executable)
@@ -430,7 +430,7 @@ test_expect_success 'fast-export quotes pathnames' '
         git commit -m rename &&
         git read-tree --empty &&
         git commit -m deletion &&
-        git fast-export HEAD >export.out &&
+        git fast-export -M HEAD >export.out &&
         git rev-list HEAD >expect &&
         git init result &&
         cd result &&