svndump_read takes a url parameter that is used in git-svn-id: lines generation. Internally it is stored in dump_ctx which is initialized in svndump_init with reset_dump_ctx and then is reinitialized again in svndump_read. Move url parameter to svndump_init so that reset_dump_ctx is done once per dump and in the same place as other resets. More parameters will arise and all will go to svndump_init to setup the module for dumping. Signed-off-by: Dmitry Ivankov <divanorama@xxxxxxxxx> --- contrib/svn-fe/svn-fe.c | 4 ++-- test-svn-fe.c | 4 ++-- vcs-svn/svndump.c | 7 +++---- vcs-svn/svndump.h | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/contrib/svn-fe/svn-fe.c b/contrib/svn-fe/svn-fe.c index 35db24f..11d7128 100644 --- a/contrib/svn-fe/svn-fe.c +++ b/contrib/svn-fe/svn-fe.c @@ -8,9 +8,9 @@ int main(int argc, char **argv) { - if (svndump_init(NULL)) + if (svndump_init(NULL, (argc > 1) ? argv[1] : NULL)) return 1; - svndump_read((argc > 1) ? argv[1] : NULL); + svndump_read(); svndump_deinit(); svndump_reset(); return 0; diff --git a/test-svn-fe.c b/test-svn-fe.c index 332a5f7..3ee5559 100644 --- a/test-svn-fe.c +++ b/test-svn-fe.c @@ -40,9 +40,9 @@ static int apply_delta(int argc, char *argv[]) int main(int argc, char *argv[]) { if (argc == 2) { - if (svndump_init(argv[1])) + if (svndump_init(argv[1], NULL)) return 1; - svndump_read(NULL); + svndump_read(); svndump_deinit(); svndump_reset(); return 0; diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c index b1f4161..a88d392 100644 --- a/vcs-svn/svndump.c +++ b/vcs-svn/svndump.c @@ -313,14 +313,13 @@ static void end_revision(void) fast_export_end_commit(rev_ctx.revision); } -void svndump_read(const char *url) +void svndump_read(void) { char *val; char *t; uint32_t active_ctx = DUMP_CTX; uint32_t len; - reset_dump_ctx(url); while ((t = buffer_read_line(&input))) { val = strchr(t, ':'); if (!val) @@ -455,7 +454,7 @@ void svndump_read(const char *url) end_revision(); } -int svndump_init(const char *filename) +int svndump_init(const char *filename, const char *url) { if (buffer_init(&input, filename)) return error("cannot open %s: %s", filename, strerror(errno)); @@ -466,7 +465,7 @@ int svndump_init(const char *filename) strbuf_init(&rev_ctx.author, 4096); strbuf_init(&node_ctx.src, 4096); strbuf_init(&node_ctx.dst, 4096); - reset_dump_ctx(NULL); + reset_dump_ctx(url); reset_rev_ctx(0); reset_node_ctx(NULL); return 0; diff --git a/vcs-svn/svndump.h b/vcs-svn/svndump.h index df9ceb0..1bcaab6 100644 --- a/vcs-svn/svndump.h +++ b/vcs-svn/svndump.h @@ -1,8 +1,8 @@ #ifndef SVNDUMP_H_ #define SVNDUMP_H_ -int svndump_init(const char *filename); -void svndump_read(const char *url); +int svndump_init(const char *filename, const char *url); +void svndump_read(void); void svndump_deinit(void); void svndump_reset(void); -- 1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html