* [PATCH 1/9] vcs-svn: drop no-op reset methods
2012-07-06 17:10 ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
@ 2012-07-06 17:13 ` Jonathan Nieder
2012-07-06 17:16 ` [PATCH 2/9] vcs-svn: avoid self-assignment in dummy initialization of pre_off Jonathan Nieder
` (8 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Jonathan Nieder @ 2012-07-06 17:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Michael Barr, Florian Achleitner, git
From: David Barr <davidbarr@google.com>
Date: Fri, 1 Jun 2012 00:41:30 +1000
Since v1.7.5~42^2~6 (vcs-svn: remove buffer_read_string)
buffer_reset() does nothing thus fast_export_reset() also.
Signed-off-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Incorporates fixes from $gmane/198955. No other changes.
test-line-buffer.c | 1 -
test-svn-fe.c | 2 --
vcs-svn/fast_export.c | 5 -----
vcs-svn/fast_export.h | 1 -
vcs-svn/line_buffer.c | 4 ----
vcs-svn/line_buffer.h | 1 -
vcs-svn/svndump.c | 2 --
7 files changed, 16 deletions(-)
diff --git a/test-line-buffer.c b/test-line-buffer.c
index 7ec9b13c..ef1d7bae 100644
--- a/test-line-buffer.c
+++ b/test-line-buffer.c
@@ -87,6 +87,5 @@ int main(int argc, char *argv[])
die("input error");
if (ferror(stdout))
die("output error");
- buffer_reset(&stdin_buf);
return 0;
}
diff --git a/test-svn-fe.c b/test-svn-fe.c
index 332a5f71..83633a21 100644
--- a/test-svn-fe.c
+++ b/test-svn-fe.c
@@ -31,9 +31,7 @@ static int apply_delta(int argc, char *argv[])
die_errno("cannot close preimage");
if (buffer_deinit(&delta))
die_errno("cannot close delta");
- buffer_reset(&preimage);
strbuf_release(&preimage_view.buf);
- buffer_reset(&delta);
return 0;
}
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index b823b851..b4be91cc 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -42,11 +42,6 @@ void fast_export_deinit(void)
die_errno("error closing fast-import feedback stream");
}
-void fast_export_reset(void)
-{
- buffer_reset(&report_buffer);
-}
-
void fast_export_delete(const char *path)
{
putchar('D');
diff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h
index aa629f54..8823aca1 100644
--- a/vcs-svn/fast_export.h
+++ b/vcs-svn/fast_export.h
@@ -6,7 +6,6 @@ struct line_buffer;
void fast_export_init(int fd);
void fast_export_deinit(void);
-void fast_export_reset(void);
void fast_export_delete(const char *path);
void fast_export_modify(const char *path, uint32_t mode, const char *dataref);
diff --git a/vcs-svn/line_buffer.c b/vcs-svn/line_buffer.c
index 01fcb842..57cc1cec 100644
--- a/vcs-svn/line_buffer.c
+++ b/vcs-svn/line_buffer.c
@@ -124,7 +124,3 @@ off_t buffer_skip_bytes(struct line_buffer *buf, off_t nbytes)
}
return done;
}
-
-void buffer_reset(struct line_buffer *buf)
-{
-}
diff --git a/vcs-svn/line_buffer.h b/vcs-svn/line_buffer.h
index 8901f214..ee23b4f4 100644
--- a/vcs-svn/line_buffer.h
+++ b/vcs-svn/line_buffer.h
@@ -14,7 +14,6 @@ struct line_buffer {
int buffer_init(struct line_buffer *buf, const char *filename);
int buffer_fdinit(struct line_buffer *buf, int fd);
int buffer_deinit(struct line_buffer *buf);
-void buffer_reset(struct line_buffer *buf);
int buffer_tmpfile_init(struct line_buffer *buf);
FILE *buffer_tmpfile_rewind(struct line_buffer *buf); /* prepare to write. */
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index 644fdc71..f6c0d4c8 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -499,8 +499,6 @@ void svndump_deinit(void)
void svndump_reset(void)
{
- fast_export_reset();
- buffer_reset(&input);
strbuf_release(&dump_ctx.uuid);
strbuf_release(&dump_ctx.url);
strbuf_release(&rev_ctx.log);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/9] vcs-svn: avoid self-assignment in dummy initialization of pre_off
2012-07-06 17:10 ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
2012-07-06 17:13 ` [PATCH 1/9] vcs-svn: drop no-op reset methods Jonathan Nieder
@ 2012-07-06 17:16 ` Jonathan Nieder
2012-07-06 17:18 ` [PATCH 3/9] vcs-svn: simplify cleanup in apply_one_window Jonathan Nieder
` (7 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Jonathan Nieder @ 2012-07-06 17:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Michael Barr, Florian Achleitner, git
From: David Barr <davidbarr@google.com>
Date: Fri, 1 Jun 2012 00:41:25 +1000
Without this change, clang complains:
vcs-svn/svndiff.c:298:3: warning: Assigned value is garbage or undefined
off_t pre_off = pre_off; /* stupid GCC... */
^ ~~~~~~~
This code uses an old and common idiom for suppressing an
"uninitialized variable" warning, and clang is wrong to warn about it.
The idiom tells the compiler to leave the variable uninitialized,
which saves a few bytes of code size, and, more importantly, allows
valgrind to check at runtime that the variable is properly initialized
by the time it is used.
But MSVC and clang do not know that idiom, so let's avoid it in
vcs-svn/ code.
Initialize pre_off to -1, a recognizably meaningless value, to allow
future code changes that cause pre_off to be used before it is
initialized to be caught early.
Signed-off-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Changes since v2:
- new commit message inspired by the discussion at [2]
- initialize pre_off to -1 instead of 0
[1] http://thread.gmane.org/gmane.comp.version-control.git/198909/focus=198910
[2] http://thread.gmane.org/gmane.comp.version-control.git/169098/focus=169128
vcs-svn/svndiff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c
index 1647c1a7..c89d9623 100644
--- a/vcs-svn/svndiff.c
+++ b/vcs-svn/svndiff.c
@@ -295,7 +295,7 @@ int svndiff0_apply(struct line_buffer *delta, off_t delta_len,
if (read_magic(delta, &delta_len))
return -1;
while (delta_len) { /* For each window: */
- off_t pre_off = pre_off; /* stupid GCC... */
+ off_t pre_off = -1;
size_t pre_len;
if (read_offset(delta, &pre_off, &delta_len) ||
--
1.7.10.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/9] vcs-svn: simplify cleanup in apply_one_window
2012-07-06 17:10 ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
2012-07-06 17:13 ` [PATCH 1/9] vcs-svn: drop no-op reset methods Jonathan Nieder
2012-07-06 17:16 ` [PATCH 2/9] vcs-svn: avoid self-assignment in dummy initialization of pre_off Jonathan Nieder
@ 2012-07-06 17:18 ` Jonathan Nieder
2012-07-06 17:18 ` [PATCH 4/9] vcs-svn: use constcmp instead of prefixcmp Jonathan Nieder
` (6 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Jonathan Nieder @ 2012-07-06 17:18 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Michael Barr, Florian Achleitner, git
From: David Barr <davidbarr@google.com>
Date: Fri, 1 Jun 2012 00:41:26 +1000
Currently the cleanup code looks like this:
free resources
return 0;
error_out:
free resources
return -1;
Avoid duplicating the "free resources" part by keeping the return
value in a variable and sharing code between the success and
exceptional case:
ret = 0;
out:
free resources
return ret;
Noticed in the svn-dump-fast-export project, where using the error()
macro in void context produces a warning.
Signed-off-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Changes since v2:
- new description
vcs-svn/svndiff.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c
index c89d9623..e810d0c3 100644
--- a/vcs-svn/svndiff.c
+++ b/vcs-svn/svndiff.c
@@ -258,6 +258,7 @@ static int apply_window_in_core(struct window *ctx)
static int apply_one_window(struct line_buffer *delta, off_t *delta_len,
struct sliding_view *preimage, FILE *out)
{
+ int rv = -1;
struct window ctx = WINDOW_INIT(preimage);
size_t out_len;
size_t instructions_len;
@@ -275,16 +276,15 @@ static int apply_one_window(struct line_buffer *delta, off_t *delta_len,
if (apply_window_in_core(&ctx))
goto error_out;
if (ctx.out.len != out_len) {
- error("invalid delta: incorrect postimage length");
+ rv = error("invalid delta: incorrect postimage length");
goto error_out;
}
if (write_strbuf(&ctx.out, out))
goto error_out;
- window_release(&ctx);
- return 0;
+ rv = 0;
error_out:
window_release(&ctx);
- return -1;
+ return rv;
}
int svndiff0_apply(struct line_buffer *delta, off_t delta_len,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 4/9] vcs-svn: use constcmp instead of prefixcmp
2012-07-06 17:10 ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
` (2 preceding siblings ...)
2012-07-06 17:18 ` [PATCH 3/9] vcs-svn: simplify cleanup in apply_one_window Jonathan Nieder
@ 2012-07-06 17:18 ` Jonathan Nieder
2012-07-06 17:19 ` [PATCH 5/9] vcs-svn: use strstr instead of memmem Jonathan Nieder
` (5 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Jonathan Nieder @ 2012-07-06 17:18 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Michael Barr, Florian Achleitner, git
From: David Barr <davidbarr@google.com>
Date: Fri, 1 Jun 2012 00:41:27 +1000
Since the length of t is already known, we can simplify a little by
using memcmp() instead of strncmp() to carry out a prefix comparison.
All nearby code already does this.
Noticed in the standalone svn-dump-fast-export project which has not
needed to implement prefixcmp() yet.
Signed-off-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Description clarified. No other change.
vcs-svn/svndump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index f6c0d4c8..c5d07a66 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -361,7 +361,7 @@ void svndump_read(const char *url)
reset_rev_ctx(atoi(val));
break;
case sizeof("Node-path"):
- if (prefixcmp(t, "Node-"))
+ if (constcmp(t, "Node-"))
continue;
if (!constcmp(t + strlen("Node-"), "path")) {
if (active_ctx == NODE_CTX)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 5/9] vcs-svn: use strstr instead of memmem
2012-07-06 17:10 ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
` (3 preceding siblings ...)
2012-07-06 17:18 ` [PATCH 4/9] vcs-svn: use constcmp instead of prefixcmp Jonathan Nieder
@ 2012-07-06 17:19 ` Jonathan Nieder
2012-07-06 17:21 ` [PATCH 6/9] vcs-svn: suppress signed/unsigned comparison warnings Jonathan Nieder
` (4 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Jonathan Nieder @ 2012-07-06 17:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Michael Barr, Florian Achleitner, git
From: David Barr <davidbarr@google.com>
Date: Fri, 1 Jun 2012 00:41:28 +1000
memmem is a GNU extension.
Avoiding it makes the code clearer and makes it easier for projects
that don't share git's compat/ code, such as the standalone
svn-dump-fast-export project, to reuse the vcs-svn/ library.
Signed-off-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Clarified description. No other change since v2.
vcs-svn/fast_export.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index b4be91cc..854b328d 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -158,7 +158,7 @@ static int parse_cat_response_line(const char *header, off_t *len)
if (ends_with(header, headerlen, " missing"))
return error("cat-blob reports missing blob: %s", header);
- type = memmem(header, headerlen, " blob ", strlen(" blob "));
+ type = strstr(header, " blob ");
if (!type)
return error("cat-blob header has wrong object type: %s", header);
n = strtoumax(type + strlen(" blob "), (char **) &end, 10);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 6/9] vcs-svn: suppress signed/unsigned comparison warnings
2012-07-06 17:10 ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
` (4 preceding siblings ...)
2012-07-06 17:19 ` [PATCH 5/9] vcs-svn: use strstr instead of memmem Jonathan Nieder
@ 2012-07-06 17:21 ` Jonathan Nieder
2012-07-06 17:22 ` [PATCH 7/9] vcs-svn: suppress a signed/unsigned comparison warning Jonathan Nieder
` (3 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Jonathan Nieder @ 2012-07-06 17:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Michael Barr, Florian Achleitner, git
From: David Barr <davidbarr@google.com>
Date: Fri, 1 Jun 2012 00:41:29 +1000
These are already safe because both sides of the comparison are
nonnegative.
This would normally not be important because Git is not -Wsign-compare
clean anyway, but we like to keep the vcs-svn/ lib to a higher
standard for convenience using it in other projects.
Signed-off-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
This is the easy part of what is a larger patch[1] in v2, split out
and given a new description for easier review.
[1] http://thread.gmane.org/gmane.comp.version-control.git/198909/focus=198914
vcs-svn/fast_export.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index 854b328d..1f046978 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -254,7 +254,7 @@ static int parse_ls_response(const char *response, uint32_t *mode,
}
/* Mode. */
- if (response_end - response < strlen("100644") ||
+ if (response_end - response < (signed) strlen("100644") ||
response[strlen("100644")] != ' ')
die("invalid ls response: missing mode: %s", response);
*mode = 0;
@@ -267,7 +267,7 @@ static int parse_ls_response(const char *response, uint32_t *mode,
}
/* ' blob ' or ' tree ' */
- if (response_end - response < strlen(" blob ") ||
+ if (response_end - response < (signed) strlen(" blob ") ||
(response[1] != 'b' && response[1] != 't'))
die("unexpected ls response: not a tree or blob: %s", response);
response += strlen(" blob ");
--
1.7.10.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 7/9] vcs-svn: suppress a signed/unsigned comparison warning
2012-07-06 17:10 ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
` (5 preceding siblings ...)
2012-07-06 17:21 ` [PATCH 6/9] vcs-svn: suppress signed/unsigned comparison warnings Jonathan Nieder
@ 2012-07-06 17:22 ` Jonathan Nieder
2012-07-06 17:25 ` [PATCH 8/9] " Jonathan Nieder
` (2 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Jonathan Nieder @ 2012-07-06 17:22 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Michael Barr, Florian Achleitner, git
From: David Barr <davidbarr@google.com>
Date: Fri, 1 Jun 2012 00:41:29 +1000
The preceding code checks that view->max_off is nonnegative and
(off + width) fits in an off_t, so this code is already safe.
Signed-off-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Another unobjectionable piece from v2's patch 5. The new change
description explains why it's unobjectionable to save future readers
some time.
vcs-svn/sliding_window.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vcs-svn/sliding_window.c b/vcs-svn/sliding_window.c
index ec2707c9..f11d4909 100644
--- a/vcs-svn/sliding_window.c
+++ b/vcs-svn/sliding_window.c
@@ -54,7 +54,7 @@ int move_window(struct sliding_view *view, off_t off, size_t width)
return -1;
if (off < view->off || off + width < view->off + view->width)
return error("invalid delta: window slides left");
- if (view->max_off >= 0 && view->max_off < off + width)
+ if (view->max_off >= 0 && view->max_off < off + (off_t) width)
return error("delta preimage ends early");
file_offset = view->off + view->buf.len;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 8/9] vcs-svn: suppress a signed/unsigned comparison warning
2012-07-06 17:10 ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
` (6 preceding siblings ...)
2012-07-06 17:22 ` [PATCH 7/9] vcs-svn: suppress a signed/unsigned comparison warning Jonathan Nieder
@ 2012-07-06 17:25 ` Jonathan Nieder
2012-07-06 17:27 ` [PATCH 9/9] vcs-svn: allow 64-bit Prop-Content-Length Jonathan Nieder
2012-07-06 19:41 ` [GIT PULL] vcs-svn housekeeping David Michael Barr
9 siblings, 0 replies; 16+ messages in thread
From: Jonathan Nieder @ 2012-07-06 17:25 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Michael Barr, Florian Achleitner, git
From: Jonathan Nieder <jrnieder@gmail.com>
Date: Thu, 5 Jul 2012 22:21:09 -0500
All callers pass a nonnegative delta_len, so the code is already safe.
Add an assertion to ensure that remains so and add a cast to keep
clang and gcc -Wsign-compare from worrying.
Reported-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
v2 suppressed the warning by casting "len" to an off_t, producing an
unintentional change (breakage) in functionality on 64-bit systems
when "len" is large.
This version is longer but more conservative.
vcs-svn/svndiff.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c
index e810d0c3..74c97c45 100644
--- a/vcs-svn/svndiff.c
+++ b/vcs-svn/svndiff.c
@@ -77,8 +77,9 @@ static int error_short_read(struct line_buffer *input)
static int read_chunk(struct line_buffer *delta, off_t *delta_len,
struct strbuf *buf, size_t len)
{
+ assert(*delta_len >= 0);
strbuf_reset(buf);
- if (len > *delta_len ||
+ if (len > (uintmax_t) *delta_len ||
buffer_read_binary(delta, buf, len) != len)
return error_short_read(delta);
*delta_len -= buf->len;
@@ -290,7 +291,7 @@ error_out:
int svndiff0_apply(struct line_buffer *delta, off_t delta_len,
struct sliding_view *preimage, FILE *postimage)
{
- assert(delta && preimage && postimage);
+ assert(delta && preimage && postimage && delta_len >= 0);
if (read_magic(delta, &delta_len))
return -1;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 9/9] vcs-svn: allow 64-bit Prop-Content-Length
2012-07-06 17:10 ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
` (7 preceding siblings ...)
2012-07-06 17:25 ` [PATCH 8/9] " Jonathan Nieder
@ 2012-07-06 17:27 ` Jonathan Nieder
2012-07-06 19:41 ` [GIT PULL] vcs-svn housekeeping David Michael Barr
9 siblings, 0 replies; 16+ messages in thread
From: Jonathan Nieder @ 2012-07-06 17:27 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Michael Barr, Florian Achleitner, git
Date: Thu, 5 Jul 2012 22:47:47 -0500
Currently the vcs-svn/ library only pays attention to the presence of
the Prop-Content-Length field and doesn't care about its value, but
some day we might care about the value. Parse it as an off_t instead
of arbitrarily limiting to 32 bits for intuitiveness.
So now you can import from a dump with more than 2 GiB of properties
for a node. In practice that isn't likely to happen often, and this
is mostly meant as a cleanup.
Based-on-patch-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Another change that was mixed into v2's signedness warnings patch.
In v2 it changed the type of propLength without changing its name.
This version of the patch is more thorough about consistently using
the intuitive type (off_t instead of a 32-bit integer).
That's the end of the series. Thanks for your patience.
vcs-svn/svndump.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index c5d07a66..a7f3ea64 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -34,14 +34,13 @@
#define NODE_CTX 2 /* node metadata */
#define INTERNODE_CTX 3 /* between nodes */
-#define LENGTH_UNKNOWN (~0)
#define DATE_RFC2822_LEN 31
static struct line_buffer input = LINE_BUFFER_INIT;
static struct {
- uint32_t action, propLength, srcRev, type;
- off_t text_length;
+ uint32_t action, srcRev, type;
+ off_t prop_length, text_length;
struct strbuf src, dst;
uint32_t text_delta, prop_delta;
} node_ctx;
@@ -61,7 +60,7 @@ static void reset_node_ctx(char *fname)
{
node_ctx.type = 0;
node_ctx.action = NODEACT_UNKNOWN;
- node_ctx.propLength = LENGTH_UNKNOWN;
+ node_ctx.prop_length = -1;
node_ctx.text_length = -1;
strbuf_reset(&node_ctx.src);
node_ctx.srcRev = 0;
@@ -209,7 +208,7 @@ static void read_props(void)
static void handle_node(void)
{
const uint32_t type = node_ctx.type;
- const int have_props = node_ctx.propLength != LENGTH_UNKNOWN;
+ const int have_props = node_ctx.prop_length != -1;
const int have_text = node_ctx.text_length != -1;
/*
* Old text for this node:
@@ -273,7 +272,7 @@ static void handle_node(void)
if (have_props) {
if (!node_ctx.prop_delta)
node_ctx.type = type;
- if (node_ctx.propLength)
+ if (node_ctx.prop_length)
read_props();
}
@@ -409,22 +408,26 @@ void svndump_read(const char *url)
node_ctx.srcRev = atoi(val);
break;
case sizeof("Text-content-length"):
- if (!constcmp(t, "Text-content-length")) {
+ if (constcmp(t, "Text") && constcmp(t, "Prop"))
+ continue;
+ if (constcmp(t + 4, "-content-length"))
+ continue;
+ {
char *end;
- uintmax_t textlen;
+ uintmax_t len;
- textlen = strtoumax(val, &end, 10);
+ len = strtoumax(val, &end, 10);
if (!isdigit(*val) || *end)
die("invalid dump: non-numeric length %s", val);
- if (textlen > maximum_signed_value_of_type(off_t))
+ if (len > maximum_signed_value_of_type(off_t))
die("unrepresentable length in dump: %s", val);
- node_ctx.text_length = (off_t) textlen;
+
+ if (*t == 'T')
+ node_ctx.text_length = (off_t) len;
+ else
+ node_ctx.prop_length = (off_t) len;
break;
}
- if (constcmp(t, "Prop-content-length"))
- continue;
- node_ctx.propLength = atoi(val);
- break;
case sizeof("Text-delta"):
if (!constcmp(t, "Text-delta")) {
node_ctx.text_delta = !strcmp(val, "true");
--
1.7.10.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [GIT PULL] vcs-svn housekeeping
2012-07-06 17:10 ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
` (8 preceding siblings ...)
2012-07-06 17:27 ` [PATCH 9/9] vcs-svn: allow 64-bit Prop-Content-Length Jonathan Nieder
@ 2012-07-06 19:41 ` David Michael Barr
2012-07-06 20:28 ` Junio C Hamano
9 siblings, 1 reply; 16+ messages in thread
From: David Michael Barr @ 2012-07-06 19:41 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Junio C Hamano, Florian Achleitner, git
On Sat, Jul 7, 2012 at 3:10 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi Junio,
>
> The following changes since commit 58ebd9865d2bb9d42842fbac5a1c4eae49e92859:
>
> vcs-svn/svndiff.c: squelch false "unused" warning from gcc (2012-01-27 11:58:56 -0800)
>
> are available at:
>
> git://repo.or.cz/git/jrn.git svn-fe
>
> The first three commits duplicate changes that are already in master
> but were committed independently on the svn-fe branch last February.
> The rest are David's db/vcs-svn series which aims to address various
> nits noticed when merging the code back into svn-dump-fast-export:
> unnecessary use of git-specific functions (prefixcmp, memmem) and
> warnings reported by clang.
>
> Some of the patches had to change a little since v2 of db/vcs-svn, so
> I'll be replying with a copy of the patches for reference.
>
> David has looked the branch over and acked and tested it.
>
> Thoughts welcome, as usual. I think these are ready for pulling into
> master. Sorry to be so slow at this.
>
> David Barr (7):
> vcs-svn: drop no-op reset methods
> vcs-svn: avoid self-assignment in dummy initialization of pre_off
> vcs-svn: simplify cleanup in apply_one_window
> vcs-svn: use constcmp instead of prefixcmp
> vcs-svn: use strstr instead of memmem
> vcs-svn: suppress signed/unsigned comparison warnings
> vcs-svn: suppress a signed/unsigned comparison warning
>
> Jonathan Nieder (4):
> vcs-svn: allow import of > 4GiB files
> vcs-svn: suppress -Wtype-limits warning
> vcs-svn: suppress a signed/unsigned comparison warning
> vcs-svn: allow 64-bit Prop-Content-Length
>
> Ramsay Allan Jones (1):
> vcs-svn: rename check_overflow and its arguments for clarity
Thank you Jonathan for doing this. Definitely the result of
collaborating on a series is gorgeous. I do wish I could absorb your
flair for polish.
--
David Barr
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [GIT PULL] vcs-svn housekeeping
2012-07-06 19:41 ` [GIT PULL] vcs-svn housekeeping David Michael Barr
@ 2012-07-06 20:28 ` Junio C Hamano
0 siblings, 0 replies; 16+ messages in thread
From: Junio C Hamano @ 2012-07-06 20:28 UTC (permalink / raw)
To: David Michael Barr; +Cc: Jonathan Nieder, Florian Achleitner, git
David Michael Barr <davidbarr@google.com> writes:
> On Sat, Jul 7, 2012 at 3:10 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> ...
>> Some of the patches had to change a little since v2 of db/vcs-svn, so
>> I'll be replying with a copy of the patches for reference.
>>
>> David has looked the branch over and acked and tested it.
>> ...
>
> Thank you Jonathan for doing this. Definitely the result of
> collaborating on a series is gorgeous. I do wish I could absorb your
> flair for polish.
Thanks, both. Will be pulled and pushed out by tonight.
^ permalink raw reply [flat|nested] 16+ messages in thread