1
0
mirror of https://github.com/git/git.git synced 2024-10-19 05:59:13 +02:00

Merge branch 'tr/maint-bundle-boundary' into maint-1.7.8

* tr/maint-bundle-boundary:
  bundle: keep around names passed to add_pending_object()
  t5510: ensure we stay in the toplevel test dir
  t5510: refactor bundle->pack conversion
This commit is contained in:
Junio C Hamano 2012-04-09 13:36:26 -07:00
commit 50c9403284
2 changed files with 36 additions and 23 deletions

@ -273,7 +273,7 @@ int create_bundle(struct bundle_header *header, const char *path,
if (!get_sha1_hex(buf.buf + 1, sha1)) { if (!get_sha1_hex(buf.buf + 1, sha1)) {
struct object *object = parse_object(sha1); struct object *object = parse_object(sha1);
object->flags |= UNINTERESTING; object->flags |= UNINTERESTING;
add_pending_object(&revs, object, buf.buf); add_pending_object(&revs, object, xstrdup(buf.buf));
} }
} else if (!get_sha1_hex(buf.buf, sha1)) { } else if (!get_sha1_hex(buf.buf, sha1)) {
struct object *object = parse_object(sha1); struct object *object = parse_object(sha1);

@ -14,6 +14,14 @@ test_bundle_object_count () {
test "$2" = $(grep '^[0-9a-f]\{40\} ' verify.out | wc -l) test "$2" = $(grep '^[0-9a-f]\{40\} ' verify.out | wc -l)
} }
convert_bundle_to_pack () {
while read x && test -n "$x"
do
:;
done
cat
}
test_expect_success setup ' test_expect_success setup '
echo >file original && echo >file original &&
git add file && git add file &&
@ -207,13 +215,7 @@ test_expect_success 'unbundle 1' '
test_expect_success 'bundle 1 has only 3 files ' ' test_expect_success 'bundle 1 has only 3 files ' '
cd "$D" && cd "$D" &&
( convert_bundle_to_pack <bundle1 >bundle.pack &&
while read x && test -n "$x"
do
:;
done
cat
) <bundle1 >bundle.pack &&
git index-pack bundle.pack && git index-pack bundle.pack &&
test_bundle_object_count bundle.pack 3 test_bundle_object_count bundle.pack 3
' '
@ -230,13 +232,7 @@ test_expect_success 'bundle does not prerequisite objects' '
git add file2 && git add file2 &&
git commit -m add.file2 file2 && git commit -m add.file2 file2 &&
git bundle create bundle3 -1 HEAD && git bundle create bundle3 -1 HEAD &&
( convert_bundle_to_pack <bundle3 >bundle.pack &&
while read x && test -n "$x"
do
:;
done
cat
) <bundle3 >bundle.pack &&
git index-pack bundle.pack && git index-pack bundle.pack &&
test_bundle_object_count bundle.pack 3 test_bundle_object_count bundle.pack 3
' '
@ -434,14 +430,31 @@ test_expect_success 'fetch --dry-run' '
' '
test_expect_success "should be able to fetch with duplicate refspecs" ' test_expect_success "should be able to fetch with duplicate refspecs" '
mkdir dups && mkdir dups &&
cd dups && (
git init && cd dups &&
git config branch.master.remote three && git init &&
git config remote.three.url ../three/.git && git config branch.master.remote three &&
git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* && git config remote.three.url ../three/.git &&
git config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* && git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
git fetch three git config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
git fetch three
)
'
test_expect_success 'all boundary commits are excluded' '
test_commit base &&
test_commit oneside &&
git checkout HEAD^ &&
test_commit otherside &&
git checkout master &&
test_tick &&
git merge otherside &&
ad=$(git log --no-walk --format=%ad HEAD) &&
git bundle create twoside-boundary.bdl master --since="$ad" &&
convert_bundle_to_pack <twoside-boundary.bdl >twoside-boundary.pack &&
pack=$(git index-pack --fix-thin --stdin <twoside-boundary.pack) &&
test_bundle_object_count .git/objects/pack/pack-${pack##pack }.pack 3
' '
test_done test_done