Commit 6bfb990dc74c3749b356f82f7c9744b43fe90ea9

Carlos Martín Nieto 2015-01-07T14:47:02

branch: don't accept a reflog message override This namespace is about behaving like git's branch command, so let's do exactly that instead of taking a reflog message. This override is still available via the reference namespace.

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
560
561
562
563
564
diff --git a/include/git2/branch.h b/include/git2/branch.h
index e45a364..06f4d2c 100644
--- a/include/git2/branch.h
+++ b/include/git2/branch.h
@@ -43,10 +43,6 @@ GIT_BEGIN_DECL
  *
  * @param force Overwrite existing branch.
  *
- * @param log_message The one line long message to be appended to the reflog.
- * If NULL, the default is "Branch: created"; if you want something more
- * useful, provide a message.
- *
  * @return 0, GIT_EINVALIDSPEC or an error code.
  * A proper reference is written in the refs/heads namespace
  * pointing to the provided target commit.
@@ -56,8 +52,7 @@ GIT_EXTERN(int) git_branch_create(
 	git_repository *repo,
 	const char *branch_name,
 	const git_commit *target,
-	int force,
-	const char *log_message);
+	int force);
 
 /**
  * Delete an existing branch reference.
@@ -120,16 +115,13 @@ GIT_EXTERN(void) git_branch_iterator_free(git_branch_iterator *iter);
  *
  * @param force Overwrite existing branch.
  *
- * @param log_message The one line long message to be appended to the reflog
- *
  * @return 0 on success, GIT_EINVALIDSPEC or an error code.
  */
 GIT_EXTERN(int) git_branch_move(
 	git_reference **out,
 	git_reference *branch,
 	const char *new_branch_name,
-	int force,
-	const char *log_message);
+	int force);
 
 /**
  * Lookup a branch by its name in a repository.
diff --git a/src/branch.c b/src/branch.c
index 762a262..4e9460f 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -54,13 +54,12 @@ int git_branch_create(
 	git_repository *repository,
 	const char *branch_name,
 	const git_commit *commit,
-	int force,
-	const char *log_message)
+	int force)
 {
 	int is_head = 0;
 	git_reference *branch = NULL;
 	git_buf canonical_branch_name = GIT_BUF_INIT,
-			  log_message_buf = GIT_BUF_INIT;
+			  log_message = GIT_BUF_INIT;
 	int error = -1;
 
 	assert(branch_name && commit && ref_out);
@@ -87,19 +86,19 @@ int git_branch_create(
 	if (git_buf_joinpath(&canonical_branch_name, GIT_REFS_HEADS_DIR, branch_name) < 0)
 		goto cleanup;
 
-	if (git_buf_sets(&log_message_buf, log_message ? log_message : "Branch: created") < 0)
+	if (git_buf_printf(&log_message, "Branch: created from %s", git_oid_tostr_s(git_commit_id(commit))) < 0)
 		goto cleanup;
 
 	error = git_reference_create(&branch, repository,
 		git_buf_cstr(&canonical_branch_name), git_commit_id(commit), force,
-		git_buf_cstr(&log_message_buf));
+		git_buf_cstr(&log_message));
 
 	if (!error)
 		*ref_out = branch;
 
 cleanup:
 	git_buf_free(&canonical_branch_name);
-	git_buf_free(&log_message_buf);
+	git_buf_free(&log_message);
 	return error;
 }
 
@@ -221,13 +220,12 @@ int git_branch_move(
 	git_reference **out,
 	git_reference *branch,
 	const char *new_branch_name,
-	int force,
-	const char *log_message)
+	int force)
 {
 	git_buf new_reference_name = GIT_BUF_INIT,
 	        old_config_section = GIT_BUF_INIT,
 	        new_config_section = GIT_BUF_INIT,
-	        log_message_buf = GIT_BUF_INIT;
+	        log_message = GIT_BUF_INIT;
 	int error;
 
 	assert(branch && new_branch_name);
@@ -238,20 +236,15 @@ int git_branch_move(
 	if ((error = git_buf_joinpath(&new_reference_name, GIT_REFS_HEADS_DIR, new_branch_name)) < 0)
 		goto done;
 
-	if (log_message) {
-		if ((error = git_buf_sets(&log_message_buf, log_message)) < 0)
+	if ((error = git_buf_printf(&log_message, "Branch: renamed %s to %s",
+				    git_reference_name(branch), git_buf_cstr(&new_reference_name))) < 0)
 			goto done;
-	} else {
-		if ((error = git_buf_printf(&log_message_buf, "Branch: renamed %s to %s",
-						git_reference_name(branch), git_buf_cstr(&new_reference_name))) < 0)
-			goto done;
-	}
 
 	/* first update ref then config so failure won't trash config */
 
 	error = git_reference_rename(
 		out, branch, git_buf_cstr(&new_reference_name), force,
-		git_buf_cstr(&log_message_buf));
+		git_buf_cstr(&log_message));
 	if (error < 0)
 		goto done;
 
@@ -268,7 +261,7 @@ done:
 	git_buf_free(&new_reference_name);
 	git_buf_free(&old_config_section);
 	git_buf_free(&new_config_section);
-	git_buf_free(&log_message_buf);
+	git_buf_free(&log_message);
 
 	return error;
 }
diff --git a/src/clone.c b/src/clone.c
index f7ae17c..ac6a059 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -35,6 +35,7 @@ static int create_branch(
 {
 	git_commit *head_obj = NULL;
 	git_reference *branch_ref = NULL;
+	git_buf refname = GIT_BUF_INIT;
 	int error;
 
 	/* Find the target commit */
@@ -42,8 +43,11 @@ static int create_branch(
 		return error;
 
 	/* Create the new branch */
-	error = git_branch_create(&branch_ref, repo, name, head_obj, 0, log_message);
+	if ((error = git_buf_printf(&refname, GIT_REFS_HEADS_DIR "%s", name)) < 0)
+		return error;
 
+	error = git_reference_create(&branch_ref, repo, git_buf_cstr(&refname), target, 0, log_message);
+	git_buf_free(&refname);
 	git_commit_free(head_obj);
 
 	if (!error)
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index 97ef22b..9620886 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -481,7 +481,7 @@ void assert_conflict(
 	/* Create a branch pointing at the parent */
 	cl_git_pass(git_revparse_single(&g_object, g_repo, parent_sha));
 	cl_git_pass(git_branch_create(&branch, g_repo,
-		"potential_conflict", (git_commit *)g_object, 0,  NULL));
+		"potential_conflict", (git_commit *)g_object, 0));
 
 	/* Make HEAD point to this branch */
 	cl_git_pass(git_reference_symbolic_create(
@@ -1201,7 +1201,7 @@ void test_checkout_tree__can_not_update_index(void)
 	cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD"));
 	cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJ_ANY));
 
-	cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts, NULL));
+	cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts));
 
 	cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
 
@@ -1238,7 +1238,7 @@ void test_checkout_tree__can_update_but_not_write_index(void)
 	cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD"));
 	cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJ_ANY));
 
-	cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts, NULL));
+	cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts));
 
 	cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
 
diff --git a/tests/perf/helper__perf__do_merge.c b/tests/perf/helper__perf__do_merge.c
index 8ffd863..10f726c 100644
--- a/tests/perf/helper__perf__do_merge.c
+++ b/tests/perf/helper__perf__do_merge.c
@@ -37,7 +37,7 @@ void perf__do_merge(const char *fixture,
 	cl_git_pass(git_commit_lookup(&commit_a, g_repo, &oid_a));
 	cl_git_pass(git_branch_create(&ref_branch_a, g_repo,
 								  "A", commit_a,
-								  0, NULL));
+								  0));
 
 	perf__timer__start(&t_checkout);
 	cl_git_pass(git_checkout_tree(g_repo, (git_object*)commit_a, &checkout_opts));
@@ -50,7 +50,7 @@ void perf__do_merge(const char *fixture,
 	cl_git_pass(git_commit_lookup(&commit_b, g_repo, &oid_b));
 	cl_git_pass(git_branch_create(&ref_branch_b, g_repo,
 								  "B", commit_b,
-								  0, NULL));
+								  0));
 
 	cl_git_pass(git_annotated_commit_lookup(&annotated_commits[0], g_repo, &oid_b));
 
diff --git a/tests/refs/branches/create.c b/tests/refs/branches/create.c
index 4d52c77..dc80578 100644
--- a/tests/refs/branches/create.c
+++ b/tests/refs/branches/create.c
@@ -45,7 +45,7 @@ void test_refs_branches_create__can_create_a_local_branch(void)
 {
 	retrieve_known_commit(&target, repo);
 
-	cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, 0, NULL));
+	cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, 0));
 	cl_git_pass(git_oid_cmp(git_reference_target(branch), git_commit_id(target)));
 }
 
@@ -53,14 +53,14 @@ void test_refs_branches_create__can_not_create_a_branch_if_its_name_collide_with
 {
 	retrieve_known_commit(&target, repo);
 
-	cl_assert_equal_i(GIT_EEXISTS, git_branch_create(&branch, repo, "br2", target, 0, NULL));
+	cl_assert_equal_i(GIT_EEXISTS, git_branch_create(&branch, repo, "br2", target, 0));
 }
 
 void test_refs_branches_create__can_force_create_over_an_existing_branch(void)
 {
 	retrieve_known_commit(&target, repo);
 
-	cl_git_pass(git_branch_create(&branch, repo, "br2", target, 1, NULL));
+	cl_git_pass(git_branch_create(&branch, repo, "br2", target, 1));
 	cl_git_pass(git_oid_cmp(git_reference_target(branch), git_commit_id(target)));
 	cl_assert_equal_s("refs/heads/br2", git_reference_name(branch));
 }
@@ -76,7 +76,7 @@ void test_refs_branches_create__cannot_force_create_over_current_branch(void)
 	cl_assert_equal_i(true, git_branch_is_head(branch2));
 	oid = git_reference_target(branch2);
 
-	cl_git_fail_with(-1, git_branch_create(&branch, repo, "master", target, 1, NULL));
+	cl_git_fail_with(-1, git_branch_create(&branch, repo, "master", target, 1));
 	branch = NULL;
 	cl_git_pass(git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL));
 	cl_assert_equal_s("refs/heads/master", git_reference_name(branch));
@@ -89,32 +89,13 @@ void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_E
 	retrieve_known_commit(&target, repo);
 
 	cl_assert_equal_i(GIT_EINVALIDSPEC,
-		git_branch_create(&branch, repo, "inv@{id", target, 0, NULL));
-}
-
-void test_refs_branches_create__creation_creates_new_reflog(void)
-{
-	git_reflog *log;
-	const git_reflog_entry *entry;
-	git_signature *sig;
-
-	cl_git_pass(git_signature_now(&sig, "me", "foo@example.com"));
-
-	retrieve_known_commit(&target, repo);
-	cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false, "create!"));
-	cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME));
-
-	cl_assert_equal_i(1, git_reflog_entrycount(log));
-	entry = git_reflog_entry_byindex(log, 0);
-	cl_assert_equal_s("create!", git_reflog_entry_message(entry));
-
-	git_reflog_free(log);
-	git_signature_free(sig);
+		git_branch_create(&branch, repo, "inv@{id", target, 0));
 }
 
 void test_refs_branches_create__default_reflog_message(void)
 {
 	git_reflog *log;
+	git_buf buf = GIT_BUF_INIT;
 	const git_reflog_entry *entry;
 	git_signature *sig;
 	git_config *cfg;
@@ -127,13 +108,15 @@ void test_refs_branches_create__default_reflog_message(void)
 	cl_git_pass(git_signature_default(&sig, repo));
 
 	retrieve_known_commit(&target, repo);
-	cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false, NULL));
+	cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false));
 	cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME));
 
 	entry = git_reflog_entry_byindex(log, 0);
-	cl_assert_equal_s("Branch: created", git_reflog_entry_message(entry));
+	cl_git_pass(git_buf_printf(&buf, "Branch: created from %s", git_oid_tostr_s(git_commit_id(target))));
+	cl_assert_equal_s(git_buf_cstr(&buf), git_reflog_entry_message(entry));
 	cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email);
 
+	git_buf_free(&buf);
 	git_reflog_free(log);
 	git_signature_free(sig);
 }
@@ -180,7 +163,7 @@ void test_refs_branches_create__can_create_branch_with_unicode(void)
 	for (i = 0; i < ARRAY_SIZE(names); ++i) {
 		const char *name;
 		cl_git_pass(git_branch_create(
-			&branch, repo, names[i], target, 0, NULL));
+			&branch, repo, names[i], target, 0));
 		cl_git_pass(git_oid_cmp(
 			git_reference_target(branch), git_commit_id(target)));
 
@@ -238,7 +221,7 @@ void test_refs_branches_create__name_vs_namespace(void)
 	retrieve_known_commit(&target, repo);
 
 	for (p=item; p->first; p++) {
-		cl_git_pass(git_branch_create(&branch, repo, p->first, target, 0, NULL));
+		cl_git_pass(git_branch_create(&branch, repo, p->first, target, 0));
 		cl_git_pass(git_oid_cmp(git_reference_target(branch), git_commit_id(target)));
 		cl_git_pass(git_branch_name(&name, branch));
 		cl_assert_equal_s(name, p->first);
@@ -247,7 +230,7 @@ void test_refs_branches_create__name_vs_namespace(void)
 		git_reference_free(branch);
 		branch = NULL;
 
-		cl_git_pass(git_branch_create(&branch, repo, p->second, target, 0, NULL));
+		cl_git_pass(git_branch_create(&branch, repo, p->second, target, 0));
 		git_reference_free(branch);
 		branch = NULL;
 	}
@@ -276,7 +259,7 @@ void test_refs_branches_create__name_vs_namespace_fail(void)
 	retrieve_known_commit(&target, repo);
 
 	for (p=item; p->first; p++) {
-		cl_git_pass(git_branch_create(&branch, repo, p->first, target, 0, NULL));
+		cl_git_pass(git_branch_create(&branch, repo, p->first, target, 0));
 		cl_git_pass(git_oid_cmp(git_reference_target(branch), git_commit_id(target)));
 		cl_git_pass(git_branch_name(&name, branch));
 		cl_assert_equal_s(name, p->first);
@@ -285,7 +268,7 @@ void test_refs_branches_create__name_vs_namespace_fail(void)
 		git_reference_free(branch);
 		branch = NULL;
 
-		cl_git_pass(git_branch_create(&branch, repo, p->first_alternate, target, 0, NULL));
+		cl_git_pass(git_branch_create(&branch, repo, p->first_alternate, target, 0));
 		cl_git_pass(git_oid_cmp(git_reference_target(branch), git_commit_id(target)));
 		cl_git_pass(git_branch_name(&name, branch));
 		cl_assert_equal_s(name, p->first_alternate);
@@ -294,7 +277,7 @@ void test_refs_branches_create__name_vs_namespace_fail(void)
 		git_reference_free(branch);
 		branch = NULL;
 
-		cl_git_fail(git_branch_create(&branch, repo, p->second, target, 0, NULL));
+		cl_git_fail(git_branch_create(&branch, repo, p->second, target, 0));
 		git_reference_free(branch);
 		branch = NULL;
 	}
diff --git a/tests/refs/branches/move.c b/tests/refs/branches/move.c
index b78daa2..c1d1ae3 100644
--- a/tests/refs/branches/move.c
+++ b/tests/refs/branches/move.c
@@ -22,7 +22,7 @@ void test_refs_branches_move__can_move_a_local_branch(void)
 
 	cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
 
-	cl_git_pass(git_branch_move(&new_ref, original_ref, NEW_BRANCH_NAME, 0, NULL));
+	cl_git_pass(git_branch_move(&new_ref, original_ref, NEW_BRANCH_NAME, 0));
 	cl_assert_equal_s(GIT_REFS_HEADS_DIR NEW_BRANCH_NAME, git_reference_name(new_ref));
 
 	git_reference_free(original_ref);
@@ -36,11 +36,11 @@ void test_refs_branches_move__can_move_a_local_branch_to_a_different_namespace(v
 	cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
 
 	/* Downward */
-	cl_git_pass(git_branch_move(&new_ref, original_ref, "somewhere/" NEW_BRANCH_NAME, 0, NULL));
+	cl_git_pass(git_branch_move(&new_ref, original_ref, "somewhere/" NEW_BRANCH_NAME, 0));
 	git_reference_free(original_ref);
 
 	/* Upward */
-	cl_git_pass(git_branch_move(&newer_ref, new_ref, "br2", 0, NULL));
+	cl_git_pass(git_branch_move(&newer_ref, new_ref, "br2", 0));
 	git_reference_free(new_ref);
 
 	git_reference_free(newer_ref);
@@ -53,11 +53,11 @@ void test_refs_branches_move__can_move_a_local_branch_to_a_partially_colliding_n
 	cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
 
 	/* Downward */
-	cl_git_pass(git_branch_move(&new_ref, original_ref, "br2/" NEW_BRANCH_NAME, 0, NULL));
+	cl_git_pass(git_branch_move(&new_ref, original_ref, "br2/" NEW_BRANCH_NAME, 0));
 	git_reference_free(original_ref);
 
 	/* Upward */
-	cl_git_pass(git_branch_move(&newer_ref, new_ref, "br2", 0, NULL));
+	cl_git_pass(git_branch_move(&newer_ref, new_ref, "br2", 0));
 	git_reference_free(new_ref);
 
 	git_reference_free(newer_ref);
@@ -81,7 +81,7 @@ void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_coll
 	cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
 
 	cl_assert_equal_i(GIT_EEXISTS,
-		git_branch_move(&new_ref, original_ref, "master", 0, NULL));
+		git_branch_move(&new_ref, original_ref, "master", 0));
 
 	cl_assert(giterr_last()->message != NULL);
 	cl_git_pass(git_config_get_entry(&ce, config, "branch.master.remote"));
@@ -91,7 +91,7 @@ void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_coll
 
 
 	cl_assert_equal_i(GIT_EEXISTS,
-		git_branch_move(&new_ref, original_ref, "cannot-fetch", 0, NULL));
+		git_branch_move(&new_ref, original_ref, "cannot-fetch", 0));
 
 	cl_assert(giterr_last()->message != NULL);
 	cl_git_pass(git_config_get_entry(&ce, config, "branch.master.remote"));
@@ -103,7 +103,7 @@ void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_coll
 	cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/track-local"));
 
 	cl_assert_equal_i(GIT_EEXISTS,
-		git_branch_move(&new_ref, original_ref, "master", 0, NULL));
+		git_branch_move(&new_ref, original_ref, "master", 0));
 
 	cl_assert(giterr_last()->message != NULL);
 	cl_git_pass(git_config_get_entry(&ce, config, "branch.master.remote"));
@@ -122,7 +122,7 @@ void test_refs_branches_move__moving_a_branch_with_an_invalid_name_returns_EINVA
 
 	cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
 
-	cl_assert_equal_i(GIT_EINVALIDSPEC, git_branch_move(&new_ref, original_ref, "Inv@{id", 0, NULL));
+	cl_assert_equal_i(GIT_EINVALIDSPEC, git_branch_move(&new_ref, original_ref, "Inv@{id", 0));
 
 	git_reference_free(original_ref);
 }
@@ -132,7 +132,7 @@ void test_refs_branches_move__can_not_move_a_non_branch(void)
 	git_reference *tag, *new_ref;
 
 	cl_git_pass(git_reference_lookup(&tag, repo, "refs/tags/e90810b"));
-	cl_git_fail(git_branch_move(&new_ref, tag, NEW_BRANCH_NAME, 0, NULL));
+	cl_git_fail(git_branch_move(&new_ref, tag, NEW_BRANCH_NAME, 0));
 
 	git_reference_free(tag);
 }
@@ -143,7 +143,7 @@ void test_refs_branches_move__can_force_move_over_an_existing_branch(void)
 
 	cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
 
-	cl_git_pass(git_branch_move(&new_ref, original_ref, "master", 1, NULL));
+	cl_git_pass(git_branch_move(&new_ref, original_ref, "master", 1));
 
 	git_reference_free(original_ref);
 	git_reference_free(new_ref);
@@ -161,7 +161,7 @@ void test_refs_branches_move__moving_a_branch_moves_related_configuration_data(v
 	assert_config_entry_existence(repo, "branch.moved.remote", false);
 	assert_config_entry_existence(repo, "branch.moved.merge", false);
 
-	cl_git_pass(git_branch_move(&new_branch, branch, "moved", 0, NULL));
+	cl_git_pass(git_branch_move(&new_branch, branch, "moved", 0));
 	git_reference_free(branch);
 
 	assert_config_entry_existence(repo, "branch.track-local.remote", false);
@@ -178,7 +178,7 @@ void test_refs_branches_move__moving_the_branch_pointed_at_by_HEAD_updates_HEAD(
 	git_reference *new_branch;
 
 	cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master"));
-	cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0, NULL));
+	cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0));
 	git_reference_free(branch);
 	git_reference_free(new_branch);
 
@@ -187,29 +187,6 @@ void test_refs_branches_move__moving_the_branch_pointed_at_by_HEAD_updates_HEAD(
 	git_reference_free(branch);
 }
 
-void test_refs_branches_move__updates_the_reflog(void)
-{
-	git_reference *branch;
-	git_reference *new_branch;
-	git_reflog *log;
-	const git_reflog_entry *entry;
-	git_signature *sig;
-
-	cl_git_pass(git_signature_now(&sig, "me", "foo@example.com"));
-
-	cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master"));
-	cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0, "message"));
-
-	cl_git_pass(git_reflog_read(&log, repo, git_reference_name(new_branch)));
-	entry = git_reflog_entry_byindex(log, 0);
-	cl_assert_equal_s("message", git_reflog_entry_message(entry));
-
-	git_reference_free(branch);
-	git_reference_free(new_branch);
-	git_reflog_free(log);
-	git_signature_free(sig);
-}
-
 void test_refs_branches_move__default_reflog_message(void)
 {
 	git_reference *branch;
@@ -227,7 +204,7 @@ void test_refs_branches_move__default_reflog_message(void)
 	cl_git_pass(git_signature_default(&sig, repo));
 
 	cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master"));
-	cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0, NULL));
+	cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0));
 
 	cl_git_pass(git_reflog_read(&log, repo, git_reference_name(new_branch)));
 	entry = git_reflog_entry_byindex(log, 0);
@@ -247,7 +224,7 @@ void test_refs_branches_move__can_move_with_unicode(void)
 	const char *new_branch_name = "\x41\xCC\x8A\x73\x74\x72\x6F\xCC\x88\x6D";
 
 	cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2"));
-	cl_git_pass(git_branch_move(&new_ref, original_ref, new_branch_name, 0, NULL));
+	cl_git_pass(git_branch_move(&new_ref, original_ref, new_branch_name, 0));
 
 	if (cl_repo_get_bool(repo, "core.precomposeunicode"))
 		cl_assert_equal_s(GIT_REFS_HEADS_DIR "\xC3\x85\x73\x74\x72\xC3\xB6\x6D", git_reference_name(new_ref));
diff --git a/tests/refs/branches/upstream.c b/tests/refs/branches/upstream.c
index f0aef55..f44f563 100644
--- a/tests/refs/branches/upstream.c
+++ b/tests/refs/branches/upstream.c
@@ -91,7 +91,7 @@ static void assert_merge_and_or_remote_key_missing(git_repository *repository, c
 	git_reference *branch;
 
 	cl_assert_equal_i(GIT_OBJ_COMMIT, git_object_type((git_object*)target));
-	cl_git_pass(git_branch_create(&branch, repository, entry_name, (git_commit*)target, 0, NULL));
+	cl_git_pass(git_branch_create(&branch, repository, entry_name, (git_commit*)target, 0));
 
 	cl_assert_equal_i(GIT_ENOTFOUND, git_branch_upstream(&upstream, branch));
 
diff --git a/tests/refs/revparse.c b/tests/refs/revparse.c
index ad468bb..3f89b5f 100644
--- a/tests/refs/revparse.c
+++ b/tests/refs/revparse.c
@@ -634,7 +634,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void)
 	test_object_inrepo("blah-7-gc47800c", "c47800c7266a2be04c571c04d5a6614691ea99bd", repo);
 
 	cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
-	cl_git_pass(git_branch_create(&branch, repo, "blah-7-gc47800c", (git_commit *)target, 0, NULL));
+	cl_git_pass(git_branch_create(&branch, repo, "blah-7-gc47800c", (git_commit *)target, 0));
 
 	git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
 
@@ -672,7 +672,7 @@ void test_refs_revparse__try_to_retrieve_sha_before_branch(void)
 	test_object_inrepo("a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", repo);
 
 	cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
-	cl_git_pass(git_branch_create(&branch, repo, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", (git_commit *)target, 0, NULL));
+	cl_git_pass(git_branch_create(&branch, repo, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", (git_commit *)target, 0));
 
 	git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
 
@@ -708,7 +708,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void)
 	test_object_inrepo("c47800", "c47800c7266a2be04c571c04d5a6614691ea99bd", repo);
 
 	cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
-	cl_git_pass(git_branch_create(&branch, repo, "c47800", (git_commit *)target, 0, NULL));
+	cl_git_pass(git_branch_create(&branch, repo, "c47800", (git_commit *)target, 0));
 
 	git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));