git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Victoria Dye via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: derrickstolee@github.com, johannes.schindelin@gmx.de,
	gitster@pobox.com, Victoria Dye <vdye@github.com>,
	Victoria Dye <vdye@github.com>
Subject: [PATCH 5/8] scalar-clone: add test coverage
Date: Wed, 31 Aug 2022 16:02:22 +0000	[thread overview]
Message-ID: <a3b7cb0a3bd1f56172db8420b9e80a26be1fda5d.1661961746.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1341.git.1661961746.gitgitgadget@gmail.com>

From: Victoria Dye <vdye@github.com>

Create a new test file ('t9211-scalar-clone.sh') to exercise the options and
behavior of the 'scalar clone' command.

Signed-off-by: Victoria Dye <vdye@github.com>
---
 t/t9211-scalar-clone.sh | 135 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 135 insertions(+)
 create mode 100755 t/t9211-scalar-clone.sh

diff --git a/t/t9211-scalar-clone.sh b/t/t9211-scalar-clone.sh
new file mode 100755
index 00000000000..9fbbc4de2c0
--- /dev/null
+++ b/t/t9211-scalar-clone.sh
@@ -0,0 +1,135 @@
+#!/bin/sh
+
+test_description='test the `scalar clone` subcommand'
+
+. ./test-lib.sh
+
+GIT_TEST_MAINT_SCHEDULER="crontab:test-tool crontab cron.txt,launchctl:true,schtasks:true"
+export GIT_TEST_MAINT_SCHEDULER
+
+test_expect_success 'set up repository to clone' '
+	rm -rf .git &&
+	git init to-clone &&
+	(
+		cd to-clone &&
+		git branch -m base &&
+
+		test_commit first &&
+		test_commit second &&
+		test_commit third &&
+
+		git switch -c parallel first &&
+		mkdir -p 1/2 &&
+		test_commit 1/2/3 &&
+
+		git switch base &&
+
+		# By default, permit
+		git config uploadpack.allowfilter true &&
+		git config uploadpack.allowanysha1inwant true
+	)
+'
+
+cleanup_clone () {
+	rm -rf "$1"
+}
+
+test_expect_success 'creates content in enlistment root' '
+	test_when_finished cleanup_clone cloned &&
+
+	scalar clone "file://$(pwd)/to-clone" cloned &&
+	ls -A cloned >enlistment-root &&
+	test_line_count = 1 enlistment-root &&
+	test_path_is_dir cloned/src &&
+	test_path_is_dir cloned/src/.git
+'
+
+test_expect_success 'with spaces' '
+	test_when_finished cleanup_clone "cloned with space" &&
+
+	scalar clone "file://$(pwd)/to-clone" "cloned with space" &&
+	test_path_is_dir "cloned with space" &&
+	test_path_is_dir "cloned with space/src" &&
+	test_path_is_dir "cloned with space/src/.git"
+'
+
+test_expect_success 'partial clone if supported by server' '
+	test_when_finished cleanup_clone cloned &&
+
+	scalar clone "file://$(pwd)/to-clone" cloned &&
+
+	(
+		cd cloned/src &&
+
+		# Two promisor packs: one for refs, the other for blobs
+		ls .git/objects/pack/pack-*.promisor >promisorlist &&
+		test_line_count = 2 promisorlist
+	)
+'
+
+test_expect_success 'fall back on full clone if partial unsupported' '
+	test_when_finished cleanup_clone cloned &&
+
+	test_config -C to-clone uploadpack.allowfilter false &&
+	test_config -C to-clone uploadpack.allowanysha1inwant false &&
+
+	scalar clone "file://$(pwd)/to-clone" cloned 2>err &&
+	grep "filtering not recognized by server, ignoring" err &&
+
+	(
+		cd cloned/src &&
+
+		# Still get a refs promisor file, but none for blobs
+		ls .git/objects/pack/pack-*.promisor >promisorlist &&
+		test_line_count = 1 promisorlist
+	)
+'
+
+test_expect_success 'initializes sparse-checkout by default' '
+	test_when_finished cleanup_clone cloned &&
+
+	scalar clone "file://$(pwd)/to-clone" cloned &&
+	(
+		cd cloned/src &&
+		test_cmp_config true core.sparseCheckout &&
+		test_cmp_config true core.sparseCheckoutCone
+	)
+'
+
+test_expect_success '--full-clone does not create sparse-checkout' '
+	test_when_finished cleanup_clone cloned &&
+
+	scalar clone --full-clone "file://$(pwd)/to-clone" cloned &&
+	(
+		cd cloned/src &&
+		test_cmp_config "" --default "" core.sparseCheckout &&
+		test_cmp_config "" --default "" core.sparseCheckoutCone
+	)
+'
+
+test_expect_success '--single-branch clones HEAD only' '
+	test_when_finished cleanup_clone cloned &&
+
+	scalar clone --single-branch "file://$(pwd)/to-clone" cloned &&
+	(
+		cd cloned/src &&
+		git for-each-ref refs/remotes/origin >out &&
+		test_line_count = 1 out &&
+		grep "refs/remotes/origin/base" out
+	)
+'
+
+test_expect_success '--no-single-branch clones all branches' '
+	test_when_finished cleanup_clone cloned &&
+
+	scalar clone --no-single-branch "file://$(pwd)/to-clone" cloned &&
+	(
+		cd cloned/src &&
+		git for-each-ref refs/remotes/origin >out &&
+		test_line_count = 2 out &&
+		grep "refs/remotes/origin/base" out &&
+		grep "refs/remotes/origin/parallel" out
+	)
+'
+
+test_done
-- 
gitgitgadget


  parent reply	other threads:[~2022-08-31 16:03 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31 16:02 [PATCH 0/8] scalar: integrate into core Git Victoria Dye via GitGitGadget
2022-08-31 16:02 ` [PATCH 1/8] scalar: fix command documentation section header Victoria Dye via GitGitGadget
2022-08-31 16:02 ` [PATCH 2/8] scalar: include in standard Git build & installation Victoria Dye via GitGitGadget
2022-09-01  9:11   ` Johannes Schindelin
2022-09-01 13:17     ` [PATCH 0/5] Makefile: split up $(test_bindir_programs) Ævar Arnfjörð Bjarmason
2022-09-01 13:17       ` [PATCH 1/5] Makefile: factor sed-powered '#!/bin/sh' munging into a variable Ævar Arnfjörð Bjarmason
2022-09-01 13:17       ` [PATCH 2/5] Makefile: define "TEST_{PROGRAM,OBJS}" variables earlier Ævar Arnfjörð Bjarmason
2022-09-01 13:17       ` [PATCH 3/5] Makefile: simplify $(test_bindir_programs) rule by splitting it up Ævar Arnfjörð Bjarmason
2022-09-01 13:17       ` [PATCH 4/5] Makefile: define bin-wrappers/% rules with a template Ævar Arnfjörð Bjarmason
2022-09-01 13:17       ` [PATCH 5/5] Makefile: fix "make clean && make bin-wrappers/$NAME" dependencies Ævar Arnfjörð Bjarmason
2022-09-01 15:02       ` [PATCH 0/5] Makefile: split up $(test_bindir_programs) Derrick Stolee
2022-09-02 12:38       ` Johannes Schindelin
2022-10-26 14:42       ` [PATCH v2 0/3] Makefile: fix issues with bin-wrappers/% rule Ævar Arnfjörð Bjarmason
2022-10-26 14:42         ` [PATCH v2 1/3] Makefile: factor sed-powered '#!/bin/sh' munging into a variable Ævar Arnfjörð Bjarmason
2022-10-26 17:51           ` Junio C Hamano
2022-10-26 14:42         ` [PATCH v2 2/3] Makefile: define "TEST_{PROGRAM,OBJS}" variables earlier Ævar Arnfjörð Bjarmason
2022-10-26 16:47           ` Junio C Hamano
2022-10-26 18:47             ` Ævar Arnfjörð Bjarmason
2022-10-26 19:13               ` Junio C Hamano
2022-10-26 14:42         ` [PATCH v2 3/3] Makefile: simplify $(test_bindir_programs) rule by splitting it up Ævar Arnfjörð Bjarmason
2022-10-26 18:48           ` Junio C Hamano
2022-10-26 19:14             ` Ævar Arnfjörð Bjarmason
2022-10-26 20:28               ` Junio C Hamano
2022-10-26 20:43                 ` Ævar Arnfjörð Bjarmason
2022-10-28  0:57         ` [PATCH v2 0/3] Makefile: fix issues with bin-wrappers/% rule Jeff King
2022-10-28  3:03           ` Ævar Arnfjörð Bjarmason
2022-10-31 22:28         ` [PATCH v3 0/4] Makefile: untangle bin-wrappers/% rule complexity Ævar Arnfjörð Bjarmason
2022-10-31 22:28           ` [PATCH v3 1/4] Makefile: factor sed-powered '#!/bin/sh' munging into a variable Ævar Arnfjörð Bjarmason
2022-10-31 22:28           ` [PATCH v3 2/4] Makefile: define "TEST_{PROGRAM,OBJS}" variables earlier Ævar Arnfjörð Bjarmason
2022-10-31 22:28           ` [PATCH v3 3/4] Makefile: rename "test_bindir_programs" variable, pre-declare Ævar Arnfjörð Bjarmason
2022-10-31 22:28           ` [PATCH v3 4/4] Makefile: simplify $(test_bindir_programs) rule by splitting it up Ævar Arnfjörð Bjarmason
2022-10-31 23:54           ` [PATCH v3 0/4] Makefile: untangle bin-wrappers/% rule complexity Taylor Blau
2022-11-01  1:29             ` Ævar Arnfjörð Bjarmason
2022-08-31 16:02 ` [PATCH 3/8] git help: special-case `scalar` Johannes Schindelin via GitGitGadget
2022-08-31 16:02 ` [PATCH 4/8] scalar: implement the `help` subcommand Johannes Schindelin via GitGitGadget
2022-08-31 16:48   ` Ævar Arnfjörð Bjarmason
2022-09-01 16:08     ` Victoria Dye
2022-09-01  8:51   ` Johannes Schindelin
2022-09-01  9:17   ` Johannes Schindelin
2022-08-31 16:02 ` Victoria Dye via GitGitGadget [this message]
2022-09-01  9:32   ` [PATCH 5/8] scalar-clone: add test coverage Johannes Schindelin
2022-09-01 23:49     ` Victoria Dye
2022-09-02  9:07       ` Johannes Schindelin
2022-09-02 16:52         ` Junio C Hamano
2022-08-31 16:02 ` [PATCH 6/8] t/perf: add Scalar performance tests Victoria Dye via GitGitGadget
2022-09-01  9:39   ` Johannes Schindelin
2022-09-01 16:15     ` Victoria Dye
2022-09-01 16:21       ` Victoria Dye
2022-09-02  9:16         ` Johannes Schindelin
2022-09-01 16:43   ` Junio C Hamano
2022-08-31 16:02 ` [PATCH 7/8] t/perf: add 'GIT_PERF_USE_SCALAR' run option Victoria Dye via GitGitGadget
2022-09-01  9:43   ` Johannes Schindelin
2022-09-02  4:00     ` Victoria Dye
2022-09-02  9:17       ` Johannes Schindelin
2022-08-31 16:02 ` [PATCH 8/8] Documentation/technical: include Scalar technical doc Victoria Dye via GitGitGadget
2022-08-31 17:03 ` [PATCH 0/8] scalar: integrate into core Git Ævar Arnfjörð Bjarmason
2022-08-31 18:42   ` Victoria Dye
2022-09-01  9:56 ` Johannes Schindelin
2022-09-02 15:56 ` [PATCH v2 0/9] " Victoria Dye via GitGitGadget
2022-09-02 15:56   ` [PATCH v2 1/9] scalar: fix command documentation section header Victoria Dye via GitGitGadget
2022-09-02 15:56   ` [PATCH v2 2/9] scalar: include in standard Git build & installation Victoria Dye via GitGitGadget
2022-09-02 15:56   ` [PATCH v2 3/9] git help: special-case `scalar` Johannes Schindelin via GitGitGadget
2022-09-02 15:56   ` [PATCH v2 4/9] scalar: implement the `help` subcommand Johannes Schindelin via GitGitGadget
2022-09-02 15:56   ` [PATCH v2 5/9] scalar: add to 'git help -a' command list Victoria Dye via GitGitGadget
2022-09-02 15:56   ` [PATCH v2 6/9] scalar-clone: add test coverage Victoria Dye via GitGitGadget
2022-09-02 15:56   ` [PATCH v2 7/9] t/perf: add Scalar performance tests Victoria Dye via GitGitGadget
2022-09-02 15:56   ` [PATCH v2 8/9] t/perf: add 'GIT_PERF_USE_SCALAR' run option Victoria Dye via GitGitGadget
2022-09-02 15:56   ` [PATCH v2 9/9] Documentation/technical: include Scalar technical doc Victoria Dye via GitGitGadget
2022-09-05 10:36   ` [PATCH v2 0/9] scalar: integrate into core Git Johannes Schindelin
2022-09-08 20:54   ` Derrick Stolee

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=a3b7cb0a3bd1f56172db8420b9e80a26be1fda5d.1661961746.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=vdye@github.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).