Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2007 Johannes Sixt |
| 4 | # |
| 5 | |
| 6 | test_description='merging symlinks on filesystem w/o symlink support. |
| 7 | |
Nanako Shiraishi | 3604e7c | 2008-09-03 17:59:29 +0900 | [diff] [blame] | 8 | This tests that git merge-recursive writes merge results as plain files |
Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 9 | if core.symlinks is false.' |
| 10 | |
| 11 | . ./test-lib.sh |
| 12 | |
| 13 | test_expect_success \ |
| 14 | 'setup' ' |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 15 | git config core.symlinks false && |
Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 16 | > file && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 17 | git add file && |
Nanako Shiraishi | 3604e7c | 2008-09-03 17:59:29 +0900 | [diff] [blame] | 18 | git commit -m initial && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 19 | git branch b-symlink && |
| 20 | git branch b-file && |
Brian Gernhardt | 6ecfd91 | 2008-10-31 01:09:13 -0400 | [diff] [blame] | 21 | l=$(printf file | git hash-object -t blob -w --stdin) && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 22 | echo "120000 $l symlink" | git update-index --index-info && |
Nanako Shiraishi | 3604e7c | 2008-09-03 17:59:29 +0900 | [diff] [blame] | 23 | git commit -m master && |
| 24 | git checkout b-symlink && |
Brian Gernhardt | 6ecfd91 | 2008-10-31 01:09:13 -0400 | [diff] [blame] | 25 | l=$(printf file-different | git hash-object -t blob -w --stdin) && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 26 | echo "120000 $l symlink" | git update-index --index-info && |
Nanako Shiraishi | 3604e7c | 2008-09-03 17:59:29 +0900 | [diff] [blame] | 27 | git commit -m b-symlink && |
| 28 | git checkout b-file && |
Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 29 | echo plain-file > symlink && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 30 | git add symlink && |
Nanako Shiraishi | 3604e7c | 2008-09-03 17:59:29 +0900 | [diff] [blame] | 31 | git commit -m b-file' |
Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 32 | |
Junio C Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 33 | test_expect_success \ |
Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 34 | 'merge master into b-symlink, which has a different symbolic link' ' |
Nanako Shiraishi | 3604e7c | 2008-09-03 17:59:29 +0900 | [diff] [blame] | 35 | git checkout b-symlink && |
| 36 | test_must_fail git merge master' |
Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 37 | |
| 38 | test_expect_success \ |
| 39 | 'the merge result must be a file' ' |
| 40 | test -f symlink' |
| 41 | |
Junio C Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 42 | test_expect_success \ |
Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 43 | 'merge master into b-file, which has a file instead of a symbolic link' ' |
Nanako Shiraishi | 3604e7c | 2008-09-03 17:59:29 +0900 | [diff] [blame] | 44 | git reset --hard && git checkout b-file && |
| 45 | test_must_fail git merge master' |
Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 46 | |
| 47 | test_expect_success \ |
| 48 | 'the merge result must be a file' ' |
| 49 | test -f symlink' |
| 50 | |
Junio C Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 51 | test_expect_success \ |
Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 52 | 'merge b-file, which has a file instead of a symbolic link, into master' ' |
Nanako Shiraishi | 3604e7c | 2008-09-03 17:59:29 +0900 | [diff] [blame] | 53 | git reset --hard && |
| 54 | git checkout master && |
| 55 | test_must_fail git merge b-file' |
Johannes Sixt | 723024d | 2007-03-03 20:32:46 +0100 | [diff] [blame] | 56 | |
| 57 | test_expect_success \ |
| 58 | 'the merge result must be a file' ' |
| 59 | test -f symlink' |
| 60 | |
| 61 | test_done |