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

Re: [PATCH 2/3] t5521 (pull-options): use test_commit() where appropriate

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 22, 2013, 16:51 UTC
Message-ID
<7vy5df74yt.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1363955399-13153-3-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 22 quoted lines
> test_commit() is a well-defined function in test-lib-functions.sh that
> allows you to create commits with a terse syntax.  Prefer using it
> over creating commits by hand.
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  t/t5521-pull-options.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
> index 1b06691..4a804f0 100755
> --- a/t/t5521-pull-options.sh
> +++ b/t/t5521-pull-options.sh
> @@ -7,8 +7,8 @@ test_description='pull options'
>  test_expect_success 'setup' '
>  	mkdir parent &&
>  	(cd parent && git init &&
> -	 echo one >file && git add file &&
> -	 git commit -m one)
> +	 test_commit "one" file "one"
> +	)
>  '

In this test script perhaps it is OK, but I'd prefer people being careful *not* to use test_commit in tests that involve refs (i.e. pushing, pulling, ls-remote, for-each-ref, describe...) and paths (i.e. ls-files, diff, ...).

There is one good point in the helper: it creates a commit with a predictable timestamp.

But it does a lot other *bad* things than that single good thing. It adds a new path, and adds a new tag; neither of which is not desirable in many circumstances.

A better future direction would be to first make these "frill" features into options to test_commit helper, fix the users that depend on these additional tags and stuff to explicitly ask for them, and then start advocating it for wider use, I think.

Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 4 of 11 in “Introduce pull.autostash”
  1. 0/3 Introduce pull.autostashRamkumar Ramachandra, Mar 22, 2013
  2. 1/3 git-pull.sh: prefer invoking "git <command>" over "git-<command>"Ramkumar Ramachandra, Mar 22, 2013
  3. 2/3 t5521 (pull-options): use test_commit() where appropriateRamkumar Ramachandra, Mar 22, 2013
  4. Junio C HamanoMar 22, 2013
  5. Ramkumar RamachandraMar 23, 2013
  6. 3/3 git-pull.sh: introduce --[no-]autostash and pull.autostashRamkumar Ramachandra, Mar 22, 2013
  7. Junio C HamanoMar 22, 2013
  8. Ramkumar RamachandraMar 23, 2013
  9. Junio C HamanoMar 24, 2013
  10. Ramkumar RamachandraMar 24, 2013
  11. Ramkumar RamachandraMar 24, 2013

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.