Update dtaft release notes to 1.8.3
[git/jnareb-git.git] / t / t9804-git-p4-label.sh
blobe30f80e617674967b1d474c1485a6570f1ef2903
1 #!/bin/sh
3 test_description='git p4 label tests'
5 . ./lib-git-p4.sh
7 test_expect_success 'start p4d' '
8 start_p4d
11 # Basic p4 label tests.
13 # Note: can't have more than one label per commit - others
14 # are silently discarded.
16 test_expect_success 'basic p4 labels' '
17 test_when_finished cleanup_git &&
19 cd "$cli" &&
20 mkdir -p main &&
22 echo f1 >main/f1 &&
23 p4 add main/f1 &&
24 p4 submit -d "main/f1" &&
26 echo f2 >main/f2 &&
27 p4 add main/f2 &&
28 p4 submit -d "main/f2" &&
30 echo f3 >main/file_with_\$metachar &&
31 p4 add main/file_with_\$metachar &&
32 p4 submit -d "file with metachar" &&
34 p4 tag -l tag_f1_only main/f1 &&
35 p4 tag -l tag_with\$_shell_char main/... &&
37 echo f4 >main/f4 &&
38 p4 add main/f4 &&
39 p4 submit -d "main/f4" &&
41 p4 label -i <<-EOF &&
42 Label: long_label
43 Description:
44 A Label first line
45 A Label second line
46 View: //depot/...
47 EOF
49 p4 tag -l long_label ... &&
51 p4 labels ... &&
53 git p4 clone --dest="$git" --detect-labels //depot@all &&
54 cd "$git" &&
56 git tag &&
57 git tag >taglist &&
58 test_line_count = 3 taglist &&
60 cd main &&
61 git checkout tag_tag_f1_only &&
62 ! test -f f2 &&
63 git checkout tag_tag_with\$_shell_char &&
64 test -f f1 && test -f f2 && test -f file_with_\$metachar &&
66 git show tag_long_label | grep -q "A Label second line"
70 # Test some label corner cases:
72 # - two tags on the same file; both should be available
73 # - a tag that is only on one file; this kind of tag
74 # cannot be imported (at least not easily).
76 test_expect_failure 'two labels on the same changelist' '
77 test_when_finished cleanup_git &&
79 cd "$cli" &&
80 mkdir -p main &&
82 p4 edit main/f1 main/f2 &&
83 echo "hello world" >main/f1 &&
84 echo "not in the tag" >main/f2 &&
85 p4 submit -d "main/f[12]: testing two labels" &&
87 p4 tag -l tag_f1_1 main/... &&
88 p4 tag -l tag_f1_2 main/... &&
90 p4 labels ... &&
92 git p4 clone --dest="$git" --detect-labels //depot@all &&
93 cd "$git" &&
95 git tag | grep tag_f1 &&
96 git tag | grep -q tag_f1_1 &&
97 git tag | grep -q tag_f1_2 &&
99 cd main &&
101 git checkout tag_tag_f1_1 &&
102 ls &&
103 test -f f1 &&
105 git checkout tag_tag_f1_2 &&
106 ls &&
107 test -f f1
111 test_expect_success 'kill p4d' '
112 kill_p4d
115 test_done