summaryrefslogtreecommitdiff
path: root/vcs-svn
diff options
context:
space:
mode:
authorDavid Barr <david.barr@cordelta.com>2010-12-11 16:59:31 (GMT)
committerJonathan Nieder <jrnieder@gmail.com>2011-03-07 07:43:58 (GMT)
commite43581120843f6f55f411af470faf806e052ad9d (patch)
tree653228b3955cc33b3c3ed44388a5fd58899af11d /vcs-svn
parent723b7a2789d66c1365390cc9b9213e34ab8513d7 (diff)
downloadgit-e43581120843f6f55f411af470faf806e052ad9d.zip
git-e43581120843f6f55f411af470faf806e052ad9d.tar.gz
git-e43581120843f6f55f411af470faf806e052ad9d.tar.bz2
vcs-svn: quote paths correctly for ls command
This bug was found while importing rev 601865 of ASF. [jn: with test] Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 'vcs-svn')
-rw-r--r--vcs-svn/fast_export.c2
-rw-r--r--vcs-svn/string_pool.c11
-rw-r--r--vcs-svn/string_pool.h1
3 files changed, 13 insertions, 1 deletions
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index a8ce5c6..4d57efa 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -107,7 +107,7 @@ static void ls_from_active_commit(uint32_t depth, const uint32_t *path)
{
/* ls "path/to/file" */
printf("ls \"");
- pool_print_seq(depth, path, '/', stdout);
+ pool_print_seq_q(depth, path, '/', stdout);
printf("\"\n");
fflush(stdout);
}
diff --git a/vcs-svn/string_pool.c b/vcs-svn/string_pool.c
index c08abac..be43598 100644
--- a/vcs-svn/string_pool.c
+++ b/vcs-svn/string_pool.c
@@ -4,6 +4,7 @@
*/
#include "git-compat-util.h"
+#include "quote.h"
#include "trp.h"
#include "obj_pool.h"
#include "string_pool.h"
@@ -75,6 +76,16 @@ void pool_print_seq(uint32_t len, const uint32_t *seq, char delim, FILE *stream)
}
}
+void pool_print_seq_q(uint32_t len, const uint32_t *seq, char delim, FILE *stream)
+{
+ uint32_t i;
+ for (i = 0; i < len && ~seq[i]; i++) {
+ quote_c_style(pool_fetch(seq[i]), NULL, stream, 1);
+ if (i < len - 1 && ~seq[i + 1])
+ fputc(delim, stream);
+ }
+}
+
uint32_t pool_tok_seq(uint32_t sz, uint32_t *seq, const char *delim, char *str)
{
char *context = NULL;
diff --git a/vcs-svn/string_pool.h b/vcs-svn/string_pool.h
index 3720cf8..96e501d 100644
--- a/vcs-svn/string_pool.h
+++ b/vcs-svn/string_pool.h
@@ -5,6 +5,7 @@ uint32_t pool_intern(const char *key);
const char *pool_fetch(uint32_t entry);
uint32_t pool_tok_r(char *str, const char *delim, char **saveptr);
void pool_print_seq(uint32_t len, const uint32_t *seq, char delim, FILE *stream);
+void pool_print_seq_q(uint32_t len, const uint32_t *seq, char delim, FILE *stream);
uint32_t pool_tok_seq(uint32_t sz, uint32_t *seq, const char *delim, char *str);
void pool_reset(void);