Message ID | 20241211-fix-bundle-create-race-v2-1-6a18bd07edec@iotcl.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] bundle: remove unneeded code | expand |
Toon Claes <toon@iotcl.com> writes: > - No longer user the term "bottomless bundle" and use "full bundle" and > "incremental bundle" instead, because they are more commonly used. Good. > - To verify the full bundle created upto tag actually contains the tag > object, add a test to clone from the created bundle. expecting success of 6020.17 'clone from full bundle upto annotated tag': git clone --mirror v2.bdl tag-clone.git && git -C tag-clone.git show-ref | make_user_friendly_and_stable_output >actual && cat >expect <<-\EOF && <TAG-2> refs/tags/v2 EOF false && test_cmp expect actual Cloning into bare repository 'tag-clone.git'... Receiving objects: 100% (35/35), done. Resolving deltas: 100% (6/6), done. not ok 17 - clone from full bundle upto annotated tag # # git clone --mirror v2.bdl tag-clone.git && # git -C tag-clone.git show-ref | # make_user_friendly_and_stable_output >actual && # cat >expect <<-\EOF && # <TAG-2> refs/tags/v2 # EOF # false && # test_cmp expect actual # 1..17 What's the "false" doing here?
Junio C Hamano <gitster@pobox.com> writes: > expecting success of 6020.17 'clone from full bundle upto annotated tag': > git clone --mirror v2.bdl tag-clone.git && > git -C tag-clone.git show-ref | > make_user_friendly_and_stable_output >actual && > cat >expect <<-\EOF && > <TAG-2> refs/tags/v2 > EOF > false && > test_cmp expect actual > > Cloning into bare repository 'tag-clone.git'... > Receiving objects: 100% (35/35), done. > Resolving deltas: 100% (6/6), done. > not ok 17 - clone from full bundle upto annotated tag > # > # git clone --mirror v2.bdl tag-clone.git && > # git -C tag-clone.git show-ref | > # make_user_friendly_and_stable_output >actual && > # cat >expect <<-\EOF && > # <TAG-2> refs/tags/v2 > # EOF > # false && > # test_cmp expect actual > # > 1..17 > > What's the "false" doing here? I'm terribly sorry, how sloppy of me. I added that during debugging to be able to inspect the t/trash* directory. This shouldn't have made it to the final patch. My apologies, I've submitted v3 which doesn't include that line. -- Toon
Toon Claes <toon@iotcl.com> writes: >> # false && >> # test_cmp expect actual >> # >> 1..17 >> >> What's the "false" doing here? > > I'm terribly sorry, how sloppy of me. Heh, let's not over-react (applies on both sides; I should also have stopped, took a deep breath, possibly try to remove it and see if it makes sense myself, before asking that question in a hostile tone, sorry). Mistakes happen. > I added that during debugging to > be able to inspect the t/trash* directory. This shouldn't have made it > to the final patch. My apologies, I've submitted v3 which doesn't > include that line. Thanks, will replace.
diff --git a/bundle.c b/bundle.c index 4773b51eb1df8057466c87f48445c49bc1f594ee..dfb5b7a5ec6b98e00078359afe991bac55cae739 100644 --- a/bundle.c +++ b/bundle.c @@ -420,36 +420,6 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) e->name); goto skip_write_ref; } - /* - * If you run "git bundle create bndl v1.0..v2.0", the - * name of the positive ref is "v2.0" but that is the - * commit that is referenced by the tag, and not the tag - * itself. - */ - if (!oideq(&oid, &e->item->oid)) { - /* - * Is this the positive end of a range expressed - * in terms of a tag (e.g. v2.0 from the range - * "v1.0..v2.0")? - */ - struct commit *one = lookup_commit_reference(revs->repo, &oid); - struct object *obj; - - if (e->item == &(one->object)) { - /* - * Need to include e->name as an - * independent ref to the pack-objects - * input, so that the tag is included - * in the output; otherwise we would - * end up triggering "empty bundle" - * error. - */ - obj = parse_object_or_die(&oid, e->name); - obj->flags |= SHOWN; - add_pending_object(revs, obj, e->name); - } - goto skip_write_ref; - } ref_count++; write_or_die(bundle_fd, oid_to_hex(&e->item->oid), the_hash_algo->hexsz); diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh index 5d444bfe201a330527e86dde7229721fc386fc93..e7e8de92cd904f2f9a2dd6b4be21b288b6ea6154 100755 --- a/t/t6020-bundle-misc.sh +++ b/t/t6020-bundle-misc.sh @@ -504,6 +504,51 @@ test_expect_success 'unfiltered bundle with --objects' ' test_cmp expect actual ' +test_expect_success 'full bundle upto annotated tag' ' + git bundle create v2.bdl \ + v2 && + + git bundle verify v2.bdl | + make_user_friendly_and_stable_output >actual && + + format_and_save_expect <<-EOF && + The bundle contains this ref: + <TAG-2> refs/tags/v2 + The bundle records a complete history. + $HASH_MESSAGE + EOF + test_cmp expect actual +' + +test_expect_success 'clone from full bundle upto annotated tag' ' + git clone --mirror v2.bdl tag-clone.git && + git -C tag-clone.git show-ref | + make_user_friendly_and_stable_output >actual && + cat >expect <<-\EOF && + <TAG-2> refs/tags/v2 + EOF + false && + test_cmp expect actual +' + +test_expect_success 'incremental bundle between two annotated tags' ' + git bundle create v1-v2.bdl \ + v1..v2 && + + git bundle verify v1-v2.bdl | + make_user_friendly_and_stable_output >actual && + + format_and_save_expect <<-EOF && + The bundle contains this ref: + <TAG-2> refs/tags/v2 + The bundle requires these 2 refs: + <COMMIT-E> Z + <COMMIT-B> Z + $HASH_MESSAGE + EOF + test_cmp expect actual +' + for filter in "blob:none" "tree:0" "tree:1" "blob:limit=100" do test_expect_success "filtered bundle: $filter" '