Re: [PATCH] merge: make merge state available to prepare-commit-msg hook

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] merge: make merge state available to prepare-commit-msg hook

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:59:38

Ryan Biesemeyer [off-list ref] writes:
In this case it was not immediately clear to me how to add cleanup to an existing
test that dirtied the state of the test repository by leaving behind an in-progress
merge.
Jonathan's answer is an option. Another one is

test_expect_success 'cleanup' '
	git reset ...
'

So if the cleanup goes wrong, one can notice.
I'm new to the mailing-list patch submission process; how would I go
about adding it?
You can apply my patch with "git am" in your tree (or at worse, do it by
hand and steal authorship, I don't mind for a 2 characters patch ;-) ),
fix your patch to add the missing &&, and then resend with stg like "git
send-email -v2 --in-reply-to=<old-msg-id>"
Submit the cover-letter & patches again?
Definitely submit patches again. Usually, the cover letter for a resend
emphasizes on changes compared to previous version.
Squash your commit into the relevant one of mine?
Preferably not, as my fix is unrelated from yours (mine can come before,
as a cleanup).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

Re: [PATCH] merge: make merge state available to prepare-commit-msg hook

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:59:38

Matthieu Moy wrote:
Jonathan's answer is an option. Another one is
[...]
So if the cleanup goes wrong, one can notice.
test_when_finished also makes the test fail if the cleanup failed.

Another common strategy is

	test_expect_success 'my exciting test' '
		# this test will rely on these files being absent
		rm -f a b c etc &&

		... rest of the test goes here ...
	'

which can be a handy way for an especially picky test to protect
itself (for example with 'git clean -fdx') regardless of the state
other test assertions create for it.

This particular example (merge --abort) seems like a good use for
test_when_finished because it is about a specific test having made a
mess and needing to clean up after itself to restore sanity.

Hoping that clarifies,
Jonathan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help