mirror of
https://github.com/git/git.git
synced 2024-11-14 13:13:01 +01:00
a2c6726417
* ab/test-2: (51 commits) tests: factor HOME=$(pwd) in test-lib.sh test-lib: use subshell instead of cd $new && .. && cd $old tests: simplify "missing PREREQ" message t/t0000-basic.sh: Run the passing TODO test inside its own test-lib test-lib: Allow overriding of TEST_DIRECTORY test-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../ test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../ test: Introduce $GIT_BUILD_DIR cvs tests: do not touch test CVS repositories shipped with source t/t9602-cvsimport-branches-tags.sh: Add a PERL prerequisite t/t9601-cvsimport-vendor-branch.sh: Add a PERL prerequisite t/t7105-reset-patch.sh: Add a PERL prerequisite t/t9001-send-email.sh: convert setup code to tests t/t9001-send-email.sh: change from skip_all=* to prereq skip t/t9001-send-email.sh: Remove needless PROG=* assignment t/t9600-cvsimport.sh: change from skip_all=* to prereq skip lib-patch-mode tests: change from skip_all=* to prereq skip t/t3701-add-interactive.sh: change from skip_all=* to prereq skip tests: Move FILEMODE prerequisite to lib-prereq-FILEMODE.sh t/Makefile: Create test-results dir for smoke target ... Conflicts: t/t6035-merge-dir-to-symlink.sh
87 lines
1.8 KiB
Bash
Executable file
87 lines
1.8 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='merge-recursive: handle file mode'
|
|
. ./test-lib.sh
|
|
. "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh
|
|
|
|
test_expect_success 'mode change in one branch: keep changed version' '
|
|
: >file1 &&
|
|
git add file1 &&
|
|
git commit -m initial &&
|
|
git checkout -b a1 master &&
|
|
: >dummy &&
|
|
git add dummy &&
|
|
git commit -m a &&
|
|
git checkout -b b1 master &&
|
|
test_chmod +x file1 &&
|
|
git commit -m b1 &&
|
|
git checkout a1 &&
|
|
git merge-recursive master -- a1 b1 &&
|
|
git ls-files -s file1 | grep ^100755
|
|
'
|
|
|
|
test_expect_success FILEMODE 'verify executable bit on file' '
|
|
test -x file1
|
|
'
|
|
|
|
test_expect_success 'mode change in both branches: expect conflict' '
|
|
git reset --hard HEAD &&
|
|
git checkout -b a2 master &&
|
|
: >file2 &&
|
|
H=$(git hash-object file2) &&
|
|
test_chmod +x file2 &&
|
|
git commit -m a2 &&
|
|
git checkout -b b2 master &&
|
|
: >file2 &&
|
|
git add file2 &&
|
|
git commit -m b2 &&
|
|
git checkout a2 &&
|
|
(
|
|
git merge-recursive master -- a2 b2
|
|
test $? = 1
|
|
) &&
|
|
git ls-files -u >actual &&
|
|
(
|
|
echo "100755 $H 2 file2"
|
|
echo "100644 $H 3 file2"
|
|
) >expect &&
|
|
test_cmp actual expect &&
|
|
git ls-files -s file2 | grep ^100755
|
|
'
|
|
|
|
test_expect_success FILEMODE 'verify executable bit on file' '
|
|
test -x file2
|
|
'
|
|
|
|
test_expect_success 'merging with triple rename across D/F conflict' '
|
|
git reset --hard HEAD &&
|
|
git checkout -b main &&
|
|
git rm -rf . &&
|
|
|
|
echo "just a file" >sub1 &&
|
|
mkdir -p sub2 &&
|
|
echo content1 >sub2/file1 &&
|
|
echo content2 >sub2/file2 &&
|
|
echo content3 >sub2/file3 &&
|
|
mkdir simple &&
|
|
echo base >simple/bar &&
|
|
git add -A &&
|
|
test_tick &&
|
|
git commit -m base &&
|
|
|
|
git checkout -b other &&
|
|
echo more >>simple/bar &&
|
|
test_tick &&
|
|
git commit -a -m changesimplefile &&
|
|
|
|
git checkout main &&
|
|
git rm sub1 &&
|
|
git mv sub2 sub1 &&
|
|
test_tick &&
|
|
git commit -m changefiletodir &&
|
|
|
|
test_tick &&
|
|
git merge other
|
|
'
|
|
|
|
test_done
|