diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-08-06 10:04:13 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-06 10:05:05 -0700 |
commit | 6caa96c2049a8f201a48c6890dbdbbe6b61ff06d (patch) | |
tree | ec295fa5a13ea2f4260efa567923902399375b71 /builtin/commit.c | |
parent | 406f326d271e0bacecdb00425422c5fa3f314930 (diff) |
t3206: test_when_finished before dirtying operations, not after
Many existing tests in this script perform operation(s) and then use
test_when_finished to define how to undo the effect of the
operation(s).
This is backwards. When your operation(s) fail before you manage to
successfully call test_when_finished (remember, that these commands
must be all &&-chained, so a failure of an earlier operation mean
your test_when_finished may not be executed at all). You must
establish how to clean up your mess with test_when_finished before
you create the mess to be cleaned up.
Also make sure that the body of test_when_finished deals with case
where the cruft it wants to remove failed to be created, by using
"rm -f" (instead of "rm") to remove potential cruft files, and
having "|| :" after "git notes remove" to remove potential cruft
notes---both of these by default fail when asked to remove something
that does not exist, instead of being silently idempotent no-ops.
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions