Re: [PATCH v2 1/5] t1011: add testcase demonstrating accidental loss of user modifications

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 16, 2022 at 12:53 AM Ævar Arnfjörð Bjarmason
<avarab@xxxxxxxxx> wrote:
>
> On Fri, Jan 14 2022, Elijah Newren via GitGitGadget wrote:
>
> > From: Elijah Newren <newren@xxxxxxxxx>
> > [...]
> > +     test_path_is_file init.t &&
> > +     grep -q dirty init.t
> > [...]
> > +     test_path_is_file init.t &&
> > +     grep -q dirty init.t
>
> Maybe I'm missing something, but can these two just be:
>
>     grep dirty init.t
>
> I.e. won't grep report errors appropriately here, e.g.:
>
>     $ grep foo t
>     grep: t: Is a directory
>     $ grep foo x
>     grep: x: No such file or directory
>
> The only prior art I could find was the same pattern in your c449947a79d
> (directory rename detection: files/directories in the way of some
> renames, 2018-04-19).
>
> It's probably good to lose the "-q" too, unless this output is way too
> verbose without it. In any case the errors wouldn't be affected.

Fair point.  I believe my original test during development was just
test_path_is_file, then I came back later and decided I should check
the contents weren't lost.  A test_cmp might be a better choice to
replace both of these, because we don't really want to check that it
just has "dirty" somewhere in the file, but that it's been left alone
and only has those contents.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux