]> git.ipfire.org Git - thirdparty/git.git/blame - t/t6405-merge-symlinks.sh
Merge branch 'js/range-diff-wo-dotdot'
[thirdparty/git.git] / t / t6405-merge-symlinks.sh
CommitLineData
723024d6
JS
1#!/bin/sh
2#
3# Copyright (c) 2007 Johannes Sixt
4#
5
6test_description='merging symlinks on filesystem w/o symlink support.
7
3604e7c5 8This tests that git merge-recursive writes merge results as plain files
723024d6
JS
9if core.symlinks is false.'
10
5902f5f4 11GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
12export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
13
723024d6
JS
14. ./test-lib.sh
15
70789843
SS
16test_expect_success 'setup' '
17 git config core.symlinks false &&
18 >file &&
19 git add file &&
20 git commit -m initial &&
21 git branch b-symlink &&
22 git branch b-file &&
23 l=$(printf file | git hash-object -t blob -w --stdin) &&
24 echo "120000 $l symlink" | git update-index --index-info &&
5902f5f4 25 git commit -m main &&
70789843
SS
26 git checkout b-symlink &&
27 l=$(printf file-different | git hash-object -t blob -w --stdin) &&
28 echo "120000 $l symlink" | git update-index --index-info &&
29 git commit -m b-symlink &&
30 git checkout b-file &&
31 echo plain-file >symlink &&
32 git add symlink &&
33 git commit -m b-file
34'
35
5902f5f4 36test_expect_success 'merge main into b-symlink, which has a different symbolic link' '
70789843 37 git checkout b-symlink &&
5902f5f4 38 test_must_fail git merge main
70789843
SS
39'
40
41test_expect_success 'the merge result must be a file' '
c513a958 42 test_path_is_file symlink
70789843
SS
43'
44
5902f5f4 45test_expect_success 'merge main into b-file, which has a file instead of a symbolic link' '
70789843
SS
46 git reset --hard &&
47 git checkout b-file &&
5902f5f4 48 test_must_fail git merge main
70789843
SS
49'
50
51test_expect_success 'the merge result must be a file' '
c513a958 52 test_path_is_file symlink
70789843
SS
53'
54
5902f5f4 55test_expect_success 'merge b-file, which has a file instead of a symbolic link, into main' '
70789843 56 git reset --hard &&
5902f5f4 57 git checkout main &&
70789843
SS
58 test_must_fail git merge b-file
59'
60
61test_expect_success 'the merge result must be a file' '
c513a958 62 test_path_is_file symlink
70789843 63'
723024d6
JS
64
65test_done