Re: [PATCH 1/2] Demonstrate bugs 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, then replaces a/b with
> a symlink to a/b-2, then merges that change into another branch that
> contains an unrelated change.
> 
> There are two bugs:
> 1. 'git checkout' wrongly deletes work tree file a/b-2/d.
> 2. 'git merge' wrongly deletes work tree file a/b-2/d.
> 
> Signed-off-by: James Pickens <james.e.pickens@xxxxxxxxx>
> ---
>  t/t6035-merge-dir-to-symlink.sh |   32 ++++++++++++++++++++++++++++++++
>  1 files changed, 32 insertions(+), 0 deletions(-)
>  create mode 100755 t/t6035-merge-dir-to-symlink.sh
> 
> diff --git a/t/t6035-merge-dir-to-symlink.sh b/t/t6035-merge-dir-to-symlink.sh
> new file mode 100755
> index 0000000..926c8ed
> --- /dev/null
> +++ b/t/t6035-merge-dir-to-symlink.sh
> @@ -0,0 +1,32 @@
> +#!/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 &&
> +	ln -s b-2 a/b &&
> +	git add -A &&
> +	git commit -m "dir to symlink"
> +'
> +
> +test_expect_failure 'checkout should not delete a/b-2/c/d' '
> +	git checkout -b temp HEAD^ &&
> +	test -f a/b-2/c/d
> +'
> +
> +test_expect_failure 'merge should not delete a/b-2/c/d' '
> +	echo x > a/x &&
> +	git add a/x &&
> +	git commit -m x &&
> +	git merge master &&
> +	test -f a/b-2/c/d
> +'
> +
> +test_done

Isn't the failure of the second test caused by that of the first one?
a/b-2/c/d is gone from the worktree, and master does not touch it, so
the merge leaves the worktree version (non-existent) as is.

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]