Subject: Re: [PATCH 3/7] test patch hunk editing with "commit -p -m"

From: Junio C Hamano <[email-masked]>
Date: Mon, 17 Mar 2014 11:53:41 -0700

Benoit Pierre <[email-masked]> 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.

> +	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