Skip to content

Commit e642fdc

Browse files
committed
Merge branch 'th/promisor-quiet-per-repo' into jch
Comments? * th/promisor-quiet-per-repo: promisor-remote: fix promisor.quiet to use the correct repository
2 parents d017d8c + fa1468a commit e642fdc

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

promisor-remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static int fetch_objects(struct repository *repo,
5353
"fetch", remote_name, "--no-tags",
5454
"--no-write-fetch-head", "--recurse-submodules=no",
5555
"--filter=blob:none", "--stdin", NULL);
56-
if (!repo_config_get_bool(the_repository, "promisor.quiet", &quiet) && quiet)
56+
if (!repo_config_get_bool(repo, "promisor.quiet", &quiet) && quiet)
5757
strvec_push(&child.args, "--quiet");
5858
if (start_command(&child))
5959
die(_("promisor-remote: unable to fork off fetch subprocess"));

t/t0410-partial-clone.sh

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,29 @@ test_expect_success 'setup for promisor.quiet tests' '
717717
git -C server rm foo.t &&
718718
git -C server commit -m remove &&
719719
git -C server config uploadpack.allowanysha1inwant 1 &&
720-
git -C server config uploadpack.allowfilter 1
720+
git -C server config uploadpack.allowfilter 1 &&
721+
722+
# Setup for submodule repo test: superproject whose submodule is a
723+
# partial clone, so that promisor.quiet is read via a non-main repo.
724+
rm -rf sub-pc-src sub-pc-srv.bare super-src super-work &&
725+
git init sub-pc-src &&
726+
test_commit -C sub-pc-src initial file.txt "hello" &&
727+
728+
git clone --bare sub-pc-src sub-pc-srv.bare &&
729+
git -C sub-pc-srv.bare config uploadpack.allowfilter 1 &&
730+
git -C sub-pc-srv.bare config uploadpack.allowanysha1inwant 1 &&
731+
732+
git init super-src &&
733+
git -C super-src -c protocol.file.allow=always \
734+
submodule add "file://$(pwd)/sub-pc-srv.bare" sub &&
735+
git -C super-src commit -m "add submodule" &&
736+
737+
git -c protocol.file.allow=always clone super-src super-work &&
738+
git -C super-work -c protocol.file.allow=always \
739+
submodule update --init --filter=blob:none sub &&
740+
741+
# Allow file:// in the submodule so that lazy-fetch subprocesses work.
742+
git -C super-work/sub config protocol.file.allow always
721743
'
722744

723745
test_expect_success TTY 'promisor.quiet=false shows progress messages' '
@@ -752,6 +774,27 @@ test_expect_success TTY 'promisor.quiet=unconfigured shows progress messages' '
752774
grep "Receiving objects" err
753775
'
754776

777+
test_expect_success 'promisor.quiet from submodule repo is honored' '
778+
rm -f pc-quiet-trace &&
779+
780+
# Set promisor.quiet only in the submodule, not the superproject.
781+
git -C super-work/sub config promisor.quiet true &&
782+
783+
# Push a new commit+blob to the server; the blob stays missing in the
784+
# partial-clone submodule until a lazy fetch is triggered.
785+
test_commit -C sub-pc-src updated new-file.txt "world" &&
786+
git -C sub-pc-src push "$(pwd)/sub-pc-srv.bare" HEAD:master &&
787+
git -C super-work/sub -c protocol.file.allow=always fetch origin &&
788+
git -C super-work/sub reset --mixed origin/master &&
789+
790+
# grep descends into the submodule and triggers a lazy fetch for the
791+
# missing blob; verify the fetch subprocess carries --quiet.
792+
GIT_TRACE2_EVENT="$(pwd)/pc-quiet-trace" \
793+
git -C super-work grep --cached --recurse-submodules "world" \
794+
2>/dev/null &&
795+
grep negotiationAlgorithm pc-quiet-trace | grep -e --quiet
796+
'
797+
755798
. "$TEST_DIRECTORY"/lib-httpd.sh
756799
start_httpd
757800

0 commit comments

Comments
 (0)