summaryrefslogtreecommitdiff
path: root/contrib/scalar/t/t9099-scalar.sh
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2021-12-03 13:34:23 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-12-04 21:52:23 -0800
commit546f822d53aa4b4b35f962d61cdcd1204f9e96e3 (patch)
tree0e11c78d957143c9bfdb039ed7466119c1befbe4 /contrib/scalar/t/t9099-scalar.sh
parentscalar: implement 'scalar list' (diff)
downloadtgif-546f822d53aa4b4b35f962d61cdcd1204f9e96e3.tar.xz
scalar: implement the `clone` subcommand
This implements Scalar's opinionated `clone` command: it tries to use a partial clone and sets up a sparse checkout by default. In contrast to `git clone`, `scalar clone` sets up the worktree in the `src/` subdirectory, to encourage a separation between the source files and the build output (which helps Git tremendously because it avoids untracked files that have to be specifically ignored when refreshing the index). Also, it registers the repository for regular, scheduled maintenance, and configures a flurry of configuration settings based on the experience and experiments of the Microsoft Windows and the Microsoft Office development teams. Note: since the `scalar clone` command is by far the most commonly called `scalar` subcommand, we document it at the top of the manual page. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/scalar/t/t9099-scalar.sh')
-rwxr-xr-xcontrib/scalar/t/t9099-scalar.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/contrib/scalar/t/t9099-scalar.sh b/contrib/scalar/t/t9099-scalar.sh
index ef0e8d680d..984d69e8f7 100755
--- a/contrib/scalar/t/t9099-scalar.sh
+++ b/contrib/scalar/t/t9099-scalar.sh
@@ -10,6 +10,9 @@ PATH=$PWD/..:$PATH
. ../../../t/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 'scalar shows a usage' '
test_expect_code 129 scalar -h
'
@@ -29,4 +32,33 @@ test_expect_success 'scalar unregister' '
! grep -F "$(pwd)/vanish/src" scalar.repos
'
+test_expect_success 'set up repository to clone' '
+ test_commit first &&
+ test_commit second &&
+ test_commit third &&
+ git switch -c parallel first &&
+ mkdir -p 1/2 &&
+ test_commit 1/2/3 &&
+ git config uploadPack.allowFilter true &&
+ git config uploadPack.allowAnySHA1InWant true
+'
+
+test_expect_success 'scalar clone' '
+ second=$(git rev-parse --verify second:second.t) &&
+ scalar clone "file://$(pwd)" cloned &&
+ (
+ cd cloned/src &&
+
+ git config --get --global --fixed-value maintenance.repo \
+ "$(pwd)" &&
+
+ test_path_is_missing 1/2 &&
+ test_must_fail git rev-list --missing=print $second &&
+ git rev-list $second &&
+ git cat-file blob $second >actual &&
+ echo "second" >expect &&
+ test_cmp expect actual
+ )
+'
+
test_done