git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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_done
Thanks. 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

Previous: Jeff KingNext: Jeff King
Message 9 of 17 in “Two small 'git repack' fixes”
  1. 0/2 Two small 'git repack' fixesDerrick Stolee via GitGitGadget, Dec 17, 2021
  2. 1/2 repack: respect kept objects with '--write-midx -b'Derrick Stolee via GitGitGadget, Dec 17, 2021
  3. Jeff KingDec 17, 2021
  4. Derrick StoleeDec 20, 2021
  5. Jeff KingDec 20, 2021
  6. Ævar Arnfjörð BjarmasonDec 18, 2021
  7. 2/2 repack: make '--quiet' disable progressDerrick Stolee via GitGitGadget, Dec 17, 2021
  8. Jeff KingDec 17, 2021
  9. Derrick StoleeDec 20, 2021
  10. Jeff KingDec 20, 2021
  11. Derrick StoleeDec 20, 2021
  12. Ævar Arnfjörð BjarmasonDec 18, 2021
  13. Derrick StoleeDec 20, 2021
  14. 0/2 Two small 'git repack' fixesDerrick Stolee via GitGitGadget, Dec 20, 2021
  15. 2/2 repack: make '--quiet' disable progressDerrick Stolee via GitGitGadget, Dec 20, 2021
  16. 1/2 repack: respect kept objects with '--write-midx -b'Derrick Stolee via GitGitGadget, Dec 20, 2021
  17. Ævar Arnfjörð BjarmasonDec 20, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.