t2028: tighten grep expression to make "move worktree" test more robust
commitb1801b85a32e21a7e83d165b029b5115ab0f8167
authorEric Sunshine <sunshine@sunshineco.com>
Tue, 3 Apr 2018 09:25:41 +0000 (3 05:25 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Apr 2018 07:08:33 +0000 (5 16:08 +0900)
tree707b0e2305042a24ec5862e1db4d6a25f217806e
parent7f19def0fc254829839495f7fb44a7d99b161d3d
t2028: tighten grep expression to make "move worktree" test more robust

Following a rename of worktree "source" to "destination", the "move
worktree" test uses grep to verify that the output of "git worktree list
--porcelain" does not contain "source" (and does contain "destination").
Unfortunately, the grep expression is too loose and can match
unexpectedly. For example, if component of the test trash directory path
matches "source" (e.g. "/home/me/sources/git/t/trash*"), then the test
will be fooled into thinking that "source" still exists. Tighten the
expression to avoid such accidental matches.

While at it, drop an unused variable ("toplevel") from the test and
tighten a similarly too-loose expression in a related test.

Reported-by: Jens Krüger <Jens.Krueger@frm2.tum.de>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2028-worktree-move.sh