Sync with Git 2.46.1
[git/gitster.git] / t / t9827-git-p4-change-filetype.sh
blob3476ea2fd3b5773421f989b974e5eb88663a7845
1 #!/bin/sh
3 test_description='git p4 support for file type change'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./lib-git-p4.sh
8 test_expect_success 'start p4d' '
9 start_p4d
12 test_expect_success 'create files' '
14 cd "$cli" &&
15 p4 client -o | sed "/LineEnd/s/:.*/:unix/" | p4 client -i &&
16 cat >file1 <<-EOF &&
17 text without any funny substitution business
18 EOF
19 cat >file2 <<-EOF &&
20 second file whose type will change
21 EOF
22 p4 add file1 file2 &&
23 p4 submit -d "add files"
27 test_expect_success SYMLINKS 'change file to symbolic link' '
28 git p4 clone --dest="$git" //depot@all &&
29 test_when_finished cleanup_git &&
31 cd "$git" &&
32 git config git-p4.skipSubmitEdit true &&
34 rm file2 &&
35 ln -s file1 file2 &&
36 git add file2 &&
37 git commit -m "symlink file1 to file2" &&
38 git p4 submit &&
39 p4 filelog -m 1 //depot/file2 >filelog &&
40 grep "(symlink)" filelog
44 test_expect_success SYMLINKS 'change symbolic link to file' '
45 git p4 clone --dest="$git" //depot@all &&
46 test_when_finished cleanup_git &&
48 cd "$git" &&
49 git config git-p4.skipSubmitEdit true &&
51 rm file2 &&
52 cat >file2 <<-EOF &&
53 This is another content for the second file.
54 EOF
55 git add file2 &&
56 git commit -m "re-write file2" &&
57 git p4 submit &&
58 p4 filelog -m 1 //depot/file2 >filelog &&
59 grep "(text)" filelog
63 test_done