Commit 605da51a2cfd86901b6fa5f9cf71111a63ab4418

Carlos Martín Nieto 2013-09-17T09:50:30

No such thing as an orphan branch Unfortunately git-core uses the term "unborn branch" and "orphan branch" interchangeably. However, "orphan" is only really there for the checkout command, which has the `--orphan` option so it doesn't actually create the branch. Branches never have parents, so the distinction of a branch with no parents is odd to begin with. Crucially, the error messages deal with unborn branches, so let's use that.

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
diff --git a/examples/status.c b/examples/status.c
index 6890984..0d9f55f 100644
--- a/examples/status.c
+++ b/examples/status.c
@@ -71,7 +71,7 @@ static void show_branch(git_repository *repo, int format)
 
 	error = git_repository_head(&head, repo);
 
-	if (error == GIT_EORPHANEDHEAD || error == GIT_ENOTFOUND)
+	if (error == GIT_EUNBORNBRANCH || error == GIT_ENOTFOUND)
 		branch = NULL;
 	else if (!error) {
 		branch = git_reference_name(head);
diff --git a/include/git2/checkout.h b/include/git2/checkout.h
index a086408..aa48069 100644
--- a/include/git2/checkout.h
+++ b/include/git2/checkout.h
@@ -249,7 +249,7 @@ typedef struct git_checkout_opts {
  *
  * @param repo repository to check out (must be non-bare)
  * @param opts specifies checkout options (may be NULL)
- * @return 0 on success, GIT_EORPHANEDHEAD when HEAD points to a non existing
+ * @return 0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing
  * branch, GIT_ERROR otherwise (use giterr_last for information
  * about the error)
  */
diff --git a/include/git2/errors.h b/include/git2/errors.h
index 0f0bddf..dd56644 100644
--- a/include/git2/errors.h
+++ b/include/git2/errors.h
@@ -27,7 +27,7 @@ typedef enum {
 	GIT_EBUFS = -6,
 	GIT_EUSER = -7,
 	GIT_EBAREREPO = -8,
-	GIT_EORPHANEDHEAD = -9,
+	GIT_EUNBORNBRANCH = -9,
 	GIT_EUNMERGED = -10,
 	GIT_ENONFASTFORWARD = -11,
 	GIT_EINVALIDSPEC = -12,
diff --git a/include/git2/repository.h b/include/git2/repository.h
index 807d834..b4d5619 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -297,7 +297,7 @@ GIT_EXTERN(int) git_repository_init_ext(
  * @param out pointer to the reference which will be retrieved
  * @param repo a repository object
  *
- * @return 0 on success, GIT_EORPHANEDHEAD when HEAD points to a non existing
+ * @return 0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing
  * branch, GIT_ENOTFOUND when HEAD is missing; an error code otherwise
  */
 GIT_EXTERN(int) git_repository_head(git_reference **out, git_repository *repo);
@@ -315,16 +315,16 @@ GIT_EXTERN(int) git_repository_head(git_reference **out, git_repository *repo);
 GIT_EXTERN(int) git_repository_head_detached(git_repository *repo);
 
 /**
- * Check if the current branch is an orphan
+ * Check if the current branch is unborn
  *
- * An orphan branch is one named from HEAD but which doesn't exist in
+ * An unborn branch is one named from HEAD but which doesn't exist in
  * the refs namespace, because it doesn't have any commit to point to.
  *
  * @param repo Repo to test
- * @return 1 if the current branch is an orphan, 0 if it's not; error
+ * @return 1 if the current branch is unborn, 0 if it's not; error
  * code if there was an error
  */
-GIT_EXTERN(int) git_repository_head_orphan(git_repository *repo);
+GIT_EXTERN(int) git_repository_head_unborn(git_repository *repo);
 
 /**
  * Check if a repository is empty
@@ -611,7 +611,7 @@ GIT_EXTERN(int) git_repository_set_head_detached(
  * Otherwise, the HEAD will be detached and point to the peeled Commit.
  *
  * @param repo Repository pointer
- * @return 0 on success, GIT_EORPHANEDHEAD when HEAD points to a non existing
+ * @return 0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing
  * branch or an error code
  */
 GIT_EXTERN(int) git_repository_detach_head(
diff --git a/src/branch.c b/src/branch.c
index 7064fa7..3a745c1 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -585,7 +585,7 @@ int git_branch_is_head(
 
 	error = git_repository_head(&head, git_reference_owner(branch));
 
-	if (error == GIT_EORPHANEDHEAD || error == GIT_ENOTFOUND)
+	if (error == GIT_EUNBORNBRANCH || error == GIT_ENOTFOUND)
 		return false;
 
 	if (error < 0)
diff --git a/src/checkout.c b/src/checkout.c
index aae354c..eb92e8f 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1232,7 +1232,7 @@ static int checkout_data_init(
 
 		error = checkout_lookup_head_tree(&data->opts.baseline, repo);
 
-		if (error == GIT_EORPHANEDHEAD) {
+		if (error == GIT_EUNBORNBRANCH) {
 			error = 0;
 			giterr_clear();
 		}
diff --git a/src/clone.c b/src/clone.c
index 9f47e07..ff251be 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -415,7 +415,7 @@ static bool should_checkout(
 	if (opts->checkout_strategy == GIT_CHECKOUT_NONE)
 		return false;
 
-	return !git_repository_head_orphan(repo);
+	return !git_repository_head_unborn(repo);
 }
 
 static void normalize_options(git_clone_options *dst, const git_clone_options *src, git_repository_init_options *initOptions)
diff --git a/src/remote.c b/src/remote.c
index bdc8e0e..bfcb3eb 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -806,7 +806,7 @@ static int remote_head_for_ref(git_remote_head **out, git_refspec *spec, git_vec
 		(!git_reference_is_branch(resolved_ref)) ||
 		(error = git_branch_upstream(&tracking_ref, resolved_ref)) < 0 ||
 		(error = git_refspec_transform_l(&remote_name, spec, git_reference_name(tracking_ref))) < 0) {
-		/* Not an error if HEAD is orphaned or no tracking branch */
+		/* Not an error if HEAD is unborn or no tracking branch */
 		if (error == GIT_ENOTFOUND)
 			error = 0;
 
diff --git a/src/repository.c b/src/repository.c
index eae22ce..eead412 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1451,10 +1451,10 @@ int git_repository_head(git_reference **head_out, git_repository *repo)
 	error = git_reference_lookup_resolved(head_out, repo, git_reference_symbolic_target(head), -1);
 	git_reference_free(head);
 
-	return error == GIT_ENOTFOUND ? GIT_EORPHANEDHEAD : error;
+	return error == GIT_ENOTFOUND ? GIT_EUNBORNBRANCH : error;
 }
 
-int git_repository_head_orphan(git_repository *repo)
+int git_repository_head_unborn(git_repository *repo)
 {
 	git_reference *ref = NULL;
 	int error;
@@ -1462,7 +1462,7 @@ int git_repository_head_orphan(git_repository *repo)
 	error = git_repository_head(&ref, repo);
 	git_reference_free(ref);
 
-	if (error == GIT_EORPHANEDHEAD)
+	if (error == GIT_EUNBORNBRANCH)
 		return 1;
 
 	if (error < 0)
diff --git a/src/stash.c b/src/stash.c
index 48f1914..ab4a685 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -27,7 +27,7 @@ static int retrieve_head(git_reference **out, git_repository *repo)
 {
 	int error = git_repository_head(out, repo);
 
-	if (error == GIT_EORPHANEDHEAD)
+	if (error == GIT_EUNBORNBRANCH)
 		return create_error(error, "You do not have the initial commit yet.");
 
 	return error;
diff --git a/src/status.c b/src/status.c
index 4a0d650..be40b9f 100644
--- a/src/status.c
+++ b/src/status.c
@@ -252,7 +252,7 @@ int git_status_list_new(
 
 	/* if there is no HEAD, that's okay - we'll make an empty iterator */
 	if (((error = git_repository_head_tree(&head, repo)) < 0) &&
-		error != GIT_ENOTFOUND && error != GIT_EORPHANEDHEAD) {
+		error != GIT_ENOTFOUND && error != GIT_EUNBORNBRANCH) {
 		git_index_free(index); /* release index */
 		return error;
 	}
diff --git a/src/submodule.c b/src/submodule.c
index 40bda9a..121383b 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1557,7 +1557,7 @@ static void submodule_get_wd_status(
 	if (ign == GIT_SUBMODULE_IGNORE_NONE)
 		opt.flags |= GIT_DIFF_INCLUDE_UNTRACKED;
 
-	/* if we don't have an orphaned head, check diff with index */
+	/* if we don't have an unborn head, check diff with index */
 	if (git_repository_head_tree(&sm_head, sm_repo) < 0)
 		giterr_clear();
 	else {
diff --git a/tests-clar/checkout/head.c b/tests-clar/checkout/head.c
index 46646f8..74c6fb8 100644
--- a/tests-clar/checkout/head.c
+++ b/tests-clar/checkout/head.c
@@ -16,11 +16,11 @@ void test_checkout_head__cleanup(void)
 	cl_git_sandbox_cleanup();
 }
 
-void test_checkout_head__orphaned_head_returns_GIT_EORPHANEDHEAD(void)
+void test_checkout_head__unborn_head_returns_GIT_EUNBORNBRANCH(void)
 {
-	make_head_orphaned(g_repo, NON_EXISTING_HEAD);
+	make_head_unborn(g_repo, NON_EXISTING_HEAD);
 
-	cl_assert_equal_i(GIT_EORPHANEDHEAD, git_checkout_head(g_repo, NULL));
+	cl_assert_equal_i(GIT_EUNBORNBRANCH, git_checkout_head(g_repo, NULL));
 }
 
 void test_checkout_head__with_index_only_tree(void)
diff --git a/tests-clar/clone/empty.c b/tests-clar/clone/empty.c
index f92fa6c..d9dc24f 100644
--- a/tests-clar/clone/empty.c
+++ b/tests-clar/clone/empty.c
@@ -44,7 +44,7 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
 	g_options.bare = true;
 	cl_git_pass(git_clone(&g_repo_cloned, "./empty_bare.git", "./empty", &g_options));
 
-	/* Although the HEAD is orphaned... */
+	/* Although the HEAD is unborn... */
 	cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&ref, g_repo_cloned, local_name));
 
 	/* ...one can still retrieve the name of the remote tracking reference */
@@ -59,7 +59,7 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
 
 	cl_assert_equal_s(expected_remote_name, buffer);
 
-	/* ...even when the remote HEAD is orphaned as well */
+	/* ...even when the remote HEAD is unborn as well */
 	cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&ref, g_repo_cloned,
 		expected_tracked_branch_name));
 }
diff --git a/tests-clar/clone/nonetwork.c b/tests-clar/clone/nonetwork.c
index 339b1e7..5b9faa6 100644
--- a/tests-clar/clone/nonetwork.c
+++ b/tests-clar/clone/nonetwork.c
@@ -228,7 +228,7 @@ void test_clone_nonetwork__can_checkout_given_branch(void)
 	g_options.checkout_branch = "test";
 	cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
 
-	cl_assert_equal_i(0, git_repository_head_orphan(g_repo));
+	cl_assert_equal_i(0, git_repository_head_unborn(g_repo));
 
 	cl_git_pass(git_repository_head(&g_ref, g_repo));
 	cl_assert_equal_s(git_reference_name(g_ref), "refs/heads/test");
diff --git a/tests-clar/online/clone.c b/tests-clar/online/clone.c
index bc4285a..dc5aa41 100644
--- a/tests-clar/online/clone.c
+++ b/tests-clar/online/clone.c
@@ -69,7 +69,7 @@ void test_online_clone__empty_repository(void)
 	cl_git_pass(git_clone(&g_repo, LIVE_EMPTYREPO_URL, "./foo", &g_options));
 
 	cl_assert_equal_i(true, git_repository_is_empty(g_repo));
-	cl_assert_equal_i(true, git_repository_head_orphan(g_repo));
+	cl_assert_equal_i(true, git_repository_head_unborn(g_repo));
 
 	cl_git_pass(git_reference_lookup(&head, g_repo, GIT_HEAD_FILE));
 	cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
diff --git a/tests-clar/refs/branches/delete.c b/tests-clar/refs/branches/delete.c
index 7af5a3e..de90cb7 100644
--- a/tests-clar/refs/branches/delete.c
+++ b/tests-clar/refs/branches/delete.c
@@ -57,11 +57,11 @@ void test_refs_branches_delete__can_delete_a_branch_even_if_HEAD_is_missing(void
 	git_reference_free(branch);
 }
 
-void test_refs_branches_delete__can_delete_a_branch_when_HEAD_is_orphaned(void)
+void test_refs_branches_delete__can_delete_a_branch_when_HEAD_is_unborn(void)
 {
 	git_reference *branch;
 
-	make_head_orphaned(repo, NON_EXISTING_HEAD);
+	make_head_unborn(repo, NON_EXISTING_HEAD);
 
 	cl_git_pass(git_branch_lookup(&branch, repo, "br2", GIT_BRANCH_LOCAL));
 	cl_git_pass(git_branch_delete(branch));
diff --git a/tests-clar/refs/branches/ishead.c b/tests-clar/refs/branches/ishead.c
index dfcf1b5..b1ad09c 100644
--- a/tests-clar/refs/branches/ishead.c
+++ b/tests-clar/refs/branches/ishead.c
@@ -26,13 +26,13 @@ void test_refs_branches_ishead__can_tell_if_a_branch_is_pointed_at_by_HEAD(void)
 	cl_assert_equal_i(true, git_branch_is_head(branch));
 }
 
-void test_refs_branches_ishead__can_properly_handle_orphaned_HEAD(void)
+void test_refs_branches_ishead__can_properly_handle_unborn_HEAD(void)
 {
 	git_repository_free(repo);
 
 	repo = cl_git_sandbox_init("testrepo.git");
 
-	make_head_orphaned(repo, NON_EXISTING_HEAD);
+	make_head_unborn(repo, NON_EXISTING_HEAD);
 
 	cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master"));
 
diff --git a/tests-clar/repo/head.c b/tests-clar/repo/head.c
index a9f5cfc..5a55984 100644
--- a/tests-clar/repo/head.c
+++ b/tests-clar/repo/head.c
@@ -32,20 +32,20 @@ void test_repo_head__head_detached(void)
 	cl_assert_equal_i(false, git_repository_head_detached(repo));
 }
 
-void test_repo_head__head_orphan(void)
+void test_repo_head__unborn_head(void)
 {
 	git_reference *ref;
 
 	cl_git_pass(git_repository_head_detached(repo));
 
-	make_head_orphaned(repo, NON_EXISTING_HEAD);
+	make_head_unborn(repo, NON_EXISTING_HEAD);
 
-	cl_assert(git_repository_head_orphan(repo) == 1);
+	cl_assert(git_repository_head_unborn(repo) == 1);
 
 
 	/* take the repo back to it's original state */
 	cl_git_pass(git_reference_symbolic_create(&ref, repo, "HEAD", "refs/heads/master", 1));
-	cl_assert(git_repository_head_orphan(repo) == 0);
+	cl_assert(git_repository_head_unborn(repo) == 0);
 
 	git_reference_free(ref);
 }
@@ -58,7 +58,7 @@ void test_repo_head__set_head_Attaches_HEAD_to_un_unborn_branch_when_the_branch_
 
 	cl_assert_equal_i(false, git_repository_head_detached(repo));
 
-	cl_assert_equal_i(GIT_EORPHANEDHEAD, git_repository_head(&head, repo));
+	cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_head(&head, repo));
 }
 
 void test_repo_head__set_head_Returns_ENOTFOUND_when_the_reference_doesnt_exist(void)
@@ -163,20 +163,20 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void
 	git_reference_free(head);
 }
 
-void test_repo_head__detaching_an_orphaned_head_returns_GIT_EORPHANEDHEAD(void)
+void test_repo_head__detaching_an_unborn_branch_returns_GIT_EUNBORNBRANCH(void)
 {
-	make_head_orphaned(repo, NON_EXISTING_HEAD);
+	make_head_unborn(repo, NON_EXISTING_HEAD);
 
-	cl_assert_equal_i(GIT_EORPHANEDHEAD, git_repository_detach_head(repo));
+	cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_detach_head(repo));
 }
 
-void test_repo_head__retrieving_an_orphaned_head_returns_GIT_EORPHANEDHEAD(void)
+void test_repo_head__retrieving_an_unborn_branch_returns_GIT_EUNBORNBRANCH(void)
 {
 	git_reference *head;
 
-	make_head_orphaned(repo, NON_EXISTING_HEAD);
+	make_head_unborn(repo, NON_EXISTING_HEAD);
 
-	cl_assert_equal_i(GIT_EORPHANEDHEAD, git_repository_head(&head, repo));
+	cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_head(&head, repo));
 }
 
 void test_repo_head__retrieving_a_missing_head_returns_GIT_ENOTFOUND(void)
@@ -188,9 +188,9 @@ void test_repo_head__retrieving_a_missing_head_returns_GIT_ENOTFOUND(void)
 	cl_assert_equal_i(GIT_ENOTFOUND, git_repository_head(&head, repo));
 }
 
-void test_repo_head__can_tell_if_an_orphaned_head_is_detached(void)
+void test_repo_head__can_tell_if_an_unborn_head_is_detached(void)
 {
-	make_head_orphaned(repo, NON_EXISTING_HEAD);
+	make_head_unborn(repo, NON_EXISTING_HEAD);
 
 	cl_assert_equal_i(false, git_repository_head_detached(repo));
 }
diff --git a/tests-clar/repo/headtree.c b/tests-clar/repo/headtree.c
index 0e7fe93..e899ac3 100644
--- a/tests-clar/repo/headtree.c
+++ b/tests-clar/repo/headtree.c
@@ -36,13 +36,13 @@ void test_repo_headtree__can_retrieve_the_root_tree_from_a_non_detached_head(voi
 	cl_assert(git_oid_streq(git_tree_id(tree), "az"));
 }
 
-void test_repo_headtree__when_head_is_orphaned_returns_EORPHANEDHEAD(void)
+void test_repo_headtree__when_head_is_unborn_returns_EUNBORNBRANCH(void)
 {
-	make_head_orphaned(repo, NON_EXISTING_HEAD);
+	make_head_unborn(repo, NON_EXISTING_HEAD);
 
-	cl_assert_equal_i(true, git_repository_head_orphan(repo));
+	cl_assert_equal_i(true, git_repository_head_unborn(repo));
 
-	cl_assert_equal_i(GIT_EORPHANEDHEAD, git_repository_head_tree(&tree, repo));
+	cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_head_tree(&tree, repo));
 }
 
 void test_repo_headtree__when_head_is_missing_returns_ENOTFOUND(void)
diff --git a/tests-clar/repo/repo_helpers.c b/tests-clar/repo/repo_helpers.c
index 74902e4..3d477ff 100644
--- a/tests-clar/repo/repo_helpers.c
+++ b/tests-clar/repo/repo_helpers.c
@@ -3,7 +3,7 @@
 #include "repo_helpers.h"
 #include "posix.h"
 
-void make_head_orphaned(git_repository* repo, const char *target)
+void make_head_unborn(git_repository* repo, const char *target)
 {
 	git_reference *head;
 
diff --git a/tests-clar/repo/repo_helpers.h b/tests-clar/repo/repo_helpers.h
index 09b5cac..6783d57 100644
--- a/tests-clar/repo/repo_helpers.h
+++ b/tests-clar/repo/repo_helpers.h
@@ -2,5 +2,5 @@
 
 #define NON_EXISTING_HEAD "refs/heads/hide/and/seek"
 
-extern void make_head_orphaned(git_repository* repo, const char *target);
+extern void make_head_unborn(git_repository* repo, const char *target);
 extern void delete_head(git_repository* repo);
diff --git a/tests-clar/reset/soft.c b/tests-clar/reset/soft.c
index 884697c..bd6fcc2 100644
--- a/tests-clar/reset/soft.c
+++ b/tests-clar/reset/soft.c
@@ -95,19 +95,19 @@ void test_reset_soft__cannot_reset_to_a_tag_not_pointing_at_a_commit(void)
 	cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT));
 }
 
-void test_reset_soft__resetting_against_an_orphaned_head_repo_makes_the_head_no_longer_orphaned(void)
+void test_reset_soft__resetting_against_an_unborn_head_repo_makes_the_head_no_longer_unborn(void)
 {
 	git_reference *head;
 
 	retrieve_target_from_oid(&target, repo, KNOWN_COMMIT_IN_BARE_REPO);
 
-	make_head_orphaned(repo, NON_EXISTING_HEAD);
+	make_head_unborn(repo, NON_EXISTING_HEAD);
 
-	cl_assert_equal_i(true, git_repository_head_orphan(repo));
+	cl_assert_equal_i(true, git_repository_head_unborn(repo));
 
 	cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT));
 
-	cl_assert_equal_i(false, git_repository_head_orphan(repo));
+	cl_assert_equal_i(false, git_repository_head_unborn(repo));
 
 	cl_git_pass(git_reference_lookup(&head, repo, NON_EXISTING_HEAD));
 	cl_assert_equal_i(0, git_oid_streq(git_reference_target(head), KNOWN_COMMIT_IN_BARE_REPO));
diff --git a/tests-clar/stash/save.c b/tests-clar/stash/save.c
index eae116a..bb35a3d 100644
--- a/tests-clar/stash/save.c
+++ b/tests-clar/stash/save.c
@@ -194,7 +194,7 @@ void test_stash_save__cannot_stash_against_an_unborn_branch(void)
 
 	cl_git_pass(git_reference_symbolic_create(&head, repo, "HEAD", "refs/heads/unborn", 1));
 
-	cl_assert_equal_i(GIT_EORPHANEDHEAD,
+	cl_assert_equal_i(GIT_EUNBORNBRANCH,
 		git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
 
 	git_reference_free(head);
diff --git a/tests-clar/submodule/lookup.c b/tests-clar/submodule/lookup.c
index 013bbdf..b626cdf 100644
--- a/tests-clar/submodule/lookup.c
+++ b/tests-clar/submodule/lookup.c
@@ -114,15 +114,15 @@ void test_submodule_lookup__foreach(void)
 	cl_assert_equal_i(8, data.count);
 }
 
-void test_submodule_lookup__lookup_even_with_orphaned_head(void)
+void test_submodule_lookup__lookup_even_with_unborn_head(void)
 {
-	git_reference *orphan;
+	git_reference *head;
 	git_submodule *sm;
 
-	/* orphan the head */
+	/* put us on an unborn branch */
 	cl_git_pass(git_reference_symbolic_create(
-		&orphan, g_repo, "HEAD", "refs/heads/garbage", 1));
-	git_reference_free(orphan);
+		&head, g_repo, "HEAD", "refs/heads/garbage", 1));
+	git_reference_free(head);
 
 	/* lookup existing */
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_unchanged"));