Skip to content

Commit d11b0c7

Browse files
committed
Merge branch 'th/quiet-lazy-fetch-from-promisor'
The promisor.quiet configuration knob can be set to true to make lazy fetching from promisor remotes silent. * th/quiet-lazy-fetch-from-promisor: promisor-remote: add promisor.quiet configuration option
2 parents cf79265 + 7e17d95 commit d11b0c7

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

Documentation/config.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,8 @@ include::config/pager.txt[]
488488

489489
include::config/pretty.txt[]
490490

491+
include::config/promisor.txt[]
492+
491493
include::config/protocol.txt[]
492494

493495
include::config/pull.txt[]

Documentation/config/promisor.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
promisor.quiet::
2+
If set to "true" assume `--quiet` when fetching additional
3+
objects for a partial clone.

promisor-remote.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static int fetch_objects(struct repository *repo,
2323
struct child_process child = CHILD_PROCESS_INIT;
2424
int i;
2525
FILE *child_in;
26+
int quiet;
2627

2728
if (git_env_bool(NO_LAZY_FETCH_ENVIRONMENT, 0)) {
2829
static int warning_shown;
@@ -41,6 +42,8 @@ static int fetch_objects(struct repository *repo,
4142
"fetch", remote_name, "--no-tags",
4243
"--no-write-fetch-head", "--recurse-submodules=no",
4344
"--filter=blob:none", "--stdin", NULL);
45+
if (!git_config_get_bool("promisor.quiet", &quiet) && quiet)
46+
strvec_push(&child.args, "--quiet");
4447
if (start_command(&child))
4548
die(_("promisor-remote: unable to fork off fetch subprocess"));
4649
child_in = xfdopen(child.in, "w");

t/t0410-partial-clone.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
test_description='partial clone'
44

55
. ./test-lib.sh
6+
. "$TEST_DIRECTORY"/lib-terminal.sh
67

78
# missing promisor objects cause repacks which write bitmaps to fail
89
GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=0
@@ -708,6 +709,48 @@ test_expect_success 'push should not fetch new commit objects' '
708709
grep "^[?]$COMMIT" objects
709710
'
710711

712+
test_expect_success 'setup for promisor.quiet tests' '
713+
rm -rf server &&
714+
test_create_repo server &&
715+
test_commit -C server foo &&
716+
git -C server rm foo.t &&
717+
git -C server commit -m remove &&
718+
git -C server config uploadpack.allowanysha1inwant 1 &&
719+
git -C server config uploadpack.allowfilter 1
720+
'
721+
722+
test_expect_success TTY 'promisor.quiet=false shows progress messages' '
723+
rm -rf repo &&
724+
git clone --filter=blob:none "file://$(pwd)/server" repo &&
725+
git -C repo config promisor.quiet "false" &&
726+
727+
test_terminal git -C repo cat-file -p foo:foo.t 2>err &&
728+
729+
# Ensure that progress messages are written
730+
grep "Receiving objects" err
731+
'
732+
733+
test_expect_success TTY 'promisor.quiet=true does not show progress messages' '
734+
rm -rf repo &&
735+
git clone --filter=blob:none "file://$(pwd)/server" repo &&
736+
git -C repo config promisor.quiet "true" &&
737+
738+
test_terminal git -C repo cat-file -p foo:foo.t 2>err &&
739+
740+
# Ensure that no progress messages are written
741+
! grep "Receiving objects" err
742+
'
743+
744+
test_expect_success TTY 'promisor.quiet=unconfigured shows progress messages' '
745+
rm -rf repo &&
746+
git clone --filter=blob:none "file://$(pwd)/server" repo &&
747+
748+
test_terminal git -C repo cat-file -p foo:foo.t 2>err &&
749+
750+
# Ensure that progress messages are written
751+
grep "Receiving objects" err
752+
'
753+
711754
. "$TEST_DIRECTORY"/lib-httpd.sh
712755
start_httpd
713756

0 commit comments

Comments
 (0)