git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 1/3] t7501: add merge conflict tests for dry run

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 17, 2018, 17:45 UTC
Message-ID
<xmqqd0vlpxhy.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<xmqq1sc1rdvz.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
> But by splitting these into separate tests, the patch makes such a
> potential failure with "git commit --short" break the later steps.
>
> Not very nice.
>
> It may be a better change to just do in the original one
>
> 	git add test-file &&
> 	git commit --dry-run &&
> +	git commit --short &&
> +	git commit --long &&
> +	git commit --porcelain &&
> 	git commit -m "conflicts fixed from merge."
>
> without adding these new and separate tests, and then mark that one
> to expect a failure (because it would pass up to the --dry-run
> commit, but the --short commit would fail) at this step, perhaps?

Of course, if you want to be more thorough, anticipating that other people in their future updates may break --short but not --long or --porcelain, testing each option in separate test_expect_success is a necessary way to do so, but then you'd need to actually be more thorough, by not merely running each of them in separate test_expect_success block but also arranging that each of them start in an expected state to try the thing we want it to try. That is

	for opt in --dry-run --short --long --porcelain
	do
		test_expect_success "commit $opt" '
			set up the conflicted state after merge &&
			git commit $opt
		'
	done

where the "set up the state" part makes sure it can tolerate potential mistakes of previous run of "git commit $opt" (e.g. it by mistake made a commit, making the index identical to HEAD and taking us out of "merge in progress" state).

But from your 1/3 I did not get the impression that you particularly want to be more thorough, and from your 3/3 I did not get the impression that you anticipate --short/--long/--porcelain may get broken independently. And if that is the case, then chaining all of them together like the above is a more honest way to express that we are only doing a minimum set of testing.

Thanks.
Previous: Junio C HamanoNext: Samuel Lijin
Message 20 of 26 in “Fix --short and --porcelain options for commit”
  1. 0/2 Fix --short and --porcelain options for commitSamuel Lijin, Apr 18, 2018
  2. 1/2 commit: fix --short and --porcelainSamuel Lijin, Apr 18, 2018
  3. Martin ÅgrenApr 18, 2018
  4. Eric SunshineApr 20, 2018
  5. 2/2 wt-status: const-ify all printf helper methodsSamuel Lijin, Apr 18, 2018
  6. 0/2 Fix --short and --porcelain options for commitSamuel Lijin, Apr 26, 2018
  7. 1/2 commit: fix --short and --porcelain optionsSamuel Lijin, Apr 26, 2018
  8. Junio C HamanoMay 2, 2018
  9. Samuel LijinMay 2, 2018
  10. 2/2 wt-status: const-ify all printf helper methodsSamuel Lijin, Apr 26, 2018
  11. 0/3 Fix --short/--porcelain options for git commitSamuel Lijin, Jul 15, 2018
  12. 0/4 Rerolling patch series to fix t7501Samuel Lijin, Jul 23, 2018
  13. Junio C HamanoJul 30, 2018
  14. 1/4 t7501: add coverage for flags which imply dry runsSamuel Lijin, Jul 23, 2018
  15. 4/4 commit: fix exit code when doing a dry runSamuel Lijin, Jul 23, 2018
  16. 2/4 wt-status: rename commitable to committableSamuel Lijin, Jul 23, 2018
  17. 3/4 wt-status: teach wt_status_collect about merges in progressSamuel Lijin, Jul 23, 2018
  18. 1/3 t7501: add merge conflict tests for dry runSamuel Lijin, Jul 15, 2018
  19. Junio C HamanoJul 17, 2018
  20. Junio C HamanoJul 17, 2018
  21. 3/3 commit: fix exit code for --short/--porcelainSamuel Lijin, Jul 15, 2018
  22. Junio C HamanoJul 17, 2018
  23. Samuel LijinJul 19, 2018
  24. 2/3 wt-status: teach wt_status_collect about merges in progressSamuel Lijin, Jul 15, 2018
  25. Junio C HamanoJul 17, 2018
  26. Samuel LijinApr 19, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.