2007-03-04 03:32:46 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2007 Johannes Sixt
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='merging symlinks on filesystem w/o symlink support.
|
|
|
|
|
2008-09-03 16:59:29 +08:00
|
|
|
This tests that git merge-recursive writes merge results as plain files
|
2007-03-04 03:32:46 +08:00
|
|
|
if core.symlinks is false.'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'setup' '
|
2007-07-03 13:52:14 +08:00
|
|
|
git config core.symlinks false &&
|
2007-03-04 03:32:46 +08:00
|
|
|
> file &&
|
2007-07-03 13:52:14 +08:00
|
|
|
git add file &&
|
2008-09-03 16:59:29 +08:00
|
|
|
git commit -m initial &&
|
2007-07-03 13:52:14 +08:00
|
|
|
git branch b-symlink &&
|
|
|
|
git branch b-file &&
|
2008-10-31 13:09:13 +08:00
|
|
|
l=$(printf file | git hash-object -t blob -w --stdin) &&
|
2007-07-03 13:52:14 +08:00
|
|
|
echo "120000 $l symlink" | git update-index --index-info &&
|
2008-09-03 16:59:29 +08:00
|
|
|
git commit -m master &&
|
|
|
|
git checkout b-symlink &&
|
2008-10-31 13:09:13 +08:00
|
|
|
l=$(printf file-different | git hash-object -t blob -w --stdin) &&
|
2007-07-03 13:52:14 +08:00
|
|
|
echo "120000 $l symlink" | git update-index --index-info &&
|
2008-09-03 16:59:29 +08:00
|
|
|
git commit -m b-symlink &&
|
|
|
|
git checkout b-file &&
|
2007-03-04 03:32:46 +08:00
|
|
|
echo plain-file > symlink &&
|
2007-07-03 13:52:14 +08:00
|
|
|
git add symlink &&
|
2008-09-03 16:59:29 +08:00
|
|
|
git commit -m b-file'
|
2007-03-04 03:32:46 +08:00
|
|
|
|
2008-02-01 17:50:53 +08:00
|
|
|
test_expect_success \
|
2007-03-04 03:32:46 +08:00
|
|
|
'merge master into b-symlink, which has a different symbolic link' '
|
2008-09-03 16:59:29 +08:00
|
|
|
git checkout b-symlink &&
|
|
|
|
test_must_fail git merge master'
|
2007-03-04 03:32:46 +08:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'the merge result must be a file' '
|
|
|
|
test -f symlink'
|
|
|
|
|
2008-02-01 17:50:53 +08:00
|
|
|
test_expect_success \
|
2007-03-04 03:32:46 +08:00
|
|
|
'merge master into b-file, which has a file instead of a symbolic link' '
|
2008-09-03 16:59:29 +08:00
|
|
|
git reset --hard && git checkout b-file &&
|
|
|
|
test_must_fail git merge master'
|
2007-03-04 03:32:46 +08:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'the merge result must be a file' '
|
|
|
|
test -f symlink'
|
|
|
|
|
2008-02-01 17:50:53 +08:00
|
|
|
test_expect_success \
|
2007-03-04 03:32:46 +08:00
|
|
|
'merge b-file, which has a file instead of a symbolic link, into master' '
|
2008-09-03 16:59:29 +08:00
|
|
|
git reset --hard &&
|
|
|
|
git checkout master &&
|
|
|
|
test_must_fail git merge b-file'
|
2007-03-04 03:32:46 +08:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'the merge result must be a file' '
|
|
|
|
test -f symlink'
|
|
|
|
|
|
|
|
test_done
|