All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 2/3] t5521 (pull-options): use test_commit() where appropriate
Date: Sat, 23 Mar 2013 18:08:22 +0530	[thread overview]
Message-ID: <CALkWK0n4CT-Pfm22vTToVp2kZqT7h9kBtF-1NoPOg3vOc+MSog@mail.gmail.com> (raw)
In-Reply-To: <7vy5df74yt.fsf@alter.siamese.dyndns.org>

Junio C Hamano wrote:
> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>
>> 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, ...).

Okay.

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

Yes, test_tick.  I've noticed that several tests call test_tick by
hand before invoking "git commit".

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

Agreed.  In fact, the commit message is constrained, because of this;
you can't create a commit with a commit message involving spaces,
because that would result in an invalid tag name.

  reply	other threads:[~2013-03-23 12:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 12:29 [PATCH 0/3] Introduce pull.autostash Ramkumar Ramachandra
2013-03-22 12:29 ` [PATCH 1/3] git-pull.sh: prefer invoking "git <command>" over "git-<command>" Ramkumar Ramachandra
2013-03-22 12:29 ` [PATCH 2/3] t5521 (pull-options): use test_commit() where appropriate Ramkumar Ramachandra
2013-03-22 16:51   ` Junio C Hamano
2013-03-23 12:38     ` Ramkumar Ramachandra [this message]
2013-03-22 12:29 ` [PATCH 3/3] git-pull.sh: introduce --[no-]autostash and pull.autostash Ramkumar Ramachandra
2013-03-22 17:02   ` Junio C Hamano
2013-03-23 12:48     ` Ramkumar Ramachandra
2013-03-24  7:28       ` Junio C Hamano
2013-03-24 17:56         ` Ramkumar Ramachandra
2013-03-24 21:12           ` Ramkumar Ramachandra
2013-04-13 21:15 [PATCH v2 0/3] Introduce pull.autostash Ramkumar Ramachandra
2013-04-13 21:15 ` [PATCH 2/3] t5521 (pull-options): use test_commit() where appropriate Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALkWK0n4CT-Pfm22vTToVp2kZqT7h9kBtF-1NoPOg3vOc+MSog@mail.gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.