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>
This commit is contained in:
Jonathan Nieder 2010-12-11 17:08:51 -06:00
parent e435811208
commit 1ae469b06c

View File

@ -34,10 +34,9 @@ void fast_export_reset(void)
void fast_export_delete(uint32_t depth, const uint32_t *path) void fast_export_delete(uint32_t depth, const uint32_t *path)
{ {
putchar('D'); printf("D \"");
putchar(' '); pool_print_seq_q(depth, path, '/', stdout);
pool_print_seq(depth, path, '/', stdout); printf("\"\n");
putchar('\n');
} }
static void fast_export_truncate(uint32_t depth, const uint32_t *path, uint32_t mode) 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,
fast_export_truncate(depth, path, mode); fast_export_truncate(depth, path, mode);
return; return;
} }
printf("M %06"PRIo32" %s ", mode, dataref); printf("M %06"PRIo32" %s \"", mode, dataref);
pool_print_seq(depth, path, '/', stdout); pool_print_seq_q(depth, path, '/', stdout);
putchar('\n'); printf("\"\n");
} }
static char gitsvnline[MAX_GITSVN_LINE_LEN]; static char gitsvnline[MAX_GITSVN_LINE_LEN];
@ -97,9 +96,9 @@ void fast_export_end_commit(uint32_t revision)
static void ls_from_rev(uint32_t rev, uint32_t depth, const uint32_t *path) static void ls_from_rev(uint32_t rev, uint32_t depth, const uint32_t *path)
{ {
/* ls :5 path/to/old/file */ /* ls :5 path/to/old/file */
printf("ls :%"PRIu32" ", rev); printf("ls :%"PRIu32" \"", rev);
pool_print_seq(depth, path, '/', stdout); pool_print_seq_q(depth, path, '/', stdout);
putchar('\n'); printf("\"\n");
fflush(stdout); fflush(stdout);
} }