Skip to content

Commit 1ae469b

Browse files
committed
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 <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: David Barr <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]>
1 parent e435811 commit 1ae469b

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

vcs-svn/fast_export.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ void fast_export_reset(void)
3434

3535
void fast_export_delete(uint32_t depth, const uint32_t *path)
3636
{
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");
4140
}
4241

4342
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,
5453
fast_export_truncate(depth, path, mode);
5554
return;
5655
}
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");
6059
}
6160

6261
static char gitsvnline[MAX_GITSVN_LINE_LEN];
@@ -97,9 +96,9 @@ void fast_export_end_commit(uint32_t revision)
9796
static void ls_from_rev(uint32_t rev, uint32_t depth, const uint32_t *path)
9897
{
9998
/* 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");
103102
fflush(stdout);
104103
}
105104

0 commit comments

Comments
 (0)