From: Junio C Hamano Date: Fri, 19 Sep 2008 03:19:30 +0000 (-0700) Subject: Merge branch 'np/pack' X-Git-Tag: v1.6.1-rc1~229 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/c4398286fa5245cf54d73f6016444179d73f140b?hp=-c Merge branch 'np/pack' * np/pack: t5300: improve SHA1 collision test pack-objects: don't include missing preferred base objects sha1write: don't copy full sized buffers Conflicts: t/t5300-pack-object.sh --- c4398286fa5245cf54d73f6016444179d73f140b diff --combined builtin-pack-objects.c index 217fd49da9,e16b7e8f06..5fc1b8c6fb --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@@ -23,7 -23,7 +23,7 @@@ #endif static const char pack_usage[] = "\ -git-pack-objects [{ -q | --progress | --all-progress }] \n\ +git pack-objects [{ -q | --progress | --all-progress }] \n\ [--max-pack-size=N] [--local] [--incremental] \n\ [--window=N] [--window-memory=N] [--depth=N] \n\ [--no-reuse-delta] [--no-reuse-object] [--delta-base-offset] \n\ @@@ -1725,6 -1725,14 +1725,14 @@@ static void prepare_pack(int window, in if (entry->type < 0) die("unable to get type of object %s", sha1_to_hex(entry->idx.sha1)); + } else { + if (entry->type < 0) { + /* + * This object is not found, but we + * don't have to include it anyway. + */ + continue; + } } delta_list[n++] = entry; @@@ -1872,7 -1880,7 +1880,7 @@@ static void mark_in_pack_object(struct /* * Compare the objects in the offset order, in order to emulate the - * "git-rev-list --objects" output that produced the pack originally. + * "git rev-list --objects" output that produced the pack originally. */ static int ofscmp(const void *a_, const void *b_) { diff --combined t/t5300-pack-object.sh index 3a0ef8759c,8a8b0f1aba..b335c6b42d --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@@ -3,7 -3,7 +3,7 @@@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-pack-object +test_description='git pack-object ' . ./test-lib.sh @@@ -242,24 -242,24 +242,24 @@@ test_expect_success test_expect_success \ 'build pack index for an existing pack' \ 'cat test-1-${packname_1}.pack >test-3.pack && - git-index-pack -o tmp.idx test-3.pack && + git index-pack -o tmp.idx test-3.pack && cmp tmp.idx test-1-${packname_1}.idx && - git-index-pack test-3.pack && + git index-pack test-3.pack && cmp test-3.idx test-1-${packname_1}.idx && cat test-2-${packname_2}.pack >test-3.pack && - git-index-pack -o tmp.idx test-2-${packname_2}.pack && + git index-pack -o tmp.idx test-2-${packname_2}.pack && cmp tmp.idx test-2-${packname_2}.idx && - git-index-pack test-3.pack && + git index-pack test-3.pack && cmp test-3.idx test-2-${packname_2}.idx && cat test-3-${packname_3}.pack >test-3.pack && - git-index-pack -o tmp.idx test-3-${packname_3}.pack && + git index-pack -o tmp.idx test-3-${packname_3}.pack && cmp tmp.idx test-3-${packname_3}.idx && - git-index-pack test-3.pack && + git index-pack test-3.pack && cmp test-3.idx test-3-${packname_3}.idx && :' @@@ -272,7 -272,8 +272,8 @@@ test_expect_success test_expect_success \ 'make sure index-pack detects the SHA1 collision' \ - 'test_must_fail git index-pack -o bad.idx test-3.pack' - 'test_must_fail git-index-pack -o bad.idx test-3.pack 2>msg && ++ 'test_must_fail git index-pack -o bad.idx test-3.pack 2>msg && + grep "SHA1 COLLISION FOUND" msg' test_expect_success \ 'honor pack.packSizeLimit' \