Re: [PATCH 2/2] Demonstrate merge failure when a directory is replaced with a symlink.

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

 



James Pickens venit, vidit, dixit 29.07.2009 00:13:
> This test creates two directories, a/b and a/b-2, replaces a/b-2 with a
> symlink to a/b, then merges that change into another branch that
> contains unrelated changes.  Since the changes are unrelated, the merge
> should be free of conflicts, but 'git merge' gives a file/directory
> conflict.
> 
> Note that this test is almost identical to t6035, except that instead of
> replacing a/b with a symlink, it replaces a/b-2 with a symlink.  This
> test results in a merge conflict, whereas t6035 does not.

In fact they are identical: Exchange b for b-2 and vice versa everywhere
and you get the same test, except for the fact that in 1/2 you "test -f"
in the last step. But I'm sure that test fails at the merge step already
(because of a dirty worktree), doesn't it? You should see this when
running the test with -d/-v. (I'm guessing, I haven't run your test.)

> 
> Signed-off-by: James Pickens <james.e.pickens@xxxxxxxxx>
> ---
>  t/t6036-merge-dir-to-symlink.sh |   30 ++++++++++++++++++++++++++++++
>  1 files changed, 30 insertions(+), 0 deletions(-)
>  create mode 100755 t/t6036-merge-dir-to-symlink.sh
> 
> diff --git a/t/t6036-merge-dir-to-symlink.sh b/t/t6036-merge-dir-to-symlink.sh
> new file mode 100755
> index 0000000..020db7c
> --- /dev/null
> +++ b/t/t6036-merge-dir-to-symlink.sh
> @@ -0,0 +1,30 @@
> +#!/bin/sh
> +
> +test_description='merging when a directory was replaced with a symlink'
> +. ./test-lib.sh
> +
> +test_expect_success setup '
> +	mkdir -p a/b/c a/b-2/c &&
> +	> a/b/c/d &&
> +	> a/b-2/c/d &&
> +	> a/x &&
> +	git add -A &&
> +	git commit -m base &&
> +	rm -rf a/b-2 &&
> +	ln -s b a/b-2 &&
> +	git add -A &&
> +	git commit -m "dir to symlink"
> +'
> +
> +test_expect_failure 'checkout should not delete a/b/c/d' '
> +	git checkout -b temp HEAD^ &&
> +	test -f a/b/c/d
> +'
> +
> +test_expect_failure 'merge should not have conflicts' '
> +	echo x > a/x &&
> +	git add a/x &&
> +	git commit -m x &&
> +	git merge master'
> +
> +test_done

As in 1/2, I think the first expect_failure leaves a dirty/unexpected
worktree (d missing) which causes the merge failure in the last step.

Michael
--
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]