1package testhelper
2
3import (
4	"github.com/golang/protobuf/ptypes/timestamp"
5	"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
6)
7
8var (
9	/*
10		This is a manually maintained map to remove duplicate variable
11		assignments. Please do not use go generate or such to maintain
12		these, as we'd effectively test one parser against another.
13	*/
14	commitMap = map[string]*gitalypb.GitCommit{
15		"b83d6e391c22777fca1ed3012fce84f633d7fed0": &gitalypb.GitCommit{
16			Id:      "b83d6e391c22777fca1ed3012fce84f633d7fed0",
17			Subject: []byte("Merge branch 'branch-merged' into 'master'"),
18			Body:    []byte("Merge branch 'branch-merged' into 'master'\r\n\r\nadds bar folder and branch-test text file to check Repository merged_to_root_ref method\r\n\r\n\r\n\r\nSee merge request !12"),
19			Author: &gitalypb.CommitAuthor{
20				Name:     []byte("Job van der Voort"),
21				Email:    []byte("job@gitlab.com"),
22				Date:     &timestamp.Timestamp{Seconds: 1474987066},
23				Timezone: []byte("+0000"),
24			},
25			Committer: &gitalypb.CommitAuthor{
26				Name:     []byte("Job van der Voort"),
27				Email:    []byte("job@gitlab.com"),
28				Date:     &timestamp.Timestamp{Seconds: 1474987066},
29				Timezone: []byte("+0000"),
30			},
31			ParentIds: []string{
32				"1b12f15a11fc6e62177bef08f47bc7b5ce50b141",
33				"498214de67004b1da3d820901307bed2a68a8ef6",
34			},
35			BodySize: 162,
36			TreeId:   "06a736b30226509bcb4bae41df06c9be8f93a716",
37		},
38		"e63f41fe459e62e1228fcef60d7189127aeba95a": &gitalypb.GitCommit{
39			Id:      "e63f41fe459e62e1228fcef60d7189127aeba95a",
40			Subject: []byte("Merge branch 'gitlab-test-usage-dev-testing-docs' into 'master'"),
41			Body:    []byte("Merge branch 'gitlab-test-usage-dev-testing-docs' into 'master'\r\n\r\nUpdate README.md to include `Usage in testing and development`\r\n\r\nSee merge request !21"),
42			Author: &gitalypb.CommitAuthor{
43				Name:     []byte("Sean McGivern"),
44				Email:    []byte("sean@mcgivern.me.uk"),
45				Date:     &timestamp.Timestamp{Seconds: 1491906794},
46				Timezone: []byte("+0000"),
47			},
48			Committer: &gitalypb.CommitAuthor{
49				Name:     []byte("Sean McGivern"),
50				Email:    []byte("sean@mcgivern.me.uk"),
51				Date:     &timestamp.Timestamp{Seconds: 1491906794},
52				Timezone: []byte("+0000"),
53			},
54			ParentIds: []string{
55				"b83d6e391c22777fca1ed3012fce84f633d7fed0",
56				"4a24d82dbca5c11c61556f3b35ca472b7463187e",
57			},
58			BodySize: 154,
59			TreeId:   "86ec18bfe87ad42a782fdabd8310f9b7ac750f51",
60		},
61		"4a24d82dbca5c11c61556f3b35ca472b7463187e": &gitalypb.GitCommit{
62			Id:      "4a24d82dbca5c11c61556f3b35ca472b7463187e",
63			Subject: []byte("Update README.md to include `Usage in testing and development`"),
64			Body:    []byte("Update README.md to include `Usage in testing and development`"),
65			Author: &gitalypb.CommitAuthor{
66				Name:     []byte("Luke \"Jared\" Bennett"),
67				Email:    []byte("lbennett@gitlab.com"),
68				Date:     &timestamp.Timestamp{Seconds: 1491905339},
69				Timezone: []byte("+0000"),
70			},
71			Committer: &gitalypb.CommitAuthor{
72				Name:     []byte("Luke \"Jared\" Bennett"),
73				Email:    []byte("lbennett@gitlab.com"),
74				Date:     &timestamp.Timestamp{Seconds: 1491905339},
75				Timezone: []byte("+0000"),
76			},
77			ParentIds: []string{"b83d6e391c22777fca1ed3012fce84f633d7fed0"},
78			BodySize:  62,
79			TreeId:    "86ec18bfe87ad42a782fdabd8310f9b7ac750f51",
80		},
81		"ba3343bc4fa403a8dfbfcab7fc1a8c29ee34bd69": &gitalypb.GitCommit{
82			Id:      "ba3343bc4fa403a8dfbfcab7fc1a8c29ee34bd69",
83			Subject: []byte("Weird commit date"),
84			Body:    []byte("Weird commit date\n"),
85			Author: &gitalypb.CommitAuthor{
86				Name:  []byte("Alejandro Rodríguez"),
87				Email: []byte("alejorro70@gmail.com"),
88				// Not the actual commit date, but the biggest we can represent
89				Date:     &timestamp.Timestamp{Seconds: 9223371974719179007},
90				Timezone: []byte("+0000"),
91			},
92			Committer: &gitalypb.CommitAuthor{
93				Name:     []byte("Alejandro Rodríguez"),
94				Email:    []byte("alejorro70@gmail.com"),
95				Date:     &timestamp.Timestamp{Seconds: 9223371974719179007},
96				Timezone: []byte("+0000"),
97			},
98			ParentIds: []string{"e63f41fe459e62e1228fcef60d7189127aeba95a"},
99			BodySize:  18,
100			TreeId:    "900a037dd45679f72b95e5198459260b232a0d13",
101		},
102		"498214de67004b1da3d820901307bed2a68a8ef6": &gitalypb.GitCommit{
103			Id:      "498214de67004b1da3d820901307bed2a68a8ef6",
104			Subject: []byte("adds bar folder and branch-test text file to check Repository merged_to_root_ref method"),
105			Body:    []byte("adds bar folder and branch-test text file to check Repository merged_to_root_ref method\n"),
106			Author: &gitalypb.CommitAuthor{
107				Name:     []byte("tiagonbotelho"),
108				Email:    []byte("tiagonbotelho@hotmail.com"),
109				Date:     &timestamp.Timestamp{Seconds: 1474470806},
110				Timezone: []byte("+0100"),
111			},
112			Committer: &gitalypb.CommitAuthor{
113				Name:     []byte("tiagonbotelho"),
114				Email:    []byte("tiagonbotelho@hotmail.com"),
115				Date:     &timestamp.Timestamp{Seconds: 1474470806},
116				Timezone: []byte("+0100"),
117			},
118			ParentIds: []string{"1b12f15a11fc6e62177bef08f47bc7b5ce50b141"},
119			BodySize:  88,
120			TreeId:    "06a736b30226509bcb4bae41df06c9be8f93a716",
121		},
122		"6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9": &gitalypb.GitCommit{
123			Id:      "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9",
124			Subject: []byte("More submodules"),
125			Body:    []byte("More submodules\n\nSigned-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>\n"),
126			Author: &gitalypb.CommitAuthor{
127				Name:     []byte("Dmitriy Zaporozhets"),
128				Email:    []byte("dmitriy.zaporozhets@gmail.com"),
129				Date:     &timestamp.Timestamp{Seconds: 1393491261},
130				Timezone: []byte("+0200"),
131			},
132			Committer: &gitalypb.CommitAuthor{
133				Name:     []byte("Dmitriy Zaporozhets"),
134				Email:    []byte("dmitriy.zaporozhets@gmail.com"),
135				Date:     &timestamp.Timestamp{Seconds: 1393491261},
136				Timezone: []byte("+0200"),
137			},
138			ParentIds:     []string{"d14d6c0abdd253381df51a723d58691b2ee1ab08"},
139			BodySize:      84,
140			SignatureType: gitalypb.SignatureType_PGP,
141			TreeId:        "70d69cce111b0e1f54f7e5438bbbba9511a8e23c",
142		},
143		"1a0b36b3cdad1d2ee32457c102a8c0b7056fa863": &gitalypb.GitCommit{
144			Id:      "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863",
145			Subject: []byte("Initial commit"),
146			Body:    []byte("Initial commit\n"),
147			Author: &gitalypb.CommitAuthor{
148				Name:     []byte("Dmitriy Zaporozhets"),
149				Email:    []byte("dmitriy.zaporozhets@gmail.com"),
150				Date:     &timestamp.Timestamp{Seconds: 1393488198},
151				Timezone: []byte("-0800"),
152			},
153			Committer: &gitalypb.CommitAuthor{
154				Name:     []byte("Dmitriy Zaporozhets"),
155				Email:    []byte("dmitriy.zaporozhets@gmail.com"),
156				Date:     &timestamp.Timestamp{Seconds: 1393488198},
157				Timezone: []byte("-0800"),
158			},
159			ParentIds: nil,
160			BodySize:  15,
161			TreeId:    "91639b9835ff541f312fd2735f639a50bf35d472",
162		},
163		"77e835ef0856f33c4f0982f84d10bdb0567fe440": &gitalypb.GitCommit{
164			Id:      "77e835ef0856f33c4f0982f84d10bdb0567fe440",
165			Subject: []byte("Add file larger than 1 mb"),
166			Body:    []byte("Add file larger than 1 mb\n\nIn order to test Max File Size push rule we need a file larger than 1 MB\n"),
167			Author: &gitalypb.CommitAuthor{
168				Name:     []byte("Ruben Davila"),
169				Email:    []byte("rdavila84@gmail.com"),
170				Date:     &timestamp.Timestamp{Seconds: 1523247267},
171				Timezone: []byte("-0500"),
172			},
173			Committer: &gitalypb.CommitAuthor{
174				Name:     []byte("Jacob Vosmaer"),
175				Email:    []byte("jacob@gitlab.com"),
176				Date:     &timestamp.Timestamp{Seconds: 1527855450},
177				Timezone: []byte("+0200"),
178			},
179			ParentIds: []string{"60ecb67744cb56576c30214ff52294f8ce2def98"},
180			BodySize:  100,
181			TreeId:    "f9f4f0b6c70cbd88549d1e5b441ccd65b436a594",
182		},
183		"0999bb770f8dc92ab5581cc0b474b3e31a96bf5c": &gitalypb.GitCommit{
184			Id:      "0999bb770f8dc92ab5581cc0b474b3e31a96bf5c",
185			Subject: []byte("Hello\xf0world"),
186			Body:    []byte("Hello\xf0world\n"),
187			Author: &gitalypb.CommitAuthor{
188				Name:     []byte("Jacob Vosmaer"),
189				Email:    []byte("jacob@gitlab.com"),
190				Date:     &timestamp.Timestamp{Seconds: 1517328273},
191				Timezone: []byte("+0100"),
192			},
193			Committer: &gitalypb.CommitAuthor{
194				Name:     []byte("Jacob Vosmaer"),
195				Email:    []byte("jacob@gitlab.com"),
196				Date:     &timestamp.Timestamp{Seconds: 1517328273},
197				Timezone: []byte("+0100"),
198			},
199			ParentIds:     []string{"60ecb67744cb56576c30214ff52294f8ce2def98"},
200			BodySize:      12,
201			SignatureType: gitalypb.SignatureType_NONE,
202			TreeId:        "7e2f26d033ee47cd0745649d1a28277c56197921",
203		},
204		"189a6c924013fc3fe40d6f1ec1dc20214183bc97": &gitalypb.GitCommit{
205			Id:      "189a6c924013fc3fe40d6f1ec1dc20214183bc97",
206			Subject: []byte("style: use markdown header within README.md"),
207			Body:    []byte("style: use markdown header within README.md\n"),
208			Author: &gitalypb.CommitAuthor{
209				Name:     []byte("Roger Meier"),
210				Email:    []byte("r.meier@siemens.com"),
211				Date:     &timestamp.Timestamp{Seconds: 1570810009},
212				Timezone: []byte("+0200"),
213			},
214			Committer: &gitalypb.CommitAuthor{
215				Name:     []byte("Roger Meier"),
216				Email:    []byte("r.meier@siemens.com"),
217				Date:     &timestamp.Timestamp{Seconds: 1570810009},
218				Timezone: []byte("+0200"),
219			},
220			ParentIds:     []string{"0ad583fecb2fb1eaaadaf77d5a33bc69ec1061c1"},
221			BodySize:      44,
222			SignatureType: gitalypb.SignatureType_X509,
223			TreeId:        "13d7469f409bd0b8580a4f62c04dc0e710201136",
224		},
225		"570e7b2abdd848b95f2f578043fc23bd6f6fd24d": &gitalypb.GitCommit{
226			Id:      "570e7b2abdd848b95f2f578043fc23bd6f6fd24d",
227			Subject: []byte("Change some files"),
228			Body:    []byte("Change some files\n\nSigned-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>\n"),
229			Author: &gitalypb.CommitAuthor{
230				Name:     []byte("Dmitriy Zaporozhets"),
231				Email:    []byte("dmitriy.zaporozhets@gmail.com"),
232				Date:     &timestamp.Timestamp{Seconds: 1393491451},
233				Timezone: []byte("+0200"),
234			},
235			Committer: &gitalypb.CommitAuthor{
236				Name:     []byte("Dmitriy Zaporozhets"),
237				Email:    []byte("dmitriy.zaporozhets@gmail.com"),
238				Date:     &timestamp.Timestamp{Seconds: 1393491451},
239				Timezone: []byte("+0200"),
240			},
241			ParentIds:     []string{"6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9"},
242			BodySize:      86,
243			SignatureType: gitalypb.SignatureType_PGP,
244			TreeId:        "842b021b36723db3cf52936d3ff7c566d36c108c",
245		},
246		"5937ac0a7beb003549fc5fd26fc247adbce4a52e": &gitalypb.GitCommit{
247			Id:      "5937ac0a7beb003549fc5fd26fc247adbce4a52e",
248			Subject: []byte("Add submodule from gitlab.com"),
249			Body:    []byte("Add submodule from gitlab.com\n\nSigned-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>\n"),
250			Author: &gitalypb.CommitAuthor{
251				Name:     []byte("Dmitriy Zaporozhets"),
252				Email:    []byte("dmitriy.zaporozhets@gmail.com"),
253				Date:     &timestamp.Timestamp{Seconds: 1393491698},
254				Timezone: []byte("+0200"),
255			},
256			Committer: &gitalypb.CommitAuthor{
257				Name:     []byte("Dmitriy Zaporozhets"),
258				Email:    []byte("dmitriy.zaporozhets@gmail.com"),
259				Date:     &timestamp.Timestamp{Seconds: 1393491698},
260				Timezone: []byte("+0200"),
261			},
262			ParentIds:     []string{"570e7b2abdd848b95f2f578043fc23bd6f6fd24d"},
263			BodySize:      98,
264			SignatureType: gitalypb.SignatureType_PGP,
265			TreeId:        "a6973545d42361b28bfba5ced3b75dba5848b955",
266		},
267		"1b12f15a11fc6e62177bef08f47bc7b5ce50b141": &gitalypb.GitCommit{
268			Id:        "1b12f15a11fc6e62177bef08f47bc7b5ce50b141",
269			Body:      []byte("Merge branch 'add-directory-with-space' into 'master'\r\n\r\nAdd a directory containing a space in its name\r\n\r\nneeded for verifying the fix of `https://gitlab.com/gitlab-com/support-forum/issues/952` \r\n\r\nSee merge request !11"),
270			BodySize:  221,
271			ParentIds: []string{"6907208d755b60ebeacb2e9dfea74c92c3449a1f", "38008cb17ce1466d8fec2dfa6f6ab8dcfe5cf49e"},
272			Subject:   []byte("Merge branch 'add-directory-with-space' into 'master'"),
273			Author: &gitalypb.CommitAuthor{
274				Name:     []byte("Stan Hu"),
275				Email:    []byte("stanhu@gmail.com"),
276				Date:     &timestamp.Timestamp{Seconds: 1471558878},
277				Timezone: []byte("+0000"),
278			},
279			Committer: &gitalypb.CommitAuthor{
280				Name:     []byte("Stan Hu"),
281				Email:    []byte("stanhu@gmail.com"),
282				Date:     &timestamp.Timestamp{Seconds: 1471558878},
283				Timezone: []byte("+0000"),
284			},
285			TreeId: "23f60b6e4ff0c59039b42c8fc4d3f008abef3bee",
286		},
287		"e56497bb5f03a90a51293fc6d516788730953899": &gitalypb.GitCommit{
288			Id:        "e56497bb5f03a90a51293fc6d516788730953899",
289			Subject:   []byte("Merge branch 'tree_helper_spec' into 'master'"),
290			Body:      []byte("Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/275#note_732774)\n\nSee merge request !2\n"),
291			BodySize:  317,
292			ParentIds: []string{"5937ac0a7beb003549fc5fd26fc247adbce4a52e", "4cd80ccab63c82b4bad16faa5193fbd2aa06df40"},
293			Author: &gitalypb.CommitAuthor{
294				Name:     []byte("Sytse Sijbrandij"),
295				Email:    []byte("sytse@gitlab.com"),
296				Date:     &timestamp.Timestamp{Seconds: 1420925009},
297				Timezone: []byte("+0000"),
298			},
299			Committer: &gitalypb.CommitAuthor{
300				Name:     []byte("Sytse Sijbrandij"),
301				Email:    []byte("sytse@gitlab.com"),
302				Date:     &timestamp.Timestamp{Seconds: 1420925009},
303				Timezone: []byte("+0000"),
304			},
305			TreeId: "c56b5e763e885e1aed626da52a603ba740936ac2",
306		},
307	}
308)
309
310// GitLabTestCommit provides a key value lookup for commits in the GitLab-Test
311// repository
312func GitLabTestCommit(id string) *gitalypb.GitCommit {
313	return commitMap[id]
314}
315