git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Stephen Haberman <stephen@exigencecorp.com>,
	Thomas Rast <trast@student.ethz.ch>,
	git@vger.kernel.org
Subject: Re: [PATCH 3/6] lib-rebase.sh: introduce test_commit() and test_merge() helpers
Date: Tue, 27 Jan 2009 13:09:28 -0800	[thread overview]
Message-ID: <7vvds01mnr.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.DEB.1.00.0901271847070.3586@pacific.mpi-cbg.de> (Johannes Schindelin's message of "Tue, 27 Jan 2009 18:47:16 +0100 (CET)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> 	This may want to live in test-lib.sh instead.

Yeah, I tend to agree.

> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
> index cda7778..37430f3 100644
> --- a/t/lib-rebase.sh
> +++ b/t/lib-rebase.sh
> @@ -46,3 +46,29 @@ EOF
>  	test_set_editor "$(pwd)/fake-editor.sh"
>  	chmod a+x fake-editor.sh
>  }
> +
> +# Call test_commit with the arguments "<message> [<file> [<contents>]]"
> +#
> +# This will commit a file with the given contents and the given commit
> +# message.  It will also add a tag with <message> as name.
> +#
> +# Both <file> and <contents> default to <message>.
> +
> +test_commit () {
> +	file=$2
> +	test -z "$2" && file=$(echo "$1" | tr 'A-Z' 'a-z')

	file=${2:-$(echo "$1" | tr 'A-Z' 'a-z')}

might be more consistent with this:

> +	echo ${3-$1} > $file &&

and may be easier to read.

I'd suggest dquoting argument to echo above, i.e. "${3-$1}", and all the
references to positional arguments in the remainder of the patch, though.

> +	git add $file &&

as well as "$file" here.

> +	test_tick &&
> +	git commit -m $1 &&
> +	git tag $1
> +}
> +
> +# Call test_merge with the arguments "<message> <commit>", where <commit>
> +# can be a tag pointing to the commit-to-merge.
> +
> +test_merge () {
> +	test_tick &&
> +	git merge -m $1 $2 &&
> +	git tag $1
> +}
> -- 
> 1.6.1.482.g7d54be

  reply	other threads:[~2009-01-27 21:11 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27  9:29 Heads up: rebase -i -p will be made sane again Johannes Schindelin
2009-01-27 14:54 ` Stephen Haberman
2009-01-27 17:45   ` [PATCH 0/6] Simplifications of some 'rebase' tests Johannes Schindelin
2009-01-27 17:45     ` [PATCH 1/6] t3404 & t3411: undo copy&paste Johannes Schindelin
2009-01-27 21:01       ` Junio C Hamano
2009-01-27 21:57         ` Johannes Schindelin
2009-01-27 22:46           ` Junio C Hamano
2009-01-27 22:53             ` Johannes Schindelin
2009-01-27 22:34         ` [PATCH v2 0/6] rebase simplifications Johannes Schindelin
2009-01-27 22:50           ` Junio C Hamano
2009-01-27 23:10             ` Johannes Schindelin
2009-01-27 22:34         ` [PATCH v2 1/6] t3404 & t3411: undo copy&paste Johannes Schindelin
2009-01-27 22:34         ` [PATCH v2 2/6] lib-rebase.sh: Document what set_fake_editor() does Johannes Schindelin
2009-01-27 22:34         ` [PATCH v2 3/6] test-lib.sh: introduce test_commit() and test_merge() helpers Johannes Schindelin
2009-01-27 22:34         ` [PATCH v2 4/6] Simplify t3410 Johannes Schindelin
2009-01-27 22:35         ` [PATCH v2 5/6] Simplify t3411 Johannes Schindelin
2009-01-27 22:35         ` [PATCH v2 6/6] Simplify t3412 Johannes Schindelin
2009-01-27 17:46     ` [PATCH 2/6] lib-rebase.sh: Document what set_fake_editor() does Johannes Schindelin
2009-01-27 21:03       ` Junio C Hamano
2009-01-27 21:58         ` Johannes Schindelin
2009-01-27 17:47     ` [PATCH 3/6] lib-rebase.sh: introduce test_commit() and test_merge() helpers Johannes Schindelin
2009-01-27 21:09       ` Junio C Hamano [this message]
2009-01-27 17:48     ` [PATCH 4/6] Simplify t3410 Johannes Schindelin
2009-01-27 17:48     ` [PATCH 5/6] Simplify t3411 Johannes Schindelin
2009-01-27 17:49     ` [PATCH 6/6] Simplify t3412 Johannes Schindelin
2009-01-27 17:59   ` Heads up: rebase -i -p will be made sane again Johannes Schindelin
2009-01-28  1:53   ` Johannes Schindelin
2009-01-28  3:39     ` Stephen Haberman
2009-01-28  4:01       ` Johannes Schindelin
2009-01-28  5:21         ` Stephen Haberman

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=7vvds01mnr.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=stephen@exigencecorp.com \
    --cc=trast@student.ethz.ch \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).