Subject: [PATCH v4 0/2] [Outreachy][Patch v2] t3404: avoid losing exit status to pipes

From: "Usman Akinyemi via GitGitGadget" <[email-masked]>
Date: Mon, 07 Oct 2024 10:22:09 +0000

Changes since v3:

 * Replaced the use of grep | wc -l with a simplified ! grep command to
   directly check for the absence of "NEVER" in the output. I was not able
   to add this in the second patch ( employing test_line_count() to replace
   test). I was able to come to this solution with the help of Eric and
   Patriack.

Usman Akinyemi (2):
  t3404: avoid losing exit status with focus on `git show` and `git
    cat-file`
  [Outreachy][Patch v1] t3404: employing test_line_count() to replace
    test

 t/t3404-rebase-interactive.sh | 73 +++++++++++++++++++++++------------
 1 file changed, 49 insertions(+), 24 deletions(-)

base-commit: 90fe3800b92a49173530828c0a17951abd30f0e1
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1805%2FUnique-Usman%2Favoid_git_pipes-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1805/Unique-Usman/avoid_git_pipes-v4
Pull-Request: https://github.com/git/git/pull/1805

Range-diff vs v3:

 1:  c9a0cca179b ! 1:  bfff7937cd2 t3404: avoid losing exit status with focus on `git show` and `git cat-files`
     @@ Metadata
      Author: Usman Akinyemi <[email-masked]>
      
       ## Commit message ##
     -    t3404: avoid losing exit status with focus on `git show` and `git cat-files`
     +    t3404: avoid losing exit status with focus on `git show` and `git cat-file`
      
          The exit code of the preceding command in a pipe is disregarded. So
          if that preceding command is a Git command that fails, the test would
          not fail. Instead, by saving the output of that Git command to a file,
          and removing the pipe, we make sure the test will fail if that Git
     -    command fails. This particular patch focuses on some of the instances
     -    which include `git show` and `git cat-files`.
     +    command fails. This particular patch focuses on all `git show` and
     +    some instances of `git cat-file`.
      
          Signed-off-by: Usman Akinyemi <[email-masked]>
      
 2:  37b1411ee2c ! 2:  864b00997b7 [Outreachy][Patch v1] t3404: employing test_line_count() to replace test
     @@ Commit message
      
          Signed-off-by: Usman Akinyemi <[email-masked]>
      
     +    removed test
     +
       ## t/t3404-rebase-interactive.sh ##
      @@ t/t3404-rebase-interactive.sh: test_expect_success 'stop on conflicting pick' '
       	test_cmp expect2 file1 &&
     @@ t/t3404-rebase-interactive.sh: test_expect_success 'multi-squash only fires up e
       '
       
       test_expect_success 'multi-fixup does not fire up editor' '
     +@@ t/t3404-rebase-interactive.sh: test_expect_success 'multi-fixup does not fire up editor' '
     + 	) &&
     + 	test $base = $(git rev-parse HEAD^) &&
     + 	git show >output &&
     +-	count=$(grep NEVER output | wc -l) &&
     +-	test 0 = $count &&
     ++	! grep NEVER output &&
     + 	git checkout @{-1} &&
     + 	git branch -D multi-fixup
     + '
      @@ t/t3404-rebase-interactive.sh: test_expect_success 'commit message used after conflict' '
       	) &&
       	test $base = $(git rev-parse HEAD^) &&

-- 
gitgitgadget