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

Re: [Patch v2] t2027: avoid using pipes

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 13, 2017, 03:10 UTC
Message-ID
<xmqqk27tub1g.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170310083611.7374-1-pc44800@gmail.com>
Prathamesh Chavan <pc44800@gmail.com> writes:
> From: Prathamesh <pc44800@gmail.com>
Your e-mail header says 
	From: Prathamesh Chavan <pc44800@gmail.com>

and you probably have "[user] name = Prathamesh" somewhere in your config, and I think that is why we see the above line in format-patch output and on your sign-off. If you really prefer to be known as a person with a single name (without Chavan) to the community, that is fine, but if that is not the case, perhaps you'd want to review your config and fix this.

Show 5 quoted lines
> Whenever a git command is present in the upstream of a pipe, its failure
> gets masked by piping and hence it should be avoided for testing the
> upstream git command. By writing out the output of the git command to
> a file, we can test the exit codes of both the commands as a failure exit
> code in any command is able to stop the && chain.
OK.
> Signed-off-by: Prathamesh <pc44800@gmail.com>
Show 13 quoted lines
> diff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh
> index 848da5f36..a3e77fee5 100755
> --- a/t/t2027-worktree-list.sh
> +++ b/t/t2027-worktree-list.sh
> @@ -31,7 +31,8 @@ test_expect_success '"list" all worktrees from main' '
>  	test_when_finished "rm -rf here && git worktree prune" &&
>  	git worktree add --detach here master &&
>  	echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
> -	git worktree list | sed "s/  */ /g" >actual &&
> +	git worktree list >out &&
> +	sed "s/  */ /g" <out >actual &&
>  	test_cmp expect actual
>  '

We'll have "out" as a new leftover file, but it probably would not make too much of a difference. We already leave 'expect' and 'actual' in the working tree as known crufts.

Just FYI, if you want to clean them, there is already when_finished in this piece (and others) so you could do

    -test_when_finished "rm -rf here && git worktree prune" &&
    -test_when_finished "rm -rf here out actual expect && git worktree prune" &&

When a test fails, when_finished is not run, so this will not interfere with necessary debugging effort when/if somebody breaks "git worktree" and this test starts failing.

Previous: Prathamesh ChavanNext: pc44800@gmail.com
Message 4 of 13 in “t2027: avoid using pipes”
  1. t2027: avoid using pipesPrathamesh Chavan, Mar 9, 2017
  2. Christian CouderMar 9, 2017
  3. t2027: avoid using pipesPrathamesh Chavan, Mar 10, 2017
  4. Junio C HamanoMar 13, 2017
  5. t2027: avoid using pipespc44800@gmail.com, Mar 13, 2017
  6. t2027: avoid using pipesPrathamesh, Mar 13, 2017
  7. PrathameshMar 22, 2017
  8. Christian CouderMar 23, 2017
  9. [GSoC][PATCH v4] t2027: avoid using pipesPrathamesh Chavan, Mar 24, 2017
  10. Torsten BögershausenMar 24, 2017
  11. [GSoC][PATCH v4] t2027: avoid using pipesPrathamesh Chavan, Mar 24, 2017
  12. Stefan BellerApr 3, 2017
  13. [GSoC][PATCH v5] t2027: avoid using pipesPrathamesh Chavan, Apr 3, 2017

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.