Re: [PATCH] t2028: fix minor error and issues in newly-added "worktree move" tests
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 5, 2018, 18:44 UTC
- Message-ID
- <CAPig+cQLmYQeRhPxvZHmY7gApnbE25H_KoSWs-ZjuBo4BruimQ@mail.gmail.com>
- In-Reply-To
- <xmqqh8pu9xmq.fsf@gitster-ct.c.googlers.com>
On Mon, Mar 5, 2018 at 1:37 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> SZEDER Gábor <szeder.dev@gmail.com> writes: > >> Could you please save 'git worktree's output into an intermediate >> file, and run 'grep' on the file's contents? > > Here is what I tentatively came up with, while deciding what should > be queued based on Eric's patch, as a possible squash/fixup.
Thanks for saving a round-trip. One comment below...
Show 11 quoted lines
> diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh > @@ -74,8 +75,10 @@ test_expect_success 'move worktree' ' > toplevel="$(pwd)" && > git worktree move source destination && > test_path_is_missing source && > - git worktree list --porcelain | grep "^worktree.*/destination" && > - ! git worktree list --porcelain | grep "^worktree.*/source" && > + git worktree list --porcelain >out && > + grep "^worktree.*/destination" out && > + git worktree list --porcelain >out && > + ! grep "^worktree.*/source" out &&
The second "git worktree list --porcelain >out" can be dropped, leaving the two grep's back-to-back since it they can test the same 'out' file
> git -C destination log --format=%s >actual2 && > echo init >expected2 && > test_cmp expected2 actual2