mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
8ddfce7144
We have a small helper function called "verbose", with the idea that you can write: verbose foo to get a message to stderr when the "foo" command fails, even if it does not produce any output itself. This goes back to8ad1652418
(t5304: use helper to report failure of "test foo = bar", 2014-10-10). It does work, but overall it has not been a big success for two reasons: 1. Test writers have to remember to put it there (and the resulting test code is longer as a result). 2. It doesn't handle the opposite case (we expect "foo" to fail, but it succeeds), leading to inconsistencies in tests (which you can see in many hunks of this patch, e.g. ones involving "has_cr"). Most importantly, we addeda136f6d8ff
(test-lib.sh: support -x option for shell-tracing, 2014-10-10) at the same time, and it does roughly the same thing. The output is not quite as succinct as "verbose", and you have to watch out for stray shell-traces ending up in stderr. But it solves both of the problems above, and has clearly become the preferred tool. Let's consider the "verbose" function a failed experiment and remove the last few callers (which are all many years old, and have been dwindling as we remove them from scripts we touch for other reasons). It will be one less thing for new test writers to see and wonder if they should be using themselves. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
30 lines
662 B
Bash
Executable file
30 lines
662 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2016 Johannes Schindelin
|
|
#
|
|
|
|
test_description='Pickaxe options'
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
test_commit initial &&
|
|
printf "%04096d" 0 >4096-zeroes.txt &&
|
|
git add 4096-zeroes.txt &&
|
|
test_tick &&
|
|
git commit -m "A 4k file"
|
|
'
|
|
|
|
# OpenBSD only supports up to 255 repetitions, so repeat twice for 64*64=4096.
|
|
test_expect_success '-G matches' '
|
|
git diff --name-only -G "^(0{64}){64}$" HEAD^ >out &&
|
|
test 4096-zeroes.txt = "$(cat out)"
|
|
'
|
|
|
|
test_expect_success '-S --pickaxe-regex' '
|
|
git diff --name-only -S0 --pickaxe-regex HEAD^ >out &&
|
|
test 4096-zeroes.txt = "$(cat out)"
|
|
'
|
|
|
|
test_done
|