Commit bf9a7e0607b21bb09c4b69913b84fe295d4f5b18

Vicent Marti 2014-07-22T20:30:26

Merge pull request #2485 from ethomson/cherrypick Rename git_cherry_pick to git_cherrypick

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
diff --git a/include/git2/cherrypick.h b/include/git2/cherrypick.h
index 9eccb0a..dea67c1 100644
--- a/include/git2/cherrypick.h
+++ b/include/git2/cherrypick.h
@@ -28,21 +28,21 @@ typedef struct {
 
 	git_merge_options merge_opts;
 	git_checkout_options checkout_opts;
-} git_cherry_pick_options;
+} git_cherrypick_options;
 
-#define GIT_CHERRY_PICK_OPTIONS_VERSION 1
-#define GIT_CHERRY_PICK_OPTIONS_INIT {GIT_CHERRY_PICK_OPTIONS_VERSION, 0, GIT_MERGE_OPTIONS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
+#define GIT_CHERRYPICK_OPTIONS_VERSION 1
+#define GIT_CHERRYPICK_OPTIONS_INIT {GIT_CHERRYPICK_OPTIONS_VERSION, 0, GIT_MERGE_OPTIONS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
 
 /**
- * Initializes a `git_cherry_pick_options` with default values. Equivalent to
- * creating an instance with GIT_CHERRY_PICK_OPTIONS_INIT.
+ * Initializes a `git_cherrypick_options` with default values. Equivalent to
+ * creating an instance with GIT_CHERRYPICK_OPTIONS_INIT.
  *
- * @param opts the `git_cherry_pick_options` struct to initialize
- * @param version Version of struct; pass `GIT_CHERRY_PICK_OPTIONS_VERSION`
+ * @param opts the `git_cherrypick_options` struct to initialize
+ * @param version Version of struct; pass `GIT_CHERRYPICK_OPTIONS_VERSION`
  * @return Zero on success; -1 on failure.
  */
-GIT_EXTERN(int) git_cherry_pick_init_options(
-	git_cherry_pick_options *opts,
+GIT_EXTERN(int) git_cherrypick_init_options(
+	git_cherrypick_options *opts,
 	unsigned int version);
 
 /**
@@ -53,16 +53,16 @@ GIT_EXTERN(int) git_cherry_pick_init_options(
  *
  * @param out pointer to store the index result in
  * @param repo the repository that contains the given commits
- * @param cherry_pick_commit the commit to cherry-pick
+ * @param cherrypick_commit the commit to cherry-pick
  * @param our_commit the commit to revert against (eg, HEAD)
  * @param mainline the parent of the revert commit, if it is a merge
  * @param merge_options the merge options (or null for defaults)
  * @return zero on success, -1 on failure.
  */
-GIT_EXTERN(int) git_cherry_pick_commit(
+GIT_EXTERN(int) git_cherrypick_commit(
 	git_index **out,
 	git_repository *repo,
-	git_commit *cherry_pick_commit,
+	git_commit *cherrypick_commit,
 	git_commit *our_commit,
 	unsigned int mainline,
 	const git_merge_options *merge_options);
@@ -72,13 +72,13 @@ GIT_EXTERN(int) git_cherry_pick_commit(
  *
  * @param repo the repository to cherry-pick
  * @param commit the commit to cherry-pick
- * @param cherry_pick_options the cherry-pick options (or null for defaults)
+ * @param cherrypick_options the cherry-pick options (or null for defaults)
  * @return zero on success, -1 on failure.
  */
-GIT_EXTERN(int) git_cherry_pick(
+GIT_EXTERN(int) git_cherrypick(
 	git_repository *repo,
 	git_commit *commit,
-	const git_cherry_pick_options *cherry_pick_options);
+	const git_cherrypick_options *cherrypick_options);
 
 /** @} */
 GIT_END_DECL
diff --git a/include/git2/repository.h b/include/git2/repository.h
index 6a8ff45..18e515c 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -662,7 +662,7 @@ typedef enum {
 	GIT_REPOSITORY_STATE_NONE,
 	GIT_REPOSITORY_STATE_MERGE,
 	GIT_REPOSITORY_STATE_REVERT,
-	GIT_REPOSITORY_STATE_CHERRY_PICK,
+	GIT_REPOSITORY_STATE_CHERRYPICK,
 	GIT_REPOSITORY_STATE_BISECT,
 	GIT_REPOSITORY_STATE_REBASE,
 	GIT_REPOSITORY_STATE_REBASE_INTERACTIVE,
diff --git a/src/cherrypick.c b/src/cherrypick.c
index cdc0eaa..e58d0ab 100644
--- a/src/cherrypick.c
+++ b/src/cherrypick.c
@@ -17,9 +17,9 @@
 #include "git2/commit.h"
 #include "git2/sys/commit.h"
 
-#define GIT_CHERRY_PICK_FILE_MODE		0666
+#define GIT_CHERRYPICK_FILE_MODE		0666
 
-static int write_cherry_pick_head(
+static int write_cherrypick_head(
 	git_repository *repo,
 	const char *commit_oidstr)
 {
@@ -27,8 +27,8 @@ static int write_cherry_pick_head(
 	git_buf file_path = GIT_BUF_INIT;
 	int error = 0;
 
-	if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_CHERRY_PICK_HEAD_FILE)) >= 0 &&
-		(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_CHERRY_PICK_FILE_MODE)) >= 0 &&
+	if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_CHERRYPICK_HEAD_FILE)) >= 0 &&
+		(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_CHERRYPICK_FILE_MODE)) >= 0 &&
 		(error = git_filebuf_printf(&file, "%s\n", commit_oidstr)) >= 0)
 		error = git_filebuf_commit(&file);
 
@@ -49,7 +49,7 @@ static int write_merge_msg(
 	int error = 0;
 
 	if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_MSG_FILE)) < 0 ||
-		(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_CHERRY_PICK_FILE_MODE)) < 0 ||
+		(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_CHERRYPICK_FILE_MODE)) < 0 ||
 		(error = git_filebuf_printf(&file, "%s", commit_msg)) < 0)
 		goto cleanup;
 
@@ -64,10 +64,10 @@ cleanup:
 	return error;
 }
 
-static int cherry_pick_normalize_opts(
+static int cherrypick_normalize_opts(
 	git_repository *repo,
-	git_cherry_pick_options *opts,
-	const git_cherry_pick_options *given,
+	git_cherrypick_options *opts,
+	const git_cherrypick_options *given,
 	const char *their_label)
 {
 	int error = 0;
@@ -77,10 +77,10 @@ static int cherry_pick_normalize_opts(
 	GIT_UNUSED(repo);
 
 	if (given != NULL)
-		memcpy(opts, given, sizeof(git_cherry_pick_options));
+		memcpy(opts, given, sizeof(git_cherrypick_options));
 	else {
-		git_cherry_pick_options default_opts = GIT_CHERRY_PICK_OPTIONS_INIT;
-		memcpy(opts, &default_opts, sizeof(git_cherry_pick_options));
+		git_cherrypick_options default_opts = GIT_CHERRYPICK_OPTIONS_INIT;
+		memcpy(opts, &default_opts, sizeof(git_cherrypick_options));
 	}
 
 	if (!opts->checkout_opts.checkout_strategy)
@@ -95,14 +95,14 @@ static int cherry_pick_normalize_opts(
 	return error;
 }
 
-static int cherry_pick_state_cleanup(git_repository *repo)
+static int cherrypick_state_cleanup(git_repository *repo)
 {
-	const char *state_files[] = { GIT_CHERRY_PICK_HEAD_FILE, GIT_MERGE_MSG_FILE };
+	const char *state_files[] = { GIT_CHERRYPICK_HEAD_FILE, GIT_MERGE_MSG_FILE };
 
 	return git_repository__cleanup_files(repo, state_files, ARRAY_SIZE(state_files));
 }
 
-static int cherry_pick_seterr(git_commit *commit, const char *fmt)
+static int cherrypick_seterr(git_commit *commit, const char *fmt)
 {
 	char commit_oidstr[GIT_OID_HEXSZ + 1];
 
@@ -112,60 +112,60 @@ static int cherry_pick_seterr(git_commit *commit, const char *fmt)
 	return -1;
 }
 
-int git_cherry_pick_commit(
+int git_cherrypick_commit(
 	git_index **out,
 	git_repository *repo,
-	git_commit *cherry_pick_commit,
+	git_commit *cherrypick_commit,
 	git_commit *our_commit,
 	unsigned int mainline,
 	const git_merge_options *merge_opts)
 {
 	git_commit *parent_commit = NULL;
-	git_tree *parent_tree = NULL, *our_tree = NULL, *cherry_pick_tree = NULL;
+	git_tree *parent_tree = NULL, *our_tree = NULL, *cherrypick_tree = NULL;
 	int parent = 0, error = 0;
 
-	assert(out && repo && cherry_pick_commit && our_commit);
+	assert(out && repo && cherrypick_commit && our_commit);
 
-	if (git_commit_parentcount(cherry_pick_commit) > 1) {
+	if (git_commit_parentcount(cherrypick_commit) > 1) {
 		if (!mainline)
-			return cherry_pick_seterr(cherry_pick_commit,
+			return cherrypick_seterr(cherrypick_commit,
 				"Mainline branch is not specified but %s is a merge commit");
 
 		parent = mainline;
 	} else {
 		if (mainline)
-			return cherry_pick_seterr(cherry_pick_commit,
+			return cherrypick_seterr(cherrypick_commit,
 				"Mainline branch specified but %s is not a merge commit");
 
-		parent = git_commit_parentcount(cherry_pick_commit);
+		parent = git_commit_parentcount(cherrypick_commit);
 	}
 
 	if (parent &&
-		((error = git_commit_parent(&parent_commit, cherry_pick_commit, (parent - 1))) < 0 ||
+		((error = git_commit_parent(&parent_commit, cherrypick_commit, (parent - 1))) < 0 ||
 		(error = git_commit_tree(&parent_tree, parent_commit)) < 0))
 		goto done;
 
-	if ((error = git_commit_tree(&cherry_pick_tree, cherry_pick_commit)) < 0 ||
+	if ((error = git_commit_tree(&cherrypick_tree, cherrypick_commit)) < 0 ||
 		(error = git_commit_tree(&our_tree, our_commit)) < 0)
 		goto done;
 
-	error = git_merge_trees(out, repo, parent_tree, our_tree, cherry_pick_tree, merge_opts);
+	error = git_merge_trees(out, repo, parent_tree, our_tree, cherrypick_tree, merge_opts);
 
 done:
 	git_tree_free(parent_tree);
 	git_tree_free(our_tree);
-	git_tree_free(cherry_pick_tree);
+	git_tree_free(cherrypick_tree);
 	git_commit_free(parent_commit);
 
 	return error;
 }
 
-int git_cherry_pick(
+int git_cherrypick(
 	git_repository *repo,
 	git_commit *commit,
-	const git_cherry_pick_options *given_opts)
+	const git_cherrypick_options *given_opts)
 {
-	git_cherry_pick_options opts;
+	git_cherrypick_options opts;
 	git_reference *our_ref = NULL;
 	git_commit *our_commit = NULL;
 	char commit_oidstr[GIT_OID_HEXSZ + 1];
@@ -176,7 +176,7 @@ int git_cherry_pick(
 
 	assert(repo && commit);
 
-	GITERR_CHECK_VERSION(given_opts, GIT_CHERRY_PICK_OPTIONS_VERSION, "git_cherry_pick_options");
+	GITERR_CHECK_VERSION(given_opts, GIT_CHERRYPICK_OPTIONS_VERSION, "git_cherrypick_options");
 
 	if ((error = git_repository__ensure_not_bare(repo, "cherry-pick")) < 0)
 		return error;
@@ -191,11 +191,11 @@ int git_cherry_pick(
 
 	if ((error = write_merge_msg(repo, commit_msg)) < 0 ||
 		(error = git_buf_printf(&their_label, "%.7s... %s", commit_oidstr, commit_summary)) < 0 ||
-		(error = cherry_pick_normalize_opts(repo, &opts, given_opts, git_buf_cstr(&their_label))) < 0 ||
-		(error = write_cherry_pick_head(repo, commit_oidstr)) < 0 ||
+		(error = cherrypick_normalize_opts(repo, &opts, given_opts, git_buf_cstr(&their_label))) < 0 ||
+		(error = write_cherrypick_head(repo, commit_oidstr)) < 0 ||
 		(error = git_repository_head(&our_ref, repo)) < 0 ||
 		(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJ_COMMIT)) < 0 ||
-		(error = git_cherry_pick_commit(&index_new, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
+		(error = git_cherrypick_commit(&index_new, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
 		(error = git_merge__check_result(repo, index_new)) < 0 ||
 		(error = git_merge__append_conflicts_to_merge_msg(repo, index_new)) < 0 ||
 		(error = git_checkout_index(repo, index_new, &opts.checkout_opts)) < 0)
@@ -203,7 +203,7 @@ int git_cherry_pick(
 	goto done;
 
 on_error:
-	cherry_pick_state_cleanup(repo);
+	cherrypick_state_cleanup(repo);
 
 done:
 	git_index_free(index_new);
@@ -214,10 +214,10 @@ done:
 	return error;
 }
 
-int git_cherry_pick_init_options(
-	git_cherry_pick_options *opts, unsigned int version)
+int git_cherrypick_init_options(
+	git_cherrypick_options *opts, unsigned int version)
 {
 	GIT_INIT_STRUCTURE_FROM_TEMPLATE(
-		opts, version, git_cherry_pick_options, GIT_CHERRY_PICK_OPTIONS_INIT);
+		opts, version, git_cherrypick_options, GIT_CHERRYPICK_OPTIONS_INIT);
 	return 0;
 }
diff --git a/src/refs.h b/src/refs.h
index a46b219..2e79bdf 100644
--- a/src/refs.h
+++ b/src/refs.h
@@ -35,7 +35,7 @@
 #define GIT_FETCH_HEAD_FILE "FETCH_HEAD"
 #define GIT_MERGE_HEAD_FILE "MERGE_HEAD"
 #define GIT_REVERT_HEAD_FILE "REVERT_HEAD"
-#define GIT_CHERRY_PICK_HEAD_FILE "CHERRY_PICK_HEAD"
+#define GIT_CHERRYPICK_HEAD_FILE "CHERRY_PICK_HEAD"
 #define GIT_BISECT_LOG_FILE "BISECT_LOG"
 #define GIT_REBASE_MERGE_DIR "rebase-merge/"
 #define GIT_REBASE_MERGE_INTERACTIVE_FILE GIT_REBASE_MERGE_DIR "interactive"
diff --git a/src/repository.c b/src/repository.c
index e8d50ae..4f7a5fe 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1915,8 +1915,8 @@ int git_repository_state(git_repository *repo)
 		state = GIT_REPOSITORY_STATE_MERGE;
 	else if(git_path_contains_file(&repo_path, GIT_REVERT_HEAD_FILE))
 		state = GIT_REPOSITORY_STATE_REVERT;
-	else if(git_path_contains_file(&repo_path, GIT_CHERRY_PICK_HEAD_FILE))
-		state = GIT_REPOSITORY_STATE_CHERRY_PICK;
+	else if(git_path_contains_file(&repo_path, GIT_CHERRYPICK_HEAD_FILE))
+		state = GIT_REPOSITORY_STATE_CHERRYPICK;
 	else if(git_path_contains_file(&repo_path, GIT_BISECT_LOG_FILE))
 		state = GIT_REPOSITORY_STATE_BISECT;
 
@@ -1958,7 +1958,7 @@ static const char *state_files[] = {
 	GIT_MERGE_MODE_FILE,
 	GIT_MERGE_MSG_FILE,
 	GIT_REVERT_HEAD_FILE,
-	GIT_CHERRY_PICK_HEAD_FILE,
+	GIT_CHERRYPICK_HEAD_FILE,
 	GIT_BISECT_LOG_FILE,
 	GIT_REBASE_MERGE_DIR,
 	GIT_REBASE_APPLY_DIR,
diff --git a/tests/cherrypick/bare.c b/tests/cherrypick/bare.c
index 7ac1054..1353365 100644
--- a/tests/cherrypick/bare.c
+++ b/tests/cherrypick/bare.c
@@ -39,7 +39,7 @@ void test_cherrypick_bare__automerge(void)
 	git_oid_fromstr(&cherry_oid, "cfc4f0999a8367568e049af4f72e452d40828a15");
 	cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
 
-	cl_git_pass(git_cherry_pick_commit(&index, repo, commit, head, 0, NULL));
+	cl_git_pass(git_cherrypick_commit(&index, repo, commit, head, 0, NULL));
 	cl_assert(merge_test_index(index, merge_index_entries, 3));
 
 	git_index_free(index);
@@ -69,7 +69,7 @@ void test_cherrypick_bare__conflicts(void)
 	git_oid_fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110");
 	cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
 
-	cl_git_pass(git_cherry_pick_commit(&index, repo, commit, head, 0, NULL));
+	cl_git_pass(git_cherrypick_commit(&index, repo, commit, head, 0, NULL));
 	cl_assert(merge_test_index(index, merge_index_entries, 7));
 
 	git_index_free(index);
@@ -96,7 +96,7 @@ void test_cherrypick_bare__orphan(void)
 	git_oid_fromstr(&cherry_oid, "74f06b5bfec6d33d7264f73606b57a7c0b963819");
 	cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
 
-	cl_git_pass(git_cherry_pick_commit(&index, repo, commit, head, 0, NULL));
+	cl_git_pass(git_cherrypick_commit(&index, repo, commit, head, 0, NULL));
 	cl_assert(merge_test_index(index, merge_index_entries, 4));
 
 	git_index_free(index);
diff --git a/tests/cherrypick/workdir.c b/tests/cherrypick/workdir.c
index 581a5f9..f41d478 100644
--- a/tests/cherrypick/workdir.c
+++ b/tests/cherrypick/workdir.c
@@ -36,7 +36,7 @@ void test_cherrypick_workdir__automerge(void)
 	git_signature *signature = NULL;
 	size_t i;
 
-	const char *cherry_pick_oids[] = {
+	const char *cherrypick_oids[] = {
 		"cfc4f0999a8367568e049af4f72e452d40828a15",
 		"964ea3da044d9083181a88ba6701de9e35778bf4",
 		"a43a050c588d4e92f11a6b139680923e9728477d",
@@ -62,29 +62,29 @@ void test_cherrypick_workdir__automerge(void)
 
 	for (i = 0; i < 3; ++i) {
 		git_commit *head = NULL, *commit = NULL;
-		git_oid cherry_oid, cherry_picked_oid, cherry_picked_tree_oid;
-		git_tree *cherry_picked_tree = NULL;
+		git_oid cherry_oid, cherrypicked_oid, cherrypicked_tree_oid;
+		git_tree *cherrypicked_tree = NULL;
 
 		cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
 		cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
 
-		git_oid_fromstr(&cherry_oid, cherry_pick_oids[i]);
+		git_oid_fromstr(&cherry_oid, cherrypick_oids[i]);
 		cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
-		cl_git_pass(git_cherry_pick(repo, commit, NULL));
+		cl_git_pass(git_cherrypick(repo, commit, NULL));
 
 		cl_assert(git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
 		cl_assert(git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
 
-		cl_git_pass(git_index_write_tree(&cherry_picked_tree_oid, repo_index));
-		cl_git_pass(git_tree_lookup(&cherry_picked_tree, repo, &cherry_picked_tree_oid));
-		cl_git_pass(git_commit_create(&cherry_picked_oid, repo, "HEAD", signature, signature, NULL,
-			"Cherry picked!", cherry_picked_tree, 1, (const git_commit **)&head));
+		cl_git_pass(git_index_write_tree(&cherrypicked_tree_oid, repo_index));
+		cl_git_pass(git_tree_lookup(&cherrypicked_tree, repo, &cherrypicked_tree_oid));
+		cl_git_pass(git_commit_create(&cherrypicked_oid, repo, "HEAD", signature, signature, NULL,
+			"Cherry picked!", cherrypicked_tree, 1, (const git_commit **)&head));
 
 		cl_assert(merge_test_index(repo_index, merge_index_entries + i * 3, 3));
 
-		git_oid_cpy(&head_oid, &cherry_picked_oid);
+		git_oid_cpy(&head_oid, &cherrypicked_oid);
 
-		git_tree_free(cherry_picked_tree);
+		git_tree_free(cherrypicked_tree);
 		git_commit_free(head);
 		git_commit_free(commit);
 	}
@@ -118,7 +118,7 @@ void test_cherrypick_workdir__conflicts(void)
 
 	git_oid_fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110");
 	cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
-	cl_git_pass(git_cherry_pick(repo, commit, NULL));
+	cl_git_pass(git_cherrypick(repo, commit, NULL));
 
 	cl_assert(git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
 	cl_assert(git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
@@ -198,7 +198,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
 {
 	git_commit *head = NULL, *commit = NULL;
 	git_oid head_oid, cherry_oid;
-	git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
+	git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
 
 	struct merge_index_entry merge_index_entries[] = {
 		{ 0100644, "242e7977ba73637822ffb265b46004b9b0e5153b", 0, "file1.txt" },
@@ -226,7 +226,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
 
 	git_oid_fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110");
 	cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
-	cl_git_pass(git_cherry_pick(repo, commit, &opts));
+	cl_git_pass(git_cherrypick(repo, commit, &opts));
 
 	cl_assert(merge_test_index(repo_index, merge_index_entries, 7));
 	cl_assert(merge_test_workdir(repo, merge_filesystem_entries, 3));
@@ -235,7 +235,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
 	opts.merge_opts.file_favor = GIT_MERGE_FILE_FAVOR_OURS;
 
 	cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
-	cl_git_pass(git_cherry_pick(repo, commit, &opts));
+	cl_git_pass(git_cherrypick(repo, commit, &opts));
 
 	cl_assert(merge_test_index(repo_index, merge_filesystem_entries, 3));
 	cl_assert(merge_test_workdir(repo, merge_filesystem_entries, 3));
@@ -251,7 +251,7 @@ void test_cherrypick_workdir__rename(void)
 {
 	git_commit *head, *commit;
 	git_oid head_oid, cherry_oid;
-	git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
+	git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
 
 	struct merge_index_entry merge_index_entries[] = {
 		{ 0100644, "19c5c7207054604b69c84d08a7571ef9672bb5c2", 0, "file1.txt" },
@@ -268,7 +268,7 @@ void test_cherrypick_workdir__rename(void)
 
 	git_oid_fromstr(&cherry_oid, "2a26c7e88b285613b302ba76712bc998863f3cbc");
 	cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
-	cl_git_pass(git_cherry_pick(repo, commit, &opts));
+	cl_git_pass(git_cherrypick(repo, commit, &opts));
 
 	cl_assert(merge_test_index(repo_index, merge_index_entries, 3));
 
@@ -284,7 +284,7 @@ void test_cherrypick_workdir__both_renamed(void)
 	git_commit *head, *commit;
 	git_oid head_oid, cherry_oid;
 	git_buf mergemsg_buf = GIT_BUF_INIT;
-	git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
+	git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
 
 	struct merge_index_entry merge_index_entries[] = {
 		{ 0100644, "19c5c7207054604b69c84d08a7571ef9672bb5c2", 0, "file1.txt" },
@@ -303,7 +303,7 @@ void test_cherrypick_workdir__both_renamed(void)
 
 	git_oid_fromstr(&cherry_oid, "2a26c7e88b285613b302ba76712bc998863f3cbc");
 	cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
-	cl_git_pass(git_cherry_pick(repo, commit, &opts));
+	cl_git_pass(git_cherrypick(repo, commit, &opts));
 
 	cl_assert(merge_test_index(repo_index, merge_index_entries, 5));
 
@@ -326,13 +326,13 @@ void test_cherrypick_workdir__nonmerge_fails_mainline_specified(void)
 {
 	git_reference *head;
 	git_commit *commit;
-	git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
+	git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
 
 	cl_git_pass(git_repository_head(&head, repo));
 	cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJ_COMMIT));
 
 	opts.mainline = 1;
-	cl_must_fail(git_cherry_pick(repo, commit, &opts));
+	cl_must_fail(git_cherrypick(repo, commit, &opts));
 	cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
 	cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
 
@@ -355,7 +355,7 @@ void test_cherrypick_workdir__merge_fails_without_mainline_specified(void)
 	git_oid_fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff");
 	cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
 
-	cl_must_fail(git_cherry_pick(repo, commit, NULL));
+	cl_must_fail(git_cherrypick(repo, commit, NULL));
 	cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
 	cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
 
@@ -370,7 +370,7 @@ void test_cherrypick_workdir__merge_first_parent(void)
 {
 	git_commit *head, *commit;
 	git_oid head_oid, cherry_oid;
-	git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
+	git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
 
 	struct merge_index_entry merge_index_entries[] = {
 		{ 0100644, "f90f9dcbdac2cce5cc166346160e19cb693ef4e8", 0, "file1.txt" },
@@ -387,7 +387,7 @@ void test_cherrypick_workdir__merge_first_parent(void)
 	git_oid_fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff");
 	cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
 
-	cl_git_pass(git_cherry_pick(repo, commit, &opts));
+	cl_git_pass(git_cherrypick(repo, commit, &opts));
 
 	cl_assert(merge_test_index(repo_index, merge_index_entries, 3));
 
@@ -402,7 +402,7 @@ void test_cherrypick_workdir__merge_second_parent(void)
 {
 	git_commit *head, *commit;
 	git_oid head_oid, cherry_oid;
-	git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
+	git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
 
 	struct merge_index_entry merge_index_entries[] = {
 		{ 0100644, "487434cace79238a7091e2220611d4f20a765690", 0, "file1.txt" },
@@ -419,7 +419,7 @@ void test_cherrypick_workdir__merge_second_parent(void)
 	git_oid_fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff");
 	cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
 
-	cl_git_pass(git_cherry_pick(repo, commit, &opts));
+	cl_git_pass(git_cherrypick(repo, commit, &opts));
 
 	cl_assert(merge_test_index(repo_index, merge_index_entries, 3));
 
diff --git a/tests/repo/state.c b/tests/repo/state.c
index 2d6c780..13407bf 100644
--- a/tests/repo/state.c
+++ b/tests/repo/state.c
@@ -59,8 +59,8 @@ void test_repo_state__revert(void)
 
 void test_repo_state__cherry_pick(void)
 {
-	setup_simple_state(GIT_CHERRY_PICK_HEAD_FILE);
-	assert_repo_state(GIT_REPOSITORY_STATE_CHERRY_PICK);
+	setup_simple_state(GIT_CHERRYPICK_HEAD_FILE);
+	assert_repo_state(GIT_REPOSITORY_STATE_CHERRYPICK);
 	cl_git_pass(git_repository_state_cleanup(_repo));
 	assert_repo_state(GIT_REPOSITORY_STATE_NONE);
 }