vcs-svn: handle filenames with dq correctly
Quote paths passed to fast-import so filenames with double quotes are not misinterpreted. One might imagine this could help with filenames with newlines, too, but svn does not allow those. Helped-by: David Barr <daivd.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Jonathan Nieder committed
Dec 11, 2010 at 17:08 UTC
1ae469b06c50aade4781931ca1587453082f57eb
1 file changed
+9
-10
vcs-svn/fast_export.c
+9
-10
@@ -34,10 +34,9 @@ void fast_export_reset(void)
34
35
void fast_export_delete(uint32_t depth, const uint32_t *path)
36
{
37
- putchar('D');
38
- putchar(' ');
39
- pool_print_seq(depth, path, '/', stdout);
40
- putchar('\n');
37
+ printf("D \"");
38
+ pool_print_seq_q(depth, path, '/', stdout);
39
+ printf("\"\n");
40
}
41
42
static void fast_export_truncate(uint32_t depth, const uint32_t *path, uint32_t mode)
@@ -54,9 +53,9 @@ void fast_export_modify(uint32_t depth, const uint32_t *path, uint32_t mode,
53
fast_export_truncate(depth, path, mode);
54
return;
55
}
57
- printf("M %06"PRIo32" %s ", mode, dataref);
58
- pool_print_seq(depth, path, '/', stdout);
59
- putchar('\n');
56
+ printf("M %06"PRIo32" %s \"", mode, dataref);
57
+ pool_print_seq_q(depth, path, '/', stdout);
58
+ printf("\"\n");
59
}
60
61
static char gitsvnline[MAX_GITSVN_LINE_LEN];
@@ -97,9 +96,9 @@ void fast_export_end_commit(uint32_t revision)
96
static void ls_from_rev(uint32_t rev, uint32_t depth, const uint32_t *path)
97
{
98
/* ls :5 path/to/old/file */
100
- printf("ls :%"PRIu32" ", rev);
101
- pool_print_seq(depth, path, '/', stdout);
102
- putchar('\n');
99
+ printf("ls :%"PRIu32" \"", rev);
100
+ pool_print_seq_q(depth, path, '/', stdout);
101
+ printf("\"\n");
102
fflush(stdout);
103
}
104