Merge branch 'js/fix-merge-arg-quoting-in-rebase-p' into next
[git] / t / t9829-git-p4-jobs.sh
1 #!/bin/sh
2
3 test_description='git p4 retrieve job info'
4
5 . ./lib-git-p4.sh
6
7 test_expect_success 'start p4d' '
8         start_p4d
9 '
10
11 test_expect_success 'add p4 jobs' '
12         (
13                 p4_add_job TESTJOB-A &&
14                 p4_add_job TESTJOB-B
15         )
16 '
17
18 test_expect_success 'add p4 files' '
19         client_view "//depot/... //client/..." &&
20         (
21                 cd "$cli" &&
22                 >file1 &&
23                 p4 add file1 &&
24                 p4 submit -d "Add file 1"
25         )
26 '
27
28 test_expect_success 'check log message of changelist with no jobs' '
29         client_view "//depot/... //client/..." &&
30         test_when_finished cleanup_git &&
31         (
32                 cd "$git" &&
33                 git init . &&
34                 git p4 clone --use-client-spec --destination="$git" //depot@all &&
35                 cat >expect <<-\EOF &&
36                 Add file 1
37                 [git-p4: depot-paths = "//depot/": change = 1]
38
39                 EOF
40                 git log --format=%B >actual &&
41                 test_cmp expect actual
42         )
43 '
44
45 test_expect_success 'add TESTJOB-A to change 1' '
46         (
47                 cd "$cli" &&
48                 p4 fix -c 1 TESTJOB-A
49         )
50 '
51
52 test_expect_success 'check log message of changelist with one job' '
53         client_view "//depot/... //client/..." &&
54         test_when_finished cleanup_git &&
55         (
56                 cd "$git" &&
57                 git init . &&
58                 git p4 clone --use-client-spec --destination="$git" //depot@all &&
59                 cat >expect <<-\EOF &&
60                 Add file 1
61                 Jobs: TESTJOB-A
62                 [git-p4: depot-paths = "//depot/": change = 1]
63
64                 EOF
65                 git log --format=%B >actual &&
66                 test_cmp expect actual
67         )
68 '
69
70 test_expect_success 'add TESTJOB-B to change 1' '
71         (
72                 cd "$cli" &&
73                 p4 fix -c 1 TESTJOB-B
74         )
75 '
76
77 test_expect_success 'check log message of changelist with more jobs' '
78         client_view "//depot/... //client/..." &&
79         test_when_finished cleanup_git &&
80         (
81                 cd "$git" &&
82                 git init . &&
83                 git p4 clone --use-client-spec --destination="$git" //depot@all &&
84                 cat >expect <<-\EOF &&
85                 Add file 1
86                 Jobs: TESTJOB-A TESTJOB-B
87                 [git-p4: depot-paths = "//depot/": change = 1]
88
89                 EOF
90                 git log --format=%B >actual &&
91                 test_cmp expect actual
92         )
93 '
94
95 test_expect_success 'kill p4d' '
96         kill_p4d
97 '
98
99 test_done