Re: [PATCH v2] transport-helper: enforce atomic in push_refs_with_push
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 10, 2019, 17:53 UTC
- Message-ID
- <xmqqims9u679.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <xmqqpnmhu6mh.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
>> + # the new branch should not have been created upstream >> + test_must_fail git -C "$d" rev-parse refs/heads/atomic && > > The new branch should not have been created; if this rev-parse > succeeded, it would be a bug.
One thing I forgot. If refs/heads/atomic did not exist, but say refs/tags/refs/heads/atomic did, the rev-parse would succeed, which is a rather unfortunate source of confusion.
Of course, we know we have never touched "$d" to cause such a funny tag, so rev-parse is good enough in practice, but
git -C "$d" show-ref --verify refs/heads/atomic
would not dwim (its --verify mode was invented specifically for rectifying this issue with rev-parse, if I recall correctly), and is more appropriate best-practice version to write here, especially if we anticipate that future developers and Git users would treat this line as an example to mimic.
> Up to point, I have no possible improvements to offer ;-) > Very well done.
So, I lied, but still the tests looked quite well done.