Re: [PATCH 04/15] Add new test to ensure git-merge handles pull.twohead and pull.octopus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miklos Vajna a écrit :
> 

[...]

> +test_expect_success 'setup' '
> +	echo c0 >c0.c &&
> +	git add c0.c &&
> +	git commit -m c0 &&
> +	git tag c0 &&
> +	echo c1 >c1.c &&
> +	git add c1.c &&
> +	git commit -m c1 &&
> +	git tag c1 &&
> +	git reset --hard c0 &&
> +	echo c2 >c2.c &&
> +	git add c2.c &&
> +	git commit -m c2 &&
> +	git tag c2

Missing &&?

> +	git reset --hard c0 &&
> +	echo c3 >c3.c &&
> +	git add c3.c &&
> +	git commit -m c3 &&
> +	git tag c3
> +'

[...]

> +test_expect_success 'merge c1 with c2 and c3 (recursive and octopus in pull.octopus)' '
> +	git reset --hard c1 &&
> +	git config pull.octopus "recursive octopus" &&
> +	git merge c2 c3 &&
> +	test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
> +	test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
> +	test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
> +	test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)"

Duplicate the next line?

> +	test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&
> +	git diff --exit-code &&
> +	test -f c0.c &&
> +	test -f c1.c &&
> +	test -f c2.c &&
> +	test -f c3.c
> +'
> +
> +conflict_count()
> +{
> +	eval $1=`{
> +		git diff-files --name-only
> +		git ls-files --unmerged
> +	} | wc -l`
> +}
> +
> +# c4 - c5
> +#    \ c6
> +#
> +# There are two conflicts here:
> +#
> +# 1) Because foo.c is renamed to bar.c, recursive will handle this,
> +# resolve won't.
> +#
> +# 2) One in conflict.c and that will always fail.
> +
> +test_expect_success 'setup conflicted merge' '
> +	git reset --hard c0 &&
> +	echo A >conflict.c &&
> +	git add conflict.c &&
> +	echo contents >foo.c &&
> +	git add foo.c &&
> +	git commit -m c4 &&
> +	git tag c4 &&
> +	echo B >conflict.c &&
> +	git add conflict.c &&
> +	git mv foo.c bar.c &&
> +	git commit -m c5 &&
> +	git tag c5 &&
> +	git reset --hard c4 &&
> +	echo C >conflict.c &&
> +	git add conflict.c &&
> +	echo secondline >> foo.c &&
> +	git add foo.c &&
> +	git commit -m c6 &&
> +	git tag c6
> +'
> +
> +# First do the merge with resolve and recursive then verify that
> +# recusive is choosen.
> +
> +test_expect_success 'merge picks up the best result' '
> +	git config pull.twohead "recursive resolve" &&
> +	git reset --hard c5 &&
> +	git merge -s resolve c6
> +	conflict_count resolve_count &&
> +	git reset --hard c5 &&
> +	git merge -s recursive c6
> +	conflict_count recursive_count &&
> +	git reset --hard c5 &&
> +	git merge c6
> +	conflict_count auto_count &&
> +	test "$auto_count" = "$recursive_count"
> +'

Should not "$auto_count" != "$resolve_count" also be tested to be
sure that recursive has been choosen?

Olivier.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux