git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Potashev <aspotashev@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] Add new testcases for format-patch root commits
Date: Sat, 10 Jan 2009 21:33:39 +0300	[thread overview]
Message-ID: <20090110183339.GA30548@myhost> (raw)
In-Reply-To: <1231605577-26148-1-git-send-email-aspotashev@gmail.com>

On 19:39 Sat 10 Jan     , Alexander Potashev wrote:
> 1. format-patch'ing root commit shouldn't create empty patches
> 2. With --root it should create a patch for the root commit
> 3. Similar testcases with two commits in the tree
> 
> Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
> ---
> 
> git format-patch lacks a '--no-root' option, so I used
> 'git config log.showroot false' to emulate it.

Sorry, --root option has nothing in common with log.showroot, but the
testcases are still valid.

> 
> 
> 
>  t/t4033-format-patch-root-commit.sh |   52 +++++++++++++++++++++++++++++++++++
>  1 files changed, 52 insertions(+), 0 deletions(-)
>  create mode 100755 t/t4033-format-patch-root-commit.sh
> 
> diff --git a/t/t4033-format-patch-root-commit.sh b/t/t4033-format-patch-root-commit.sh
> new file mode 100755
> index 0000000..846c11c
> --- /dev/null
> +++ b/t/t4033-format-patch-root-commit.sh
> @@ -0,0 +1,52 @@
> +#!/bin/sh
> +
> +test_description='Format-patch root commit skipping/allowing'
> +
> +. ./test-lib.sh
> +
> +test_expect_success setup '
> +	git config log.showroot false
> +	git config format.numbered false
> +	echo A > file &&
> +	git add file &&
> +	git commit -m First
> +'
> +
> +test_patch_count() {
> +	cnt=$(grep "^Subject: \[PATCH\]" $1 | wc -l) &&
> +	test $cnt = $2
> +}
> +
> +test_patch_is_single() {
> +	cnt=$(grep "^Subject: \[PATCH\] $2" $1 | wc -l) &&
> +	test $cnt = 1
> +}
> +
> +test_expect_success 'format-patch root commit with showroot = false' '
> +	git format-patch -1 &&
> +	test_must_fail cat 0001-First.patch
> +'
> +
> +test_expect_success 'format-patch root commit' '
> +	git format-patch --root --stdout -5 >root-only.patch &&
> +	test_patch_count root-only.patch 1 &&
> +	test_patch_is_single root-only.patch First
> +'
> +
> +test_expect_success 'format-patch 2 commits without root' '
> +	echo B > file &&
> +	git commit -a -m Second &&
> +
> +	git format-patch --stdout -2 >two-except-root.patch &&
> +	test_patch_count two-except-root.patch 1 &&
> +	test_patch_is_single two-except-root.patch Second
> +'
> +
> +test_expect_success 'format-patch 2 commits including root' '
> +	git format-patch --root --stdout -2 >two-with-root.patch &&
> +	test_patch_count two-with-root.patch 2 &&
> +	test_patch_is_single two-with-root.patch First &&
> +	test_patch_is_single two-with-root.patch Second
> +'
> +
> +test_done
> -- 
> 1.6.1.81.g61cf1
> 

      reply	other threads:[~2009-01-10 18:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09 21:33 [PATCH] Get format-patch to show first commit after root commit Nathan W. Panike
2009-01-10  0:49 ` Junio C Hamano
2009-01-10  1:37   ` Nathan W. Panike
2009-01-10 11:36   ` Alexander Potashev
2009-01-10 11:39     ` [PATCH] format-patch: avoid generation of empty patches Alexander Potashev
2009-01-10 16:01       ` Nathan W. Panike
2009-01-10 16:17         ` Alexander Potashev
2009-01-10 18:07           ` Nathan W. Panike
2009-01-10 20:41         ` Junio C Hamano
2009-01-10 16:39       ` [PATCH] Add new testcases for format-patch root commits Alexander Potashev
2009-01-10 18:33         ` Alexander Potashev [this message]

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=20090110183339.GA30548@myhost \
    --to=aspotashev@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 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).