Re: [PATCH 2/2] repack: make '--quiet' disable progress
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Dec 20, 2021, 13:37 UTC
- Message-ID
- <7969c9e5-dd57-705c-b554-67681b9af62f@gmail.com>
- In-Reply-To
- <YbzSfwQixuonrK/o@coredump.intra.peff.net>
On 12/17/2021 1:10 PM, Jeff King wrote:
> On Fri, Dec 17, 2021 at 04:28:46PM +0000, Derrick Stolee via GitGitGadget wrote:
Show 28 quoted lines
>> This is difficult to test because the isatty(2) already prevents the
>> progess indicators from appearing when we redirect stderr to a file.
>
> You'd need test_terminal. Something like this:
>
> diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
> index 8c4ba6500b..b673c49650 100755
> --- a/t/t7700-repack.sh
> +++ b/t/t7700-repack.sh
> @@ -5,6 +5,7 @@ test_description='git repack works correctly'
> . ./test-lib.sh
> . "${TEST_DIRECTORY}/lib-bitmap.sh"
> . "${TEST_DIRECTORY}/lib-midx.sh"
> +. "${TEST_DIRECTORY}/lib-terminal.sh"
>
> commit_and_pack () {
> test_commit "$@" 1>&2 &&
> @@ -387,4 +388,10 @@ test_expect_success '--write-midx -b packs non-kept objects' '
> )
> '
>
> +test_expect_success TTY '--quiet disables progress' '
> + test_terminal env GIT_PROGRESS_DELAY=0 \
> + git -C midx repack -ad --quiet --write-midx 2>stderr &&
> + test_must_be_empty stderr
> +'
> +
> test_doneThanks. I added this test.
When first running the test, it failed because I didn't have the IO::Pty Perl module installed. I'm not sure why I don't fail with other tests that use test_terminal. If someone knows more about what is going on, then maybe we need to expand the TTY prereq?
Thanks, -Stolee