Re: [PATCH v3] ls-files.c: add --dedup option

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

 



Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

> On Sat, Jan 16, 2021 at 10:48 PM 胡哲宁 <adlternative@xxxxxxxxx> wrote:
>> Eric Sunshine <sunshine@xxxxxxxxxxxxxx> 于2021年1月16日周六 下午3:13写道:
>> > > +       git switch -c dev &&
>> >
>> > If someone adds a new test after this test, then that new test will
>> > run in the "dev" branch, which might be unexpected or undesirable. It
>> > often is a good idea to ensure that tests do certain types of cleanup
>> > to avoid breaking subsequent tests. Here, it would be a good idea to
>> > ensure that the test switches back to the original branch when it
>> > finishes (regardless of whether it finishes successfully or
>> > unsuccessfully).
>> >
>> >     git switch -c dev &&
>> >     test_when_finished "git switch master" &&
>> >
>> > Or you could use `git switch -` if you don't want to hard-code the
>> > name "master" in the test (since there has been effort lately to
>> > remove that name from tests.
>> >
>> I have little confuse about I can use` test_when_finished "git switch master" `,
>> but I can't use` test_when_finished "git switch -" `,
>> why?
>
> You may use either one. I presented both as alternative approaches.

I am sensing a bit of miscommunication here.  You sound like you
still believe either would work OK, but to me, it sounds like that
the author claims the one of them does not work for him/her.

I do not think the test framework itself mucks with the reflog to
make switching to "-" (or "@{-1}") break, so I find it implausible
that "switch -" form not to work, and unlike your "either is OK", I
have a moderately strong preference to use the "go back to the
previous one, whatever it is called" form.

Thanks.




[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