]> git.ipfire.org Git - thirdparty/git.git/blame - t/t6405-merge-symlinks.sh
Sync with Git 2.45.1
[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
3e3b9321 14TEST_PASSES_SANITIZE_LEAK=true
723024d6
JS
15. ./test-lib.sh
16
70789843
SS
17test_expect_success 'setup' '
18 git config core.symlinks false &&
19 >file &&
20 git add file &&
21 git commit -m initial &&
22 git branch b-symlink &&
23 git branch b-file &&
24 l=$(printf file | git hash-object -t blob -w --stdin) &&
25 echo "120000 $l symlink" | git update-index --index-info &&
5902f5f4 26 git commit -m main &&
70789843
SS
27 git checkout b-symlink &&
28 l=$(printf file-different | git hash-object -t blob -w --stdin) &&
29 echo "120000 $l symlink" | git update-index --index-info &&
30 git commit -m b-symlink &&
31 git checkout b-file &&
32 echo plain-file >symlink &&
33 git add symlink &&
34 git commit -m b-file
35'
36
5902f5f4 37test_expect_success 'merge main into b-symlink, which has a different symbolic link' '
70789843 38 git checkout b-symlink &&
5902f5f4 39 test_must_fail git merge main
70789843
SS
40'
41
42test_expect_success 'the merge result must be a file' '
c513a958 43 test_path_is_file symlink
70789843
SS
44'
45
5902f5f4 46test_expect_success 'merge main into b-file, which has a file instead of a symbolic link' '
70789843
SS
47 git reset --hard &&
48 git checkout b-file &&
5902f5f4 49 test_must_fail git merge main
70789843
SS
50'
51
52test_expect_success 'the merge result must be a file' '
c513a958 53 test_path_is_file symlink
70789843
SS
54'
55
5902f5f4 56test_expect_success 'merge b-file, which has a file instead of a symbolic link, into main' '
70789843 57 git reset --hard &&
5902f5f4 58 git checkout main &&
70789843
SS
59 test_must_fail git merge b-file
60'
61
62test_expect_success 'the merge result must be a file' '
c513a958 63 test_path_is_file symlink
70789843 64'
723024d6
JS
65
66test_done