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