Skip to content

Commit cf767ea

Browse files
committed
Merge branch 'tc/bundle-with-tag-remove-workaround' into jch
"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 1b78b48 + bd38710 commit cf767ea

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed

bundle.c

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

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

t/t6020-bundle-misc.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,40 @@ test_expect_success 'unfiltered bundle with --objects' '
508508
test_cmp expect actual
509509
'
510510

511+
test_expect_success 'bottomless bundle upto tag' '
512+
git bundle create v2.bdl \
513+
v2 &&
514+
515+
git bundle verify v2.bdl |
516+
make_user_friendly_and_stable_output >actual &&
517+
518+
format_and_save_expect <<-EOF &&
519+
The bundle contains this ref:
520+
<TAG-2> refs/tags/v2
521+
The bundle records a complete history.
522+
$HASH_MESSAGE
523+
EOF
524+
test_cmp expect actual
525+
'
526+
527+
test_expect_success 'bundle between two tags' '
528+
git bundle create v1-v2.bdl \
529+
v1..v2 &&
530+
531+
git bundle verify v1-v2.bdl |
532+
make_user_friendly_and_stable_output >actual &&
533+
534+
format_and_save_expect <<-EOF &&
535+
The bundle contains this ref:
536+
<TAG-2> refs/tags/v2
537+
The bundle requires these 2 refs:
538+
<COMMIT-E> Z
539+
<COMMIT-B> Z
540+
$HASH_MESSAGE
541+
EOF
542+
test_cmp expect actual
543+
'
544+
511545
for filter in "blob:none" "tree:0" "tree:1" "blob:limit=100"
512546
do
513547
test_expect_success "filtered bundle: $filter" '

0 commit comments

Comments
 (0)