blob: 433c4de08f0cc8d220d5368ab2ab0dffde372482 [file] [log] [blame]
Johannes Sixt723024d2007-03-03 20:32:46 +01001#!/bin/sh
2#
3# Copyright (c) 2007 Johannes Sixt
4#
5
6test_description='merging symlinks on filesystem w/o symlink support.
7
Nanako Shiraishi3604e7c2008-09-03 17:59:29 +09008This tests that git merge-recursive writes merge results as plain files
Johannes Sixt723024d2007-03-03 20:32:46 +01009if core.symlinks is false.'
10
11. ./test-lib.sh
12
13test_expect_success \
14'setup' '
Junio C Hamano5be60072007-07-02 22:52:14 -070015git config core.symlinks false &&
Johannes Sixt723024d2007-03-03 20:32:46 +010016> file &&
Junio C Hamano5be60072007-07-02 22:52:14 -070017git add file &&
Nanako Shiraishi3604e7c2008-09-03 17:59:29 +090018git commit -m initial &&
Junio C Hamano5be60072007-07-02 22:52:14 -070019git branch b-symlink &&
20git branch b-file &&
Brian Gernhardt6ecfd912008-10-31 01:09:13 -040021l=$(printf file | git hash-object -t blob -w --stdin) &&
Junio C Hamano5be60072007-07-02 22:52:14 -070022echo "120000 $l symlink" | git update-index --index-info &&
Nanako Shiraishi3604e7c2008-09-03 17:59:29 +090023git commit -m master &&
24git checkout b-symlink &&
Brian Gernhardt6ecfd912008-10-31 01:09:13 -040025l=$(printf file-different | git hash-object -t blob -w --stdin) &&
Junio C Hamano5be60072007-07-02 22:52:14 -070026echo "120000 $l symlink" | git update-index --index-info &&
Nanako Shiraishi3604e7c2008-09-03 17:59:29 +090027git commit -m b-symlink &&
28git checkout b-file &&
Johannes Sixt723024d2007-03-03 20:32:46 +010029echo plain-file > symlink &&
Junio C Hamano5be60072007-07-02 22:52:14 -070030git add symlink &&
Nanako Shiraishi3604e7c2008-09-03 17:59:29 +090031git commit -m b-file'
Johannes Sixt723024d2007-03-03 20:32:46 +010032
Junio C Hamano41ac4142008-02-01 01:50:53 -080033test_expect_success \
Johannes Sixt723024d2007-03-03 20:32:46 +010034'merge master into b-symlink, which has a different symbolic link' '
Nanako Shiraishi3604e7c2008-09-03 17:59:29 +090035git checkout b-symlink &&
36test_must_fail git merge master'
Johannes Sixt723024d2007-03-03 20:32:46 +010037
38test_expect_success \
39'the merge result must be a file' '
40test -f symlink'
41
Junio C Hamano41ac4142008-02-01 01:50:53 -080042test_expect_success \
Johannes Sixt723024d2007-03-03 20:32:46 +010043'merge master into b-file, which has a file instead of a symbolic link' '
Nanako Shiraishi3604e7c2008-09-03 17:59:29 +090044git reset --hard && git checkout b-file &&
45test_must_fail git merge master'
Johannes Sixt723024d2007-03-03 20:32:46 +010046
47test_expect_success \
48'the merge result must be a file' '
49test -f symlink'
50
Junio C Hamano41ac4142008-02-01 01:50:53 -080051test_expect_success \
Johannes Sixt723024d2007-03-03 20:32:46 +010052'merge b-file, which has a file instead of a symbolic link, into master' '
Nanako Shiraishi3604e7c2008-09-03 17:59:29 +090053git reset --hard &&
54git checkout master &&
55test_must_fail git merge b-file'
Johannes Sixt723024d2007-03-03 20:32:46 +010056
57test_expect_success \
58'the merge result must be a file' '
59test -f symlink'
60
61test_done