Re: [PATCH 3/7] test patch hunk editing with "commit -p -m"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 17, 2014, 18:53 UTC
- Message-ID
- <xmqqmwgoejwq.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1394919750-28432-3-git-send-email-benoit.pierre@gmail.com>
Benoit Pierre <benoit.pierre@gmail.com> writes:
> +test_expect_failure 'edit hunk "commit -p -m message"' ' > + test_when_finished "rm -f editor_was_started" &&
Not just "when finished", run "rm -f" here to make sure that the file does not exist. Later other people may add new tests before this test piece and affect the state of your throw-away working tree, and you would want to protect yourself from their changes.
> + echo more >>file && > + echo e | env GIT_EDITOR="touch editor_was_started" git commit -p -m commit2 file &&
Avoid "touch" unless you are interested in the timestamp to be updated. Use ": >editor_was_started" or something like that when you are only interested in "it was not there, now it is".
The same comment applies to the next one.
Thanks.
Show 11 quoted lines
> + test -r editor_was_started > +' > + > +test_expect_failure 'edit hunk "commit --dry-run -p -m message"' ' > + test_when_finished "rm -f editor_was_started" && > + echo more >>file && > + echo e | env GIT_EDITOR="touch editor_was_started" git commit -p -m commit3 file && > + test -r editor_was_started > +' > + > +test_done