summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@hurrynot.org>2010-07-13 17:21:48 +0530
committerJunio C Hamano <gitster@pobox.com>2010-08-11 10:45:15 -0700
commit7e7db5e4520388d3a6f1efbe2f7a29d43bd06a2b (patch)
tree2378da4897a9c2dbd2110a5723ca33ef3c950f3b /fast-import.c
parent5536934239ed0a66fc5ac1d08cfd7e6a0905f80c (diff)
downloadgit-7e7db5e4520388d3a6f1efbe2f7a29d43bd06a2b.tar.gz
fast-import: export correctly marks larger than 2^20-1
dump_marks_helper() has a bug when dumping marks larger than 2^20-1, i.e., when the sparse array has more than two levels. The bug was that the 'base' counter was being shifted by 20 bits at level 3, and then again by 10 bits at level 2, rather than a total shift of 20 bits in this argument to the recursive call: (base + k) << m->shift There are two ways to fix this correctly, the elegant: (base + k) << 10 and the one I chose due to edit distance: base + (k << m->shift) Signed-off-by: Raja R Harinath <harinath@hurrynot.org> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fast-import.c b/fast-import.c
index 1e5d66ed0a..ddad289dae 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1666,7 +1666,7 @@ static void dump_marks_helper(FILE *f,
if (m->shift) {
for (k = 0; k < 1024; k++) {
if (m->data.sets[k])
- dump_marks_helper(f, (base + k) << m->shift,
+ dump_marks_helper(f, base + (k << m->shift),
m->data.sets[k]);
}
} else {