Re: [PATCH v3 0/2] [Outreachy][Patch v2] t3404: avoid losing exit status to pipes
- From
Usman Akinyemi <usmanakinyemi202@gmail.com>
- Date
- Oct 6, 2024, 16:18 UTC
- Message-ID
- <CAPSxiM9eExGxy5biEr_23tCKXaUQg=tsD57VR7e2SVdvVJR+Kg@mail.gmail.com>
- In-Reply-To
- <pull.1805.v3.git.git.1728230769.gitgitgadget@gmail.com>
Hello,
Kindly, help take a look if this is okay now.
Also, I wanted to change this also to use test_line_count, test 0 = $(grep -c "^[^#]" < .git/rebase-merge/git-rebase-todo)
But, I tried a different approach and the test kept failing.
Similar as
git show >output && count=$(grep NEVER output | wc -l) && test 0 = $count &&
Thank you.
On Sun, Oct 6, 2024 at 4:06 PM Usman Akinyemi via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 60 quoted lines
> > At the beginning of my task, I made the mistake of submitting two patches > for two separate commits instead of one. The first patch addressed the issue > of losing the Git exit status due to pipes. > > After submitting the first patch, I noticed that the output of wc -l was > failing due to trailing whitespace. I attempted to fix this by using tr -d > to remove the whitespace. However, instead of squashing the two patches into > one, I inadvertently created another commit. > > Eric Sunshine sunshine@sunshineco.com provided valuable feedback during the > review process. He explained the details of the patches to me and pointed > out that using tr -d was unnecessary to resolve the whitespace issue. > > The root cause of the whitespace issue was quoting $count in the test > command, which led to the inclusion of whitespace in the comparison. By > removing the quotes around $count, the comparison works as expected without > the need for tr -d. > > Signed-off-by: Usman Akinyemi > > Usman Akinyemi (2): > t3404: avoid losing exit status with focus on `git show` and `git > cat-files` > [Outreachy][Patch v1] t3404: employing test_line_count() to replace > test > > t/t3404-rebase-interactive.sh | 74 +++++++++++++++++++++++------------ > 1 file changed, 50 insertions(+), 24 deletions(-) > > > base-commit: 90fe3800b92a49173530828c0a17951abd30f0e1 > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1805%2FUnique-Usman%2Favoid_git_pipes-v3 > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1805/Unique-Usman/avoid_git_pipes-v3 > Pull-Request: https://github.com/git/git/pull/1805 > > Range-diff vs v2: > > 1: be5a691e96f ! 1: c9a0cca179b [Outreachy][Patch v1] t3404: avoid losing exit status to pipes > @@ Metadata > Author: Usman Akinyemi <usmanakinyemi202@gmail.com> > > ## Commit message ## > - [Outreachy][Patch v1] t3404: avoid losing exit status to pipes > + t3404: avoid losing exit status with focus on `git show` and `git cat-files` > > 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. > + command fails. This particular patch focuses on some of the instances > + which include `git show` and `git cat-files`. > > Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com> > > -: ----------- > 2: 37b1411ee2c [Outreachy][Patch v1] t3404: employing test_line_count() to replace test > > -- > gitgitgadget