Skip to content

Commit 50c9403

Browse files
committed
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
2 parents 8502a77 + efe4be1 commit 50c9403

File tree

2 files changed

+36
-23
lines changed

2 files changed

+36
-23
lines changed

bundle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ int create_bundle(struct bundle_header *header, const char *path,
273273
if (!get_sha1_hex(buf.buf + 1, sha1)) {
274274
struct object *object = parse_object(sha1);
275275
object->flags |= UNINTERESTING;
276-
add_pending_object(&revs, object, buf.buf);
276+
add_pending_object(&revs, object, xstrdup(buf.buf));
277277
}
278278
} else if (!get_sha1_hex(buf.buf, sha1)) {
279279
struct object *object = parse_object(sha1);

t/t5510-fetch.sh

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ test_bundle_object_count () {
1414
test "$2" = $(grep '^[0-9a-f]\{40\} ' verify.out | wc -l)
1515
}
1616

17+
convert_bundle_to_pack () {
18+
while read x && test -n "$x"
19+
do
20+
:;
21+
done
22+
cat
23+
}
24+
1725
test_expect_success setup '
1826
echo >file original &&
1927
git add file &&
@@ -207,13 +215,7 @@ test_expect_success 'unbundle 1' '
207215

208216
test_expect_success 'bundle 1 has only 3 files ' '
209217
cd "$D" &&
210-
(
211-
while read x && test -n "$x"
212-
do
213-
:;
214-
done
215-
cat
216-
) <bundle1 >bundle.pack &&
218+
convert_bundle_to_pack <bundle1 >bundle.pack &&
217219
git index-pack bundle.pack &&
218220
test_bundle_object_count bundle.pack 3
219221
'
@@ -230,13 +232,7 @@ test_expect_success 'bundle does not prerequisite objects' '
230232
git add file2 &&
231233
git commit -m add.file2 file2 &&
232234
git bundle create bundle3 -1 HEAD &&
233-
(
234-
while read x && test -n "$x"
235-
do
236-
:;
237-
done
238-
cat
239-
) <bundle3 >bundle.pack &&
235+
convert_bundle_to_pack <bundle3 >bundle.pack &&
240236
git index-pack bundle.pack &&
241237
test_bundle_object_count bundle.pack 3
242238
'
@@ -434,14 +430,31 @@ test_expect_success 'fetch --dry-run' '
434430
'
435431

436432
test_expect_success "should be able to fetch with duplicate refspecs" '
437-
mkdir dups &&
438-
cd dups &&
439-
git init &&
440-
git config branch.master.remote three &&
441-
git config remote.three.url ../three/.git &&
442-
git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
443-
git config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
444-
git fetch three
433+
mkdir dups &&
434+
(
435+
cd dups &&
436+
git init &&
437+
git config branch.master.remote three &&
438+
git config remote.three.url ../three/.git &&
439+
git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
440+
git config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&
441+
git fetch three
442+
)
443+
'
444+
445+
test_expect_success 'all boundary commits are excluded' '
446+
test_commit base &&
447+
test_commit oneside &&
448+
git checkout HEAD^ &&
449+
test_commit otherside &&
450+
git checkout master &&
451+
test_tick &&
452+
git merge otherside &&
453+
ad=$(git log --no-walk --format=%ad HEAD) &&
454+
git bundle create twoside-boundary.bdl master --since="$ad" &&
455+
convert_bundle_to_pack <twoside-boundary.bdl >twoside-boundary.pack &&
456+
pack=$(git index-pack --fix-thin --stdin <twoside-boundary.pack) &&
457+
test_bundle_object_count .git/objects/pack/pack-${pack##pack }.pack 3
445458
'
446459

447460
test_done

0 commit comments

Comments
 (0)