git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Martin von Zweigbergk <martinvonz@gmail.com>
Cc: git@vger.kernel.org, Johannes Sixt <j.sixt@viscovery.net>,
	Chris Webb <chris@arachsys.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: Re: [PATCH v5 1/7] add simple tests of consistency across rebase types
Date: Mon, 03 Jun 2013 15:28:28 -0700	[thread overview]
Message-ID: <7v1u8ide2b.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1370292135-1236-2-git-send-email-martinvonz@gmail.com> (Martin von Zweigbergk's message of "Mon, 3 Jun 2013 13:42:09 -0700")

Martin von Zweigbergk <martinvonz@gmail.com> writes:

> Helped-by: Johannes Sixt <j6t@kdbg.org>
> ---
>  t/lib-rebase.sh                   | 15 ++++++++
>  t/t3421-rebase-topology-linear.sh | 78 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 93 insertions(+)
>  create mode 100755 t/t3421-rebase-topology-linear.sh
>
> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
> index 6ccf797..62b3887 100644
> --- a/t/lib-rebase.sh
> +++ b/t/lib-rebase.sh
> @@ -65,3 +65,18 @@ EOF
>  	test_set_editor "$(pwd)/fake-editor.sh"
>  	chmod a+x fake-editor.sh
>  }
> +
> +# checks that the revisions in "$2" represent a linear range with the
> +# subjects in "$1"
> +test_linear_range () {
> +	! { git log --format=%p "$2" | sane_grep " " ;} &&

An interesting way to spell:

    test $(git rev-list --merges "$2" | wc -l) = 0

I think I am fine with either, though.

> +	expected=$1
> +	set -- $(git log --reverse --format=%s "$2")
> +	test "$expected" = "$*"

OK.

> +}
> +
> +reset_rebase () {
> +	git rebase --abort # may fail; ignore exit code

test_might_fail to catch unusual exit codes?

> +	git reset --hard &&
> +	git clean -f
> +}
> diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh
> new file mode 100755
> index 0000000..c4b32db
> --- /dev/null
> +++ b/t/t3421-rebase-topology-linear.sh
> @@ -0,0 +1,78 @@
> +#!/bin/sh
> +
> +test_description='basic rebase topology tests'
> +. ./test-lib.sh
> +. "$TEST_DIRECTORY"/lib-rebase.sh
> +
> +# a---b---c
> +#      \
> +#       d---e
> +test_expect_success 'setup' '
> +	test_commit a &&
> +	test_commit b &&
> +	test_commit c &&
> +	git checkout b &&
> +	test_commit d &&
> +	test_commit e
> +'
> +
> +test_run_rebase () {
> +	result=$1
> +	shift
> +	test_expect_$result "simple rebase $*" "
> +		reset_rebase &&
> +		git rebase $* c e &&
> +		test_cmp_rev c HEAD~2 &&
> +		test_linear_range 'd e' c..
> +	"
> +}
> +test_run_rebase success ''
> +test_run_rebase success -m
> +test_run_rebase success -i
> +test_run_rebase success -p
> +
> +test_run_rebase () {
> +	result=$1
> +	shift
> +	test_expect_$result "rebase $* is no-op if upstream is an ancestor" "
> +		reset_rebase &&
> +		git rebase $* b e &&
> +		test_cmp_rev e HEAD
> +	"
> +}
> +test_run_rebase success ''
> +test_run_rebase success -m
> +test_run_rebase success -i
> +test_run_rebase success -p
> +
> +test_run_rebase () {
> +	result=$1
> +	shift
> +	test_expect_$result "rebase $* -f rewrites even if upstream is an ancestor" "
> +		reset_rebase &&
> +		git rebase $* -f b e &&

Asking to rebase the history leading to e from b on top of the merge
base (which happens to be b) may be no-op or force-create a new
history that is parallel.  OK.

> +		! test_cmp_rev e HEAD &&
> +		test_cmp_rev b HEAD~2 &&
> +		test_linear_range 'd e' b..
> +	"
> +}
> +test_run_rebase success ''
> +test_run_rebase success -m
> +test_run_rebase success -i
> +test_run_rebase failure -p
> +
> +test_run_rebase () {
> +	result=$1
> +	shift
> +	test_expect_$result "rebase $* fast-forwards if an ancestor of upstream" "

The description is a non-sentence, and while I can tell what it
wants to say, I do not have a good suggestion for rephrasing this.

This is asking to rebase the history leading to b on top of e, but e
already includes everything in b, so it just turns into a no-op of
not moving from e.  So it is not even a fast-forward.

> +		reset_rebase &&
> +		git rebase $* e b &&
> +		test_cmp_rev e HEAD
> +	"
> +}
> +test_run_rebase success ''
> +test_run_rebase success -m
> +test_run_rebase success -i
> +test_run_rebase success -p
> +
> +test_done

  reply	other threads:[~2013-06-03 22:28 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18  6:31 [RFC PATCH] add t3420-rebase-topology Martin von Zweigbergk
2012-09-18  7:51 ` Junio C Hamano
2012-09-21 17:06   ` Martin von Zweigbergk
2012-09-18  7:53 ` Johannes Sixt
2012-09-26 17:07   ` Martin von Zweigbergk
2012-09-27 12:20     ` Chris Webb
2012-09-28 18:03       ` Martin von Zweigbergk
2012-09-29  8:08         ` Chris Webb
2013-05-29  6:39 ` [PATCH v2 0/7] Rebase topology test Martin von Zweigbergk
2013-05-29  6:39   ` [PATCH v2 1/7] add simple tests of consistency across rebase types Martin von Zweigbergk
2013-06-03 17:16     ` Martin von Zweigbergk
2013-06-03 18:05       ` Junio C Hamano
2013-06-03 18:12         ` Martin von Zweigbergk
2013-05-29  6:39   ` [PATCH v2 2/7] add tests for rebasing with patch-equivalence present Martin von Zweigbergk
2013-05-29  7:09     ` Johannes Sixt
2013-05-30  5:30       ` Martin von Zweigbergk
2013-05-30  5:41         ` Felipe Contreras
2013-05-30  6:14           ` Martin von Zweigbergk
2013-05-30  6:40             ` Felipe Contreras
2013-05-30  6:46               ` Martin von Zweigbergk
2013-05-30 12:54         ` Johannes Sixt
2013-05-30 15:01           ` Martin von Zweigbergk
2013-05-29  6:39   ` [PATCH v2 3/7] add tests for rebasing of empty commits Martin von Zweigbergk
2013-05-29  6:39   ` [PATCH v2 4/7] add tests for rebasing root Martin von Zweigbergk
2013-05-29  7:31     ` Johannes Sixt
2013-05-30  5:51       ` Martin von Zweigbergk
2013-05-29  6:39   ` [PATCH v2 5/7] add tests for rebasing merged history Martin von Zweigbergk
2013-05-29  7:57     ` Johannes Sixt
2013-05-31  5:42       ` Martin von Zweigbergk
2013-05-29 10:33     ` Johannes Sixt
2013-05-29  6:39   ` [PATCH v2 6/7] t3406: modernize style Martin von Zweigbergk
2013-05-29  6:39   ` [PATCH v2 7/7] tests: move test for rebase messages from t3400 to t3406 Martin von Zweigbergk
2013-05-29  7:10   ` [PATCH v2 0/7] Rebase topology test Felipe Contreras
2013-05-29 12:50     ` Ramkumar Ramachandra
2013-05-29 13:54       ` Felipe Contreras
2013-05-31  6:49   ` [PATCH v3 " Martin von Zweigbergk
2013-05-31  6:49     ` [PATCH v3 1/7] add simple tests of consistency across rebase types Martin von Zweigbergk
2013-05-31  6:49     ` [PATCH v3 2/7] add tests for rebasing with patch-equivalence present Martin von Zweigbergk
2013-05-31  6:49     ` [PATCH v3 3/7] add tests for rebasing of empty commits Martin von Zweigbergk
2013-05-31  6:49     ` [PATCH v3 4/7] add tests for rebasing root Martin von Zweigbergk
2013-05-31  6:49     ` [PATCH v3 5/7] add tests for rebasing merged history Martin von Zweigbergk
2013-05-31 12:19       ` Johannes Sixt
2013-06-01 21:36         ` [PATCH v4 " Martin von Zweigbergk
2013-05-31  6:49     ` [PATCH v3 6/7] t3406: modernize style Martin von Zweigbergk
2013-05-31  6:49     ` [PATCH v3 7/7] tests: move test for rebase messages from t3400 to t3406 Martin von Zweigbergk
2013-06-03 20:42     ` [PATCH v5 0/7] Rebase topology test Martin von Zweigbergk
2013-06-03 20:42       ` [PATCH v5 1/7] add simple tests of consistency across rebase types Martin von Zweigbergk
2013-06-03 22:28         ` Junio C Hamano [this message]
2013-06-04  5:14           ` Martin von Zweigbergk
2013-06-04  5:49             ` Junio C Hamano
2013-06-04  6:15             ` Johannes Sixt
2013-06-05  4:31               ` Martin von Zweigbergk
2013-06-03 20:42       ` [PATCH v5 2/7] add tests for rebasing with patch-equivalence present Martin von Zweigbergk
2013-06-03 20:42       ` [PATCH v5 3/7] add tests for rebasing of empty commits Martin von Zweigbergk
2013-06-03 20:42       ` [PATCH v5 4/7] add tests for rebasing root Martin von Zweigbergk
2013-06-03 20:42       ` [PATCH v5 5/7] add tests for rebasing merged history Martin von Zweigbergk
2013-06-04 17:18         ` Junio C Hamano
2013-06-05  5:44           ` Martin von Zweigbergk
2013-06-05  6:12           ` Johannes Sixt
2013-06-03 20:42       ` [PATCH v5 6/7] t3406: modernize style Martin von Zweigbergk
2013-06-03 20:42       ` [PATCH v5 7/7] tests: move test for rebase messages from t3400 to t3406 Martin von Zweigbergk
2013-06-07  6:11       ` [PATCH v6 0/8] Rebase topology test Martin von Zweigbergk
2013-06-07  6:11         ` [PATCH v6 1/7] add simple tests of consistency across rebase types Martin von Zweigbergk
2013-06-07  6:11         ` [PATCH v6 2/7] add tests for rebasing with patch-equivalence present Martin von Zweigbergk
2013-06-07  6:11         ` [PATCH v6 3/7] add tests for rebasing of empty commits Martin von Zweigbergk
2013-06-07  6:11         ` [PATCH v6 4/7] add tests for rebasing root Martin von Zweigbergk
2013-06-07  6:11         ` [PATCH v6 5/7] add tests for rebasing merged history Martin von Zweigbergk
2013-06-07  6:11         ` [PATCH v6 6/7] t3406: modernize style Martin von Zweigbergk
2013-06-07  6:11         ` [PATCH v6 7/7] tests: move test for rebase messages from t3400 to t3406 Martin von Zweigbergk
2013-06-07 16:43         ` [PATCH v6 0/8] Rebase topology test Junio C Hamano
2013-06-07 19:37         ` Johannes Sixt
2013-06-18  7:28         ` [PATCH mz/rebase-tests] rebase topology tests: fix commit names on case-insensitive file systems Johannes Sixt
2013-06-18 15:45           ` Junio C Hamano
2013-06-18 15:53           ` Martin von Zweigbergk
2013-06-19  5:52             ` Johannes Sixt

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=7v1u8ide2b.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=chris@arachsys.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    --cc=martinvonz@gmail.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).