Skip to content

Commit 1df37ef

Browse files
committed
Merge branch 'tc/bundle-with-tag-remove-workaround'
"git bundle create" with an annotated tag on the positive end of the revision range had a workaround code for older limitation in the revision walker, which has become unnecessary. * tc/bundle-with-tag-remove-workaround: bundle: remove unneeded code
2 parents 930f2b4 + dd1072d commit 1df37ef

File tree

2 files changed

+44
-30
lines changed

2 files changed

+44
-30
lines changed

bundle.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -420,36 +420,6 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
420420
e->name);
421421
goto skip_write_ref;
422422
}
423-
/*
424-
* If you run "git bundle create bndl v1.0..v2.0", the
425-
* name of the positive ref is "v2.0" but that is the
426-
* commit that is referenced by the tag, and not the tag
427-
* itself.
428-
*/
429-
if (!oideq(&oid, &e->item->oid)) {
430-
/*
431-
* Is this the positive end of a range expressed
432-
* in terms of a tag (e.g. v2.0 from the range
433-
* "v1.0..v2.0")?
434-
*/
435-
struct commit *one = lookup_commit_reference(revs->repo, &oid);
436-
struct object *obj;
437-
438-
if (e->item == &(one->object)) {
439-
/*
440-
* Need to include e->name as an
441-
* independent ref to the pack-objects
442-
* input, so that the tag is included
443-
* in the output; otherwise we would
444-
* end up triggering "empty bundle"
445-
* error.
446-
*/
447-
obj = parse_object_or_die(&oid, e->name);
448-
obj->flags |= SHOWN;
449-
add_pending_object(revs, obj, e->name);
450-
}
451-
goto skip_write_ref;
452-
}
453423

454424
ref_count++;
455425
write_or_die(bundle_fd, oid_to_hex(&e->item->oid), the_hash_algo->hexsz);

t/t6020-bundle-misc.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,50 @@ test_expect_success 'unfiltered bundle with --objects' '
504504
test_cmp expect actual
505505
'
506506

507+
test_expect_success 'full bundle upto annotated tag' '
508+
git bundle create v2.bdl \
509+
v2 &&
510+
511+
git bundle verify v2.bdl |
512+
make_user_friendly_and_stable_output >actual &&
513+
514+
format_and_save_expect <<-EOF &&
515+
The bundle contains this ref:
516+
<TAG-2> refs/tags/v2
517+
The bundle records a complete history.
518+
$HASH_MESSAGE
519+
EOF
520+
test_cmp expect actual
521+
'
522+
523+
test_expect_success 'clone from full bundle upto annotated tag' '
524+
git clone --mirror v2.bdl tag-clone.git &&
525+
git -C tag-clone.git show-ref |
526+
make_user_friendly_and_stable_output >actual &&
527+
cat >expect <<-\EOF &&
528+
<TAG-2> refs/tags/v2
529+
EOF
530+
test_cmp expect actual
531+
'
532+
533+
test_expect_success 'incremental bundle between two annotated tags' '
534+
git bundle create v1-v2.bdl \
535+
v1..v2 &&
536+
537+
git bundle verify v1-v2.bdl |
538+
make_user_friendly_and_stable_output >actual &&
539+
540+
format_and_save_expect <<-EOF &&
541+
The bundle contains this ref:
542+
<TAG-2> refs/tags/v2
543+
The bundle requires these 2 refs:
544+
<COMMIT-E> Z
545+
<COMMIT-B> Z
546+
$HASH_MESSAGE
547+
EOF
548+
test_cmp expect actual
549+
'
550+
507551
for filter in "blob:none" "tree:0" "tree:1" "blob:limit=100"
508552
do
509553
test_expect_success "filtered bundle: $filter" '

0 commit comments

Comments
 (0)