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

[PATCH v2 0/2] bundle tests: modernize, fix missing coverage & test_cmp

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 21, 2021, 23:53 UTC
Message-ID
<cover-0.2-00000000000-20210721T235251Z-avarab@gmail.com>
In-Reply-To
<cover-0.2-00000000000-20210720T115052Z-avarab@gmail.com>

A trivial series to improve the bundle tests a bit. This is split off from some larger changes to "git bundle" I have cooking, where the "test_cmp" in 2/2 helped assert & catch regressions.

Ævar Arnfjörð Bjarmason (2):
  bundle tests: use ">file" not ": >file"
  bundle tests: use test_cmp instead of grep
 t/t5607-clone-bundle.sh | 72 ++++++++++++++++++++++++++++++++---------
 1 file changed, 56 insertions(+), 16 deletions(-)
Range-diff against v1:
1:  746d727113b ! 1:  2a77f80725d bundle tests: use ">file" not ": >file"
    @@ Metadata
      ## Commit message ##
         bundle tests: use ">file" not ": >file"
     
    -    Change redundant uses of ":" on the LHS of a ">" to the more commonly
    -    use ">file" pattern.
    +    Change uses of ":" on the LHS of a ">" to the more commonly used
    +    ">file" pattern in t/t5607-clone-bundle.sh.
     
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
2:  062f34abf1a ! 2:  d5504fd764c bundle tests: use test_cmp instead of grep
    @@ t/t5607-clone-bundle.sh: test_expect_success 'ridiculously long subject in bound
     -	sed -n "/^-/{p;q;}" long-subject-bundle.bdl >boundary &&
     -	grep "^-$OID_REGEX " boundary
     +
    -+	cat >expect.common <<-EOF &&
    ++	if ! test_have_prereq SHA1
    ++	then
    ++		echo "@object-format=sha256"
    ++	fi >expect &&
    ++	cat >>expect <<-EOF &&
     +	-$(git log --pretty=format:"%H %s" -1 HEAD^)
     +	$(git rev-parse HEAD) HEAD
     +	EOF
    ++
     +	if test_have_prereq SHA1
     +	then
    -+		cp expect.common expect
    -+	else
    -+		echo @object-format=sha256 >expect
    -+		cat expect.common >>expect
    -+	fi &&
    -+	if test_have_prereq SHA1
    -+	then
    -+		head -n 3 long-subject-bundle.bdl >bundle-header
    ++		head -n 3 long-subject-bundle.bdl
     +	else
    -+		head -n 4 long-subject-bundle.bdl >bundle-header
    -+	fi &&
    -+	grep -v "^#" bundle-header >actual &&
    ++		head -n 4 long-subject-bundle.bdl
    ++	fi | grep -v "^#" >actual &&
    ++
     +	test_cmp expect actual
      '
      
-- 
2.32.0.955.ge7c5360f7e7
Previous: Taylor BlauNext: Ævar Arnfjörð Bjarmason
Message 10 of 14 in “bundle tests: modernize, fix missing coverage & test_cmp”
  1. 0/2 bundle tests: modernize, fix missing coverage & test_cmpÆvar Arnfjörð Bjarmason, Jul 20, 2021
  2. 1/2 bundle tests: use ">file" not ": >file"Ævar Arnfjörð Bjarmason, Jul 20, 2021
  3. Junio C HamanoJul 20, 2021
  4. Felipe ContrerasJul 20, 2021
  5. 2/2 bundle tests: use test_cmp instead of grepÆvar Arnfjörð Bjarmason, Jul 20, 2021
  6. Taylor BlauJul 20, 2021
  7. Ævar Arnfjörð BjarmasonJul 21, 2021
  8. Taylor BlauJul 22, 2021
  9. Taylor BlauJul 20, 2021
  10. 0/2 bundle tests: modernize, fix missing coverage & test_cmpÆvar Arnfjörð Bjarmason, Jul 21, 2021
  11. 1/2 bundle tests: use ">file" not ": >file"Ævar Arnfjörð Bjarmason, Jul 21, 2021
  12. 2/2 bundle tests: use test_cmp instead of grepÆvar Arnfjörð Bjarmason, Jul 21, 2021
  13. Taylor BlauJul 22, 2021
  14. Taylor BlauJul 22, 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.