git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Han Young <hanyang.tony@bytedance.com>
To: git@vger.kernel.org
Cc: calvinwan@google.com, jonathantanmy@google.com,
	sokcevic@google.com, gitster@pobox.com,
	phillip.wood123@gmail.com, Han Young <hanyang.tony@bytedance.com>
Subject: [PATCH v3 2/3] repack: adapt tests to repack changes
Date: Fri, 11 Oct 2024 16:24:03 +0800	[thread overview]
Message-ID: <20241011082404.88939-3-hanyang.tony@bytedance.com> (raw)
In-Reply-To: <20241011082404.88939-1-hanyang.tony@bytedance.com>

In the previous commit, we changed how partial repo is cloned.
Adapt tests to these changes. Also check gc does not delete normal
objects too.

Signed-off-by: Han Young <hanyang.tony@bytedance.com>
---
 t/t0410-partial-clone.sh              | 68 +--------------------------
 t/t5616-partial-clone.sh              |  9 +---
 t/t5710-promisor-remote-capability.sh | 15 ++++--
 3 files changed, 14 insertions(+), 78 deletions(-)

diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index 818700fbec..c87102fcb7 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -500,46 +500,6 @@ test_expect_success 'single promisor remote can be re-initialized gracefully' '
 	git -C repo fetch --filter=blob:none foo
 '
 
-test_expect_success 'gc repacks promisor objects separately from non-promisor objects' '
-	rm -rf repo &&
-	test_create_repo repo &&
-	test_commit -C repo one &&
-	test_commit -C repo two &&
-
-	TREE_ONE=$(git -C repo rev-parse one^{tree}) &&
-	printf "$TREE_ONE\n" | pack_as_from_promisor &&
-	TREE_TWO=$(git -C repo rev-parse two^{tree}) &&
-	printf "$TREE_TWO\n" | pack_as_from_promisor &&
-
-	git -C repo config core.repositoryformatversion 1 &&
-	git -C repo config extensions.partialclone "arbitrary string" &&
-	git -C repo gc &&
-
-	# Ensure that exactly one promisor packfile exists, and that it
-	# contains the trees but not the commits
-	ls repo/.git/objects/pack/pack-*.promisor >promisorlist &&
-	test_line_count = 1 promisorlist &&
-	PROMISOR_PACKFILE=$(sed "s/.promisor/.pack/" <promisorlist) &&
-	git verify-pack $PROMISOR_PACKFILE -v >out &&
-	grep "$TREE_ONE" out &&
-	grep "$TREE_TWO" out &&
-	! grep "$(git -C repo rev-parse one)" out &&
-	! grep "$(git -C repo rev-parse two)" out &&
-
-	# Remove the promisor packfile and associated files
-	rm $(sed "s/.promisor//" <promisorlist).* &&
-
-	# Ensure that the single other pack contains the commits, but not the
-	# trees
-	ls repo/.git/objects/pack/pack-*.pack >packlist &&
-	test_line_count = 1 packlist &&
-	git verify-pack repo/.git/objects/pack/pack-*.pack -v >out &&
-	grep "$(git -C repo rev-parse one)" out &&
-	grep "$(git -C repo rev-parse two)" out &&
-	! grep "$TREE_ONE" out &&
-	! grep "$TREE_TWO" out
-'
-
 test_expect_success 'gc does not repack promisor objects if there are none' '
 	rm -rf repo &&
 	test_create_repo repo &&
@@ -570,7 +530,7 @@ repack_and_check () {
 	git -C repo2 cat-file -e $3
 }
 
-test_expect_success 'repack -d does not irreversibly delete promisor objects' '
+test_expect_success 'repack -d does not irreversibly delete objects' '
 	rm -rf repo &&
 	test_create_repo repo &&
 	git -C repo config core.repositoryformatversion 1 &&
@@ -584,40 +544,14 @@ test_expect_success 'repack -d does not irreversibly delete promisor objects' '
 	TWO=$(git -C repo rev-parse HEAD^^) &&
 	THREE=$(git -C repo rev-parse HEAD^) &&
 
-	printf "$TWO\n" | pack_as_from_promisor &&
 	printf "$THREE\n" | pack_as_from_promisor &&
 	delete_object repo "$ONE" &&
 
-	repack_and_check --must-fail -ab "$TWO" "$THREE" &&
 	repack_and_check -a "$TWO" "$THREE" &&
 	repack_and_check -A "$TWO" "$THREE" &&
 	repack_and_check -l "$TWO" "$THREE"
 '
 
-test_expect_success 'gc stops traversal when a missing but promised object is reached' '
-	rm -rf repo &&
-	test_create_repo repo &&
-	test_commit -C repo my_commit &&
-
-	TREE_HASH=$(git -C repo rev-parse HEAD^{tree}) &&
-	HASH=$(promise_and_delete $TREE_HASH) &&
-
-	git -C repo config core.repositoryformatversion 1 &&
-	git -C repo config extensions.partialclone "arbitrary string" &&
-	git -C repo gc &&
-
-	# Ensure that the promisor packfile still exists, and remove it
-	test -e repo/.git/objects/pack/pack-$HASH.pack &&
-	rm repo/.git/objects/pack/pack-$HASH.* &&
-
-	# Ensure that the single other pack contains the commit, but not the tree
-	ls repo/.git/objects/pack/pack-*.pack >packlist &&
-	test_line_count = 1 packlist &&
-	git verify-pack repo/.git/objects/pack/pack-*.pack -v >out &&
-	grep "$(git -C repo rev-parse HEAD)" out &&
-	! grep "$TREE_HASH" out
-'
-
 test_expect_success 'do not fetch when checking existence of tree we construct ourselves' '
 	rm -rf repo &&
 	test_create_repo repo &&
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index 2c2c50e3ff..19166cd4ce 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -643,16 +643,9 @@ test_expect_success 'fetch from a partial clone, protocol v2' '
 	grep "version 2" trace
 '
 
-test_expect_success 'repack does not loosen promisor objects' '
-	rm -rf client trace &&
-	git clone --bare --filter=blob:none "file://$(pwd)/srv.bare" client &&
-	test_when_finished "rm -rf client trace" &&
-	GIT_TRACE2_PERF="$(pwd)/trace" git -C client repack -A -d &&
-	grep "loosen_unused_packed_objects/loosened:0" trace
-'
-
 test_expect_success 'lazy-fetch in submodule succeeds' '
 	# setup
+	rm -rf client &&
 	test_config_global protocol.file.allow always &&
 
 	test_when_finished "rm -rf src-sub" &&
diff --git a/t/t5710-promisor-remote-capability.sh b/t/t5710-promisor-remote-capability.sh
index c2c83a5914..0912acae44 100755
--- a/t/t5710-promisor-remote-capability.sh
+++ b/t/t5710-promisor-remote-capability.sh
@@ -32,17 +32,26 @@ check_missing_objects () {
 }
 
 initialize_server () {
-	# Repack everything first
-	git -C server -c repack.writebitmaps=false repack -a -d &&
+	git -C server remote remove server2
+	has_promisor_remote=$?
 
 	# Remove promisor file in case they exist, useful when reinitializing
 	rm -rf server/objects/pack/*.promisor &&
 
+	# Repack everything first
+	git -C server -c repack.writebitmaps=false repack -a -d &&
+
 	# Repack without the largest object and create a promisor pack on server
 	git -C server -c repack.writebitmaps=false repack -a -d \
 	    --filter=blob:limit=5k --filter-to="$(pwd)" &&
 	promisor_file=$(ls server/objects/pack/*.pack | sed "s/\.pack/.promisor/") &&
-	touch "$promisor_file" &&
+	touch "$promisor_file"
+
+	# Configure server2 as promisor remote for server
+	if [[ $has_promisor_remote -eq 0 ]]; then
+	    	git -C server remote add server2 "file://$(pwd)/server2" &&
+	    	git -C server config remote.server2.promisor true
+	fi
 
 	# Check that only one object is missing on the server
 	check_missing_objects server 1 "$oid"
-- 
2.47.0.266.g0b04b6b485.dirty


  parent reply	other threads:[~2024-10-11  8:24 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02  7:31 [PATCH 0/1] revision: fix reachable objects being gc'ed in no blob clone repo Han Young
2024-08-02  7:31 ` [PATCH 1/1] revision: don't set parents as uninteresting if exclude promisor objects Han Young
2024-08-02 16:45   ` Junio C Hamano
2024-08-12 12:34     ` [External] " 韩仰
2024-08-12 16:09       ` Junio C Hamano
2024-08-22  8:28         ` 韩仰
2024-08-13  0:45 ` [PATCH 0/1] revision: fix reachable objects being gc'ed in no blob clone repo Jonathan Tan
2024-08-13 17:18   ` Jonathan Tan
2024-08-14  4:10     ` Junio C Hamano
2024-08-14 19:30       ` Jonathan Tan
2024-08-23 12:43 ` [WIP v2 0/4] " Han Young
2024-08-23 12:43   ` [WIP v2 1/4] packfile: split promisor objects oidset into two Han Young
2024-08-23 12:43   ` [WIP v2 2/4] revision: add exclude-promisor-pack-objects option Han Young
2024-08-23 12:43   ` [WIP v2 3/4] revision: don't mark commit as UNINTERESTING if --exclude-promisor-objects is set Han Young
2024-08-23 12:43   ` [WIP v2 4/4] repack: use new exclude promisor pack objects option Han Young
2024-09-19 23:47 ` [PATCH 0/2] revision: fix reachable commits being gc'ed in partial repo Calvin Wan
2024-09-19 23:47 ` [PATCH 1/2] packfile: split promisor objects oidset into two Calvin Wan
2024-09-22  6:37   ` Junio C Hamano
2024-09-19 23:47 ` [PATCH 2/2] fetch-pack.c: do not declare local commits as "have" in partial repos Calvin Wan
2024-09-22  6:53   ` Junio C Hamano
2024-09-22 16:41     ` Junio C Hamano
2024-09-23  3:44     ` [External] " 韩仰
2024-09-23 16:21       ` Junio C Hamano
2024-10-02 22:35       ` Calvin Wan
2024-09-25  7:20 ` [PATCH 0/2] repack: pack everything into promisor packfile " Han Young
2024-09-25  7:20   ` [PATCH 1/2] repack: pack everything into packfile Han Young
2024-09-25  7:20   ` [PATCH 2/2] t0410: adapt tests to repack changes Han Young
2024-09-25 15:20   ` [PATCH 0/2] repack: pack everything into promisor packfile in partial repos Phillip Wood
2024-09-25 16:48     ` Junio C Hamano
2024-09-25 17:03   ` Junio C Hamano
2024-10-01 19:17 ` Missing Promisor Objects in Partial Repo Design Doc Calvin Wan
2024-10-01 19:35   ` Junio C Hamano
2024-10-02  2:54   ` Junio C Hamano
2024-10-02  7:57     ` [External] " Han Young
2024-10-08 21:35     ` Calvin Wan
2024-10-09  6:46       ` [External] " Han Young
2024-10-09 18:34         ` Jonathan Tan
2024-10-12  2:05           ` Jonathan Tan
2024-10-12  3:30             ` Han Young
2024-10-14 17:52               ` Jonathan Tan
2024-10-09 18:53     ` Jonathan Tan
2024-10-08  8:13 ` [PATCH v2 0/3] repack: pack everything into promisor packfile in partial repos Han Young
2024-10-08  8:13   ` [PATCH v2 1/3] repack: pack everything into packfile Han Young
2024-10-08 21:41     ` Calvin Wan
2024-10-08  8:13   ` [PATCH v2 2/3] t0410: adapt tests to repack changes Han Young
2024-10-08  8:13   ` [PATCH v2 3/3] partial-clone: update doc Han Young
2024-10-08 21:57   ` [PATCH v2 0/3] repack: pack everything into promisor packfile in partial repos Junio C Hamano
2024-10-08 22:43     ` Junio C Hamano
2024-10-09  6:31     ` [External] " Han Young
2024-10-11  8:24 ` [PATCH v3 " Han Young
2024-10-11  8:24   ` [PATCH v3 1/3] repack: pack everything into packfile Han Young
2024-10-11  8:24   ` Han Young [this message]
2024-10-11  8:24   ` [PATCH v3 3/3] partial-clone: update doc Han Young
2024-10-11 18:18   ` [PATCH v3 0/3] repack: pack everything into promisor packfile in partial repos Junio C Hamano
2024-10-11 18:23     ` Junio C Hamano
2024-10-14  3:25 ` [PATCH v4 " Han Young
2024-10-14  3:25   ` [PATCH v4 1/3] repack: pack everything into packfile Han Young
2024-10-14  3:25   ` [PATCH v4 2/3] t0410: adapt tests to repack changes Han Young
2024-10-14  3:25   ` [PATCH v4 3/3] partial-clone: update doc Han Young
2024-10-21 22:29   ` [WIP 0/3] Repack on fetch Jonathan Tan
2024-10-21 22:29     ` [WIP 1/3] move variable Jonathan Tan
2024-10-21 22:29     ` [WIP 2/3] pack-objects Jonathan Tan
2024-10-21 22:29     ` [WIP 3/3] record local links and call pack-objects Jonathan Tan
2024-10-23  7:00     ` [External] [WIP 0/3] Repack on fetch Han Young
2024-10-23 17:03       ` Jonathan Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241011082404.88939-3-hanyang.tony@bytedance.com \
    --to=hanyang.tony@bytedance.com \
    --cc=calvinwan@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jonathantanmy@google.com \
    --cc=phillip.wood123@gmail.com \
    --cc=sokcevic@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).