Re: [PATCH v1 1/7] t7002: add tests for moving from in-cone to out-of-cone
- From
Derrick Stolee <derrickstolee@github.com>
- Date
- Jul 19, 2022, 17:36 UTC
- Message-ID
- <d914bd30-0f53-864e-b640-0173d168bcb5@github.com>
- In-Reply-To
- <220719.86pmi1up9d.gmgdl@evledraar.gmail.com>
On 7/19/2022 10:52 AM, Ævar Arnfjörð Bjarmason wrote:
Show 12 quoted lines
> > On Tue, Jul 19 2022, Shaoxuan Yuan wrote: > >> + ! grep -x "H sub/d" actual && >> + grep -x "S folder1/d" actual > > This *might* be a portability problem, but probably not. It's listed in > POSIX: > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html > > But it appears we have no "grep" use of the "-x" option in-tree, at > least from what I found with grepping..
It is helpful to recommend a working alternative when pointing out an issue like this.
Here, the '-x' option means to match the entire line.
Would using ^ and $ help here?
! grep "^H sub/d\$" actual && grep "^S folder1/d\$" actual
I haven't tested this, but hopefully the idea is sound. If not, then you could make the names be sufficiently unique that whole-lines are the only way they could match. We do have some expectation about what lines are possible in this index, since we constructed the example repo from scratch.
Thanks, -Stolee