Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t4129: prevent loss of exit code due to the use of pipes #1636

Closed
wants to merge 1 commit into from

Conversation

Chand-ra
Copy link

@Chand-ra Chand-ra commented Jan 9, 2024

No description provided.

Piping the output of git commands like git-ls-files to another
command (grep in this case) hides the exit code returned by
these commands. Prevent this by storing the output of git-ls-files
to a temporary file and then "grep-ping" from that file. Replace
grep with test_grep as the latter is more verbose when it fails.

Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
@Chand-ra
Copy link
Author

/submit

Copy link

gitgitgadget bot commented Jan 10, 2024

Submitted as pull.1636.git.1704891257544.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-1636/Chand-ra/test_pipe-v1

To fetch this version to local tag pr-1636/Chand-ra/test_pipe-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-1636/Chand-ra/test_pipe-v1

Copy link

gitgitgadget bot commented Jan 10, 2024

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Chandra Pratap via GitGitGadget" <gitgitgadget@gmail.com> writes:

>  t/t4129-apply-samemode.sh | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Looks good.  Will queue with two instances of a minor style fix (see
below).

> diff --git a/t/t4129-apply-samemode.sh b/t/t4129-apply-samemode.sh
> index e7a7295f1b6..ffabeafa213 100755
> --- a/t/t4129-apply-samemode.sh
> +++ b/t/t4129-apply-samemode.sh
> @@ -41,7 +41,8 @@ test_expect_success FILEMODE 'same mode (index only)' '
>  	chmod +x file &&
>  	git add file &&
>  	git apply --cached patch-0.txt &&
> -	git ls-files -s file | grep "^100755"
> +	git ls-files -s file > ls-files-output &&

Redirection operator ">" and "<" sticks to the file in question
(look for "> " and "< " in this file and you'd find none), i.e.

	git ls-files -s file >ls-files-output &&

Thanks.

Copy link

gitgitgadget bot commented Jan 10, 2024

This branch is now known as cp/t4129-pipefix.

Copy link

gitgitgadget bot commented Jan 10, 2024

This patch series was integrated into seen via git@9ef2845.

@gitgitgadget gitgitgadget bot added the seen label Jan 10, 2024
Copy link

gitgitgadget bot commented Jan 12, 2024

This patch series was integrated into seen via git@0684b1e.

Copy link

gitgitgadget bot commented Jan 12, 2024

There was a status update in the "New Topics" section about the branch cp/t4129-pipefix on the Git mailing list:

Test update.

Will merge to 'next'.
source: <pull.1636.git.1704891257544.gitgitgadget@gmail.com>

Copy link

gitgitgadget bot commented Jan 13, 2024

This patch series was integrated into seen via git@b0c587d.

Copy link

gitgitgadget bot commented Jan 13, 2024

This patch series was integrated into next via git@fd9b72b.

@gitgitgadget gitgitgadget bot added the next label Jan 13, 2024
Copy link

gitgitgadget bot commented Jan 16, 2024

This patch series was integrated into seen via git@24e320a.

Copy link

gitgitgadget bot commented Jan 16, 2024

There was a status update in the "Cooking" section about the branch cp/t4129-pipefix on the Git mailing list:

Test update.

Will merge to 'master'.
source: <pull.1636.git.1704891257544.gitgitgadget@gmail.com>

Copy link

gitgitgadget bot commented Jan 17, 2024

This patch series was integrated into seen via git@bf84fef.

Copy link

gitgitgadget bot commented Jan 18, 2024

This patch series was integrated into seen via git@b421118.

Copy link

gitgitgadget bot commented Jan 20, 2024

This patch series was integrated into seen via git@1b09562.

Copy link

gitgitgadget bot commented Jan 20, 2024

This patch series was integrated into master via git@1b09562.

Copy link

gitgitgadget bot commented Jan 20, 2024

This patch series was integrated into next via git@1b09562.

@gitgitgadget gitgitgadget bot added the master label Jan 20, 2024
Copy link

gitgitgadget bot commented Jan 20, 2024

Closed via 1b09562.

@gitgitgadget gitgitgadget bot closed this Jan 20, 2024
@Chand-ra Chand-ra deleted the test_pipe branch May 10, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant