From: Junio C Hamano Date: Tue, 6 Mar 2012 22:53:06 +0000 (-0800) Subject: Merge branch 'tr/maint-bundle-boundary' X-Git-Tag: v1.7.10-rc0~8 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4ebed61ae46194e35cdf353acafec56b38b6b3c2?ds=inline;hp=-c Merge branch 'tr/maint-bundle-boundary' By Thomas Rast * 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 --- 4ebed61ae46194e35cdf353acafec56b38b6b3c2 diff --combined bundle.c index 7a760db2fc,6c4695eb91..d9cfd90534 --- a/bundle.c +++ b/bundle.c @@@ -273,7 -273,7 +273,7 @@@ int create_bundle(struct bundle_header if (!get_sha1_hex(buf.buf + 1, sha1)) { struct object *object = parse_object(sha1); 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)) { struct object *object = parse_object(sha1); @@@ -304,7 -304,7 +304,7 @@@ continue; if (dwim_ref(e->name, strlen(e->name), sha1, &ref) != 1) continue; - if (!resolve_ref(e->name, sha1, 1, &flag)) + if (read_ref_full(e->name, sha1, 1, &flag)) flag = 0; display_ref = (flag & REF_ISSYMREF) ? e->name : ref; diff --combined t/t5510-fetch.sh index 79ee913130,9d72b16393..308c02ea75 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@@ -14,6 -14,14 +14,14 @@@ test_bundle_object_count () 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 ' echo >file original && git add file && @@@ -70,8 -78,8 +78,8 @@@ test_expect_success "fetch test for-mer master_in_two=`cd ../two && git rev-parse master` && one_in_two=`cd ../two && git rev-parse one` && { - echo "$master_in_two not-for-merge" echo "$one_in_two " + echo "$master_in_two not-for-merge" } >expected && cut -f -2 .git/FETCH_HEAD >actual && test_cmp expected actual' @@@ -166,7 -174,7 +174,7 @@@ test_expect_success 'fetch must not res ' -test_expect_success 'fetch must not resolve short remote name' ' +test_expect_success 'fetch can now resolve short remote name' ' cd "$D" && git update-ref refs/remotes/six/HEAD HEAD && @@@ -175,7 -183,8 +183,7 @@@ cd six && git init && - test_must_fail git fetch .. six:six - + git fetch .. six:six ' test_expect_success 'create bundle 1' ' @@@ -206,13 -215,7 +214,7 @@@ test_expect_success 'unbundle 1' test_expect_success 'bundle 1 has only 3 files ' ' cd "$D" && - ( - while read x && test -n "$x" - do - :; - done - cat - ) bundle.pack && + convert_bundle_to_pack bundle.pack && git index-pack bundle.pack && test_bundle_object_count bundle.pack 3 ' @@@ -229,13 -232,7 +231,7 @@@ test_expect_success 'bundle does not pr git add file2 && git commit -m add.file2 file2 && git bundle create bundle3 -1 HEAD && - ( - while read x && test -n "$x" - do - :; - done - cat - ) bundle.pack && + convert_bundle_to_pack bundle.pack && git index-pack bundle.pack && test_bundle_object_count bundle.pack 3 ' @@@ -433,14 -430,31 +429,31 @@@ test_expect_success 'fetch --dry-run' ' test_expect_success "should be able to fetch with duplicate refspecs" ' - mkdir dups && - cd dups && - git init && - git config branch.master.remote three && - git config remote.three.url ../three/.git && - git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* && - git config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* && - git fetch three + mkdir dups && + ( + cd dups && + git init && + git config branch.master.remote three && + git config remote.three.url ../three/.git && + git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* && + 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.pack && + pack=$(git index-pack --fix-thin --stdin