From f527cb8c38964a90b1b13485f2ad46b72960d387 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 20 Apr 2006 23:36:22 -0700 Subject: [PATCH 1/4] pack-objects: do not stop at object that is "too small" Because we sort the delta window by name-hash and then size, hitting an object that is too small to consider as a delta base for the current object does not mean we do not have better candidate in the window beyond it. Noticed by Shawn Pearce, analyzed by Nico, Linus and me. Signed-off-by: Junio C Hamano --- pack-objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack-objects.c b/pack-objects.c index 09f4f2c944..f7d621757a 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -1052,7 +1052,7 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de if (cur_entry->delta) max_size = cur_entry->delta_size-1; if (sizediff >= max_size) - return -1; + return 0; delta_buf = diff_delta(old->data, oldsize, cur->data, size, &delta_size, max_size); if (!delta_buf) From d598075e52634665bd25a80b085e300d338d21f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santi=5FB=C3=A9jar?= Date: Mon, 27 Mar 2006 13:26:01 +0200 Subject: [PATCH 2/4] Reintroduce svn pools to solve the memory leak. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduced in 4802426. Signed-off-by: Santi BĂ©jar Signed-off-by: Junio C Hamano --- git-svnimport.perl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/git-svnimport.perl b/git-svnimport.perl index 60ed7ae3ee..61f559f0a8 100755 --- a/git-svnimport.perl +++ b/git-svnimport.perl @@ -136,8 +136,10 @@ sub file { print "... $rev $path ...\n" if $opt_v; my (undef, $properties); + my $pool = SVN::Pool->new(); eval { (undef, $properties) - = $self->{'svn'}->get_file($path,$rev,$fh); }; + = $self->{'svn'}->get_file($path,$rev,$fh,$pool); }; + $pool->clear; if($@) { return undef if $@ =~ /Attempted to get checksum/; die $@; From 757319309ac26d136d6f21a40c81fb53073c5dc9 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 21 Apr 2006 00:06:58 -0700 Subject: [PATCH 3/4] mailinfo: decode underscore used in "Q" encoding properly. Quoted-Printable (RFC 2045) and the "Q" encoding (RFC 2047) are subtly different; the latter is used on the mail header and an underscore needs to be decoded to 0x20. Signed-off-by: Junio C Hamano --- mailinfo.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mailinfo.c b/mailinfo.c index 3c56f8c108..b27651935d 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -405,7 +405,7 @@ static unsigned hexval(int c) return ~0; } -static int decode_q_segment(char *in, char *ot, char *ep) +static int decode_q_segment(char *in, char *ot, char *ep, int rfc2047) { int c; while ((c = *in++) != 0 && (in <= ep)) { @@ -414,9 +414,11 @@ static int decode_q_segment(char *in, char *ot, char *ep) if (d == '\n' || !d) break; /* drop trailing newline */ *ot++ = ((hexval(d) << 4) | hexval(*in++)); + continue; } - else - *ot++ = c; + if (rfc2047 && c == '_') /* rfc2047 4.2 (2) */ + c = 0x20; + *ot++ = c; } *ot = 0; return 0; @@ -547,7 +549,7 @@ static void decode_header_bq(char *it) sz = decode_b_segment(cp + 3, piecebuf, ep); break; case 'q': - sz = decode_q_segment(cp + 3, piecebuf, ep); + sz = decode_q_segment(cp + 3, piecebuf, ep, 1); break; } if (sz < 0) @@ -569,7 +571,7 @@ static void decode_transfer_encoding(char *line) switch (transfer_encoding) { case TE_QP: ep = line + strlen(line); - decode_q_segment(line, line, ep); + decode_q_segment(line, line, ep, 0); break; case TE_BASE64: ep = line + strlen(line); From 0dec30b9788b12fdae5d5b69fc366a28bb688d80 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Thu, 20 Apr 2006 17:25:37 -0400 Subject: [PATCH 4/4] fix pack-object buffer size The input line has 40 _chars_ of sha1 and no 20 _bytes_. It should also account for the space before the pathname, and the terminating \n and \0. Signed-off-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- pack-objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack-objects.c b/pack-objects.c index f7d621757a..c0acc460bb 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -1231,7 +1231,7 @@ static void setup_progress_signal(void) int main(int argc, char **argv) { SHA_CTX ctx; - char line[PATH_MAX + 20]; + char line[40 + 1 + PATH_MAX + 2]; int window = 10, depth = 10, pack_to_stdout = 0; struct object_entry **list; int num_preferred_base = 0;