Commit ed8cfbf04181d6fc229582a09c5c7657a53cd2e3

Edward Thomson 2019-01-17T00:32:31

references: use new names in internal usage Update internal usage to use the `git_reference` names for constants.

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
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
diff --git a/examples/for-each-ref.c b/examples/for-each-ref.c
index a8ceaaf..25d0294 100644
--- a/examples/for-each-ref.c
+++ b/examples/for-each-ref.c
@@ -10,7 +10,7 @@ static int show_ref(git_reference *ref, void *data)
         const git_oid *oid;
         git_object *obj;
 
-        if (git_reference_type(ref) == GIT_REF_SYMBOLIC)
+        if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC)
                 check_lg2(git_reference_resolve(&resolved, ref),
                           "Unable to resolve symbolic reference",
                           git_reference_name(ref));
diff --git a/examples/general.c b/examples/general.c
index 15b415a..fbd7bba 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -692,12 +692,12 @@ static void reference_listing(git_repository *repo)
 		git_reference_lookup(&ref, repo, refname);
 
 		switch (git_reference_type(ref)) {
-			case GIT_REF_OID:
+			case GIT_REFERENCE_DIRECT:
 				git_oid_fmt(oid_hex, git_reference_target(ref));
 				printf("%s [%s]\n", refname, oid_hex);
 				break;
 
-			case GIT_REF_SYMBOLIC:
+			case GIT_REFERENCE_SYMBOLIC:
 				printf("%s => %s\n", refname, git_reference_symbolic_target(ref));
 				break;
 			default:
diff --git a/src/branch.c b/src/branch.c
index e72d470..c5d9152 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -141,7 +141,7 @@ static int branch_equals(git_repository *repo, const char *path, void *payload)
 	int equal = 0;
 
 	if (git_reference__read_head(&head, repo, path) < 0 ||
-		git_reference_type(head) != GIT_REF_SYMBOLIC)
+		git_reference_type(head) != GIT_REFERENCE_SYMBOLIC)
 		goto done;
 
 	equal = !git__strcmp(head->target.symbolic, branch->name);
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 1eebf51..361451b 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -811,12 +811,12 @@ static int loose_commit(git_filebuf *file, const git_reference *ref)
 {
 	assert(file && ref);
 
-	if (ref->type == GIT_REF_OID) {
+	if (ref->type == GIT_REFERENCE_DIRECT) {
 		char oid[GIT_OID_HEXSZ + 1];
 		git_oid_nfmt(oid, sizeof(oid), &ref->target.oid);
 
 		git_filebuf_printf(file, "%s\n", oid);
-	} else if (ref->type == GIT_REF_SYMBOLIC) {
+	} else if (ref->type == GIT_REFERENCE_SYMBOLIC) {
 		git_filebuf_printf(file, GIT_SYMREF "%s\n", ref->target.symbolic);
 	} else {
 		assert(0); /* don't let this happen */
@@ -1142,19 +1142,19 @@ static int cmp_old_ref(int *cmp, git_refdb_backend *backend, const char *name,
 		goto out;
 
 	/* If the types don't match, there's no way the values do */
-	if (old_id && old_ref->type != GIT_REF_OID) {
+	if (old_id && old_ref->type != GIT_REFERENCE_DIRECT) {
 		*cmp = -1;
 		goto out;
 	}
-	if (old_target && old_ref->type != GIT_REF_SYMBOLIC) {
+	if (old_target && old_ref->type != GIT_REFERENCE_SYMBOLIC) {
 		*cmp = 1;
 		goto out;
 	}
 
-	if (old_id && old_ref->type == GIT_REF_OID)
+	if (old_id && old_ref->type == GIT_REFERENCE_DIRECT)
 		*cmp = git_oid_cmp(old_id, &old_ref->target.oid);
 
-	if (old_target && old_ref->type == GIT_REF_SYMBOLIC)
+	if (old_target && old_ref->type == GIT_REFERENCE_SYMBOLIC)
 		*cmp = git__strcmp(old_target, old_ref->target.symbolic);
 
 out:
@@ -1184,7 +1184,7 @@ static int maybe_append_head(refdb_fs_backend *backend, const git_reference *ref
 	git_reference *tmp = NULL, *head = NULL, *peeled = NULL;
 	const char *name;
 
-	if (ref->type == GIT_REF_SYMBOLIC)
+	if (ref->type == GIT_REFERENCE_SYMBOLIC)
 		return 0;
 
 	/* if we can't resolve, we use {0}*40 as old id */
@@ -1194,14 +1194,14 @@ static int maybe_append_head(refdb_fs_backend *backend, const git_reference *ref
 	if ((error = git_reference_lookup(&head, backend->repo, GIT_HEAD_FILE)) < 0)
 		return error;
 
-	if (git_reference_type(head) == GIT_REF_OID)
+	if (git_reference_type(head) == GIT_REFERENCE_DIRECT)
 		goto cleanup;
 
 	if ((error = git_reference_lookup(&tmp, backend->repo, GIT_HEAD_FILE)) < 0)
 		goto cleanup;
 
 	/* Go down the symref chain until we find the branch */
-	while (git_reference_type(tmp) == GIT_REF_SYMBOLIC) {
+	while (git_reference_type(tmp) == GIT_REFERENCE_SYMBOLIC) {
 		error = git_reference_lookup(&peeled, backend->repo, git_reference_symbolic_target(tmp));
 		if (error < 0)
 			break;
@@ -1279,7 +1279,7 @@ static int refdb_fs_backend__write_tail(
 		goto on_error;
 	}
 
-	if (ref->type == GIT_REF_SYMBOLIC)
+	if (ref->type == GIT_REFERENCE_SYMBOLIC)
 		new_target = ref->target.symbolic;
 	else
 		new_id = &ref->target.oid;
@@ -1886,7 +1886,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
 	git_buf buf = GIT_BUF_INIT, path = GIT_BUF_INIT;
 	git_repository *repo = backend->repo;
 
-	is_symbolic = ref->type == GIT_REF_SYMBOLIC;
+	is_symbolic = ref->type == GIT_REFERENCE_SYMBOLIC;
 
 	/* "normal" symbolic updates do not write */
 	if (is_symbolic &&
@@ -1979,7 +1979,7 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
 	repo = backend->repo;
 
 	if ((error = git_reference__normalize_name(
-		&normalized, new_name, GIT_REF_FORMAT_ALLOW_ONELEVEL)) < 0)
+		&normalized, new_name, GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL)) < 0)
 			return error;
 
 	if (git_buf_joinpath(&temp_path, repo->gitdir, GIT_REFLOG_DIR) < 0)
diff --git a/src/refs.c b/src/refs.c
index 85599da..6e919b2 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -59,7 +59,7 @@ git_reference *git_reference__alloc_symbolic(
 	if (!ref)
 		return NULL;
 
-	ref->type = GIT_REF_SYMBOLIC;
+	ref->type = GIT_REFERENCE_SYMBOLIC;
 
 	if ((ref->target.symbolic = git__strdup(target)) == NULL) {
 		git__free(ref);
@@ -82,7 +82,7 @@ git_reference *git_reference__alloc(
 	if (!ref)
 		return NULL;
 
-	ref->type = GIT_REF_OID;
+	ref->type = GIT_REFERENCE_DIRECT;
 	git_oid_cpy(&ref->target.oid, oid);
 
 	if (peel != NULL)
@@ -108,7 +108,7 @@ git_reference *git_reference__set_name(
 
 int git_reference_dup(git_reference **dest, git_reference *source)
 {
-	if (source->type == GIT_REF_SYMBOLIC)
+	if (source->type == GIT_REFERENCE_SYMBOLIC)
 		*dest = git_reference__alloc_symbolic(source->name, source->target.symbolic);
 	else
 		*dest = git_reference__alloc(source->name, &source->target.oid, &source->peel);
@@ -126,7 +126,7 @@ void git_reference_free(git_reference *reference)
 	if (reference == NULL)
 		return;
 
-	if (reference->type == GIT_REF_SYMBOLIC)
+	if (reference->type == GIT_REFERENCE_SYMBOLIC)
 		git__free(reference->target.symbolic);
 
 	if (reference->db)
@@ -140,7 +140,7 @@ int git_reference_delete(git_reference *ref)
 	const git_oid *old_id = NULL;
 	const char *old_target = NULL;
 
-	if (ref->type == GIT_REF_OID)
+	if (ref->type == GIT_REFERENCE_DIRECT)
 		old_id = &ref->target.oid;
 	else
 		old_target = ref->target.symbolic;
@@ -186,14 +186,14 @@ static int reference_normalize_for_repo(
 	bool validate)
 {
 	int precompose;
-	unsigned int flags = GIT_REF_FORMAT_ALLOW_ONELEVEL;
+	unsigned int flags = GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL;
 
 	if (!git_repository__cvar(&precompose, repo, GIT_CVAR_PRECOMPOSE) &&
 		precompose)
-		flags |= GIT_REF_FORMAT__PRECOMPOSE_UNICODE;
+		flags |= GIT_REFERENCE_FORMAT__PRECOMPOSE_UNICODE;
 
 	if (!validate)
-		flags |= GIT_REF_FORMAT__VALIDATION_DISABLE;
+		flags |= GIT_REFERENCE_FORMAT__VALIDATION_DISABLE;
 
 	return git_reference_normalize_name(out, GIT_REFNAME_MAX, name, flags);
 }
@@ -205,7 +205,7 @@ int git_reference_lookup_resolved(
 	int max_nesting)
 {
 	git_refname_t scan_name;
-	git_ref_t scan_type;
+	git_reference_t scan_type;
 	int error = 0, nesting;
 	git_reference *ref = NULL;
 	git_refdb *refdb;
@@ -219,7 +219,7 @@ int git_reference_lookup_resolved(
 	else if (max_nesting < 0)
 		max_nesting = DEFAULT_NESTING_LEVEL;
 
-	scan_type = GIT_REF_SYMBOLIC;
+	scan_type = GIT_REFERENCE_SYMBOLIC;
 
 	if ((error = reference_normalize_for_repo(scan_name, repo, name, true)) < 0)
 		return error;
@@ -228,7 +228,7 @@ int git_reference_lookup_resolved(
 		return error;
 
 	for (nesting = max_nesting;
-		 nesting >= 0 && scan_type == GIT_REF_SYMBOLIC;
+		 nesting >= 0 && scan_type == GIT_REFERENCE_SYMBOLIC;
 		 nesting--)
 	{
 		if (nesting != max_nesting) {
@@ -242,7 +242,7 @@ int git_reference_lookup_resolved(
 		scan_type = ref->type;
 	}
 
-	if (scan_type != GIT_REF_OID && max_nesting != 0) {
+	if (scan_type != GIT_REFERENCE_DIRECT && max_nesting != 0) {
 		giterr_set(GITERR_REFERENCE,
 			"cannot resolve reference (>%u levels deep)", max_nesting);
 		git_reference_free(ref);
@@ -354,7 +354,7 @@ cleanup:
 /**
  * Getters
  */
-git_ref_t git_reference_type(const git_reference *ref)
+git_reference_t git_reference_type(const git_reference *ref)
 {
 	assert(ref);
 	return ref->type;
@@ -376,7 +376,7 @@ const git_oid *git_reference_target(const git_reference *ref)
 {
 	assert(ref);
 
-	if (ref->type != GIT_REF_OID)
+	if (ref->type != GIT_REFERENCE_DIRECT)
 		return NULL;
 
 	return &ref->target.oid;
@@ -386,7 +386,7 @@ const git_oid *git_reference_target_peel(const git_reference *ref)
 {
 	assert(ref);
 
-	if (ref->type != GIT_REF_OID || git_oid_iszero(&ref->peel))
+	if (ref->type != GIT_REFERENCE_DIRECT || git_oid_iszero(&ref->peel))
 		return NULL;
 
 	return &ref->peel;
@@ -396,7 +396,7 @@ const char *git_reference_symbolic_target(const git_reference *ref)
 {
 	assert(ref);
 
-	if (ref->type != GIT_REF_SYMBOLIC)
+	if (ref->type != GIT_REFERENCE_SYMBOLIC)
 		return NULL;
 
 	return ref->target.symbolic;
@@ -566,7 +566,7 @@ int git_reference_symbolic_create(
 
 static int ensure_is_an_updatable_direct_reference(git_reference *ref)
 {
-	if (ref->type == GIT_REF_OID)
+	if (ref->type == GIT_REFERENCE_DIRECT)
 		return 0;
 
 	giterr_set(GITERR_REFERENCE, "cannot set OID on symbolic reference");
@@ -594,7 +594,7 @@ int git_reference_set_target(
 
 static int ensure_is_an_updatable_symbolic_reference(git_reference *ref)
 {
-	if (ref->type == GIT_REF_SYMBOLIC)
+	if (ref->type == GIT_REFERENCE_SYMBOLIC)
 		return 0;
 
 	giterr_set(GITERR_REFERENCE, "cannot set symbolic target on a direct reference");
@@ -640,7 +640,7 @@ static int update_wt_heads(git_repository *repo, const char *path, void *payload
 		goto out;
 	}
 
-	if (git_reference_type(head) != GIT_REF_SYMBOLIC ||
+	if (git_reference_type(head) != GIT_REFERENCE_SYMBOLIC ||
 	    git__strcmp(head->target.symbolic, data->old_name) != 0) {
 		error = 0;
 		goto out;
@@ -723,10 +723,10 @@ int git_reference_rename(
 int git_reference_resolve(git_reference **ref_out, const git_reference *ref)
 {
 	switch (git_reference_type(ref)) {
-	case GIT_REF_OID:
+	case GIT_REFERENCE_DIRECT:
 		return git_reference_lookup(ref_out, ref->db->repo, ref->name);
 
-	case GIT_REF_SYMBOLIC:
+	case GIT_REFERENCE_SYMBOLIC:
 		return git_reference_lookup_resolved(ref_out, ref->db->repo, ref->target.symbolic, -1);
 
 	default:
@@ -970,7 +970,7 @@ int git_reference__normalize_name(
 	int segment_len, segments_count = 0, error = GIT_EINVALIDSPEC;
 	unsigned int process_flags;
 	bool normalize = (buf != NULL);
-	bool validate = (flags & GIT_REF_FORMAT__VALIDATION_DISABLE) == 0;
+	bool validate = (flags & GIT_REFERENCE_FORMAT__VALIDATION_DISABLE) == 0;
 
 #ifdef GIT_USE_ICONV
 	git_path_iconv_t ic = GIT_PATH_ICONV_INIT;
@@ -988,7 +988,7 @@ int git_reference__normalize_name(
 		git_buf_clear(buf);
 
 #ifdef GIT_USE_ICONV
-	if ((flags & GIT_REF_FORMAT__PRECOMPOSE_UNICODE) != 0) {
+	if ((flags & GIT_REFERENCE_FORMAT__PRECOMPOSE_UNICODE) != 0) {
 		size_t namelen = strlen(current);
 		if ((error = git_path_iconv_init_precompose(&ic)) < 0 ||
 			(error = git_path_iconv(&ic, &current, &namelen)) < 0)
@@ -1007,11 +1007,11 @@ int git_reference__normalize_name(
 	while (true) {
 		segment_len = ensure_segment_validity(current);
 		if (segment_len < 0) {
-			if ((process_flags & GIT_REF_FORMAT_REFSPEC_PATTERN) &&
+			if ((process_flags & GIT_REFERENCE_FORMAT_REFSPEC_PATTERN) &&
 					current[0] == '*' &&
 					(current[1] == '\0' || current[1] == '/')) {
 				/* Accept one wildcard as a full refname component. */
-				process_flags &= ~GIT_REF_FORMAT_REFSPEC_PATTERN;
+				process_flags &= ~GIT_REFERENCE_FORMAT_REFSPEC_PATTERN;
 				segment_len = 1;
 			} else
 				goto cleanup;
@@ -1056,13 +1056,13 @@ int git_reference__normalize_name(
 	if (current[segment_len - 1] == '/')
 		goto cleanup;
 
-	if ((segments_count == 1 ) && !(flags & GIT_REF_FORMAT_ALLOW_ONELEVEL))
+	if ((segments_count == 1 ) && !(flags & GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL))
 		goto cleanup;
 
 	if ((segments_count == 1 ) &&
-	    !(flags & GIT_REF_FORMAT_REFSPEC_SHORTHAND) &&
+	    !(flags & GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND) &&
 		!(is_all_caps_and_underscore(name, (size_t)segment_len) ||
-			((flags & GIT_REF_FORMAT_REFSPEC_PATTERN) && !strcmp("*", name))))
+			((flags & GIT_REFERENCE_FORMAT_REFSPEC_PATTERN) && !strcmp("*", name))))
 			goto cleanup;
 
 	if ((segments_count > 1)
@@ -1116,13 +1116,13 @@ cleanup:
 	return error;
 }
 
-#define GIT_REF_TYPEMASK (GIT_REF_OID | GIT_REF_SYMBOLIC)
+#define GIT_REFERENCE_TYPEMASK (GIT_REFERENCE_DIRECT | GIT_REFERENCE_SYMBOLIC)
 
 int git_reference_cmp(
 	const git_reference *ref1,
 	const git_reference *ref2)
 {
-	git_ref_t type1, type2;
+	git_reference_t type1, type2;
 	assert(ref1 && ref2);
 
 	type1 = git_reference_type(ref1);
@@ -1130,9 +1130,9 @@ int git_reference_cmp(
 
 	/* let's put symbolic refs before OIDs */
 	if (type1 != type2)
-		return (type1 == GIT_REF_SYMBOLIC) ? -1 : 1;
+		return (type1 == GIT_REFERENCE_SYMBOLIC) ? -1 : 1;
 
-	if (type1 == GIT_REF_SYMBOLIC)
+	if (type1 == GIT_REFERENCE_SYMBOLIC)
 		return strcmp(ref1->target.symbolic, ref2->target.symbolic);
 
 	return git_oid__cmp(&ref1->target.oid, &ref2->target.oid);
@@ -1158,7 +1158,7 @@ static int get_terminal(git_reference **out, git_repository *repo, const char *r
 		return error;
 	}
 
-	if (git_reference_type(ref) == GIT_REF_OID) {
+	if (git_reference_type(ref) == GIT_REFERENCE_DIRECT) {
 		*out = ref;
 		error = 0;
 	} else {
@@ -1197,7 +1197,7 @@ int git_reference__update_terminal(
 
 	/* found a dangling symref */
 	if (error == GIT_ENOTFOUND && ref) {
-		assert(git_reference_type(ref) == GIT_REF_SYMBOLIC);
+		assert(git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC);
 		giterr_clear();
 		error = reference__create(&ref2, repo, ref->target.symbolic, oid, NULL, 0, to_use,
 					  log_message, NULL, NULL);
@@ -1206,7 +1206,7 @@ int git_reference__update_terminal(
 		error = reference__create(&ref2, repo, ref_name, oid, NULL, 0, to_use,
 					  log_message, NULL, NULL);
 	}  else if (error == 0) {
-		assert(git_reference_type(ref) == GIT_REF_OID);
+		assert(git_reference_type(ref) == GIT_REFERENCE_DIRECT);
 		error = reference__create(&ref2, repo, ref->name, oid, NULL, 1, to_use,
 					  log_message, &ref->target.oid, NULL);
 	}
@@ -1359,7 +1359,7 @@ int git_reference_peel(
 
 	assert(ref);
 
-	if (ref->type == GIT_REF_OID) {
+	if (ref->type == GIT_REFERENCE_DIRECT) {
 		resolved = ref;
 	} else {
 		if ((error = git_reference_resolve(&allocated, ref)) < 0)
@@ -1411,7 +1411,7 @@ int git_reference__is_valid_name(const char *refname, unsigned int flags)
 
 int git_reference_is_valid_name(const char *refname)
 {
-	return git_reference__is_valid_name(refname, GIT_REF_FORMAT_ALLOW_ONELEVEL);
+	return git_reference__is_valid_name(refname, GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL);
 }
 
 const char *git_reference__shorthand(const char *name)
@@ -1440,7 +1440,7 @@ int git_reference__is_unborn_head(bool *unborn, const git_reference *ref, git_re
 	git_reference *tmp_ref;
 	assert(unborn && ref && repo);
 
-	if (ref->type == GIT_REF_OID) {
+	if (ref->type == GIT_REFERENCE_DIRECT) {
 		*unborn = 0;
 		return 0;
 	}
diff --git a/src/refs.h b/src/refs.h
index f4f9342..46df95e 100644
--- a/src/refs.h
+++ b/src/refs.h
@@ -55,8 +55,8 @@ extern bool git_reference__enable_symbolic_ref_target_validation;
 #define GIT_STASH_FILE "stash"
 #define GIT_REFS_STASH_FILE GIT_REFS_DIR GIT_STASH_FILE
 
-#define GIT_REF_FORMAT__PRECOMPOSE_UNICODE	(1u << 16)
-#define GIT_REF_FORMAT__VALIDATION_DISABLE	(1u << 15)
+#define GIT_REFERENCE_FORMAT__PRECOMPOSE_UNICODE	(1u << 16)
+#define GIT_REFERENCE_FORMAT__VALIDATION_DISABLE	(1u << 15)
 
 #define GIT_REFNAME_MAX 1024
 
@@ -64,7 +64,7 @@ typedef char git_refname_t[GIT_REFNAME_MAX];
 
 struct git_reference {
 	git_refdb *db;
-	git_ref_t type;
+	git_reference_t type;
 
 	union {
 		git_oid oid;
diff --git a/src/refspec.c b/src/refspec.c
index f429776..7e68071 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -69,8 +69,9 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
 
 	refspec->pattern = is_glob;
 	refspec->src = git__strndup(lhs, llen);
-	flags = GIT_REF_FORMAT_ALLOW_ONELEVEL | GIT_REF_FORMAT_REFSPEC_SHORTHAND
-		| (is_glob ? GIT_REF_FORMAT_REFSPEC_PATTERN : 0);
+	flags = GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL |
+		GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND |
+		(is_glob ? GIT_REFERENCE_FORMAT_REFSPEC_PATTERN : 0);
 
 	if (is_fetch) {
 		/*
diff --git a/src/remote.c b/src/remote.c
index 393068b..2cfb921 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -1126,7 +1126,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
 	error = git_reference_resolve(&resolved_ref, ref);
 
 	/* If we're in an unborn branch, let's pretend nothing happened */
-	if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REF_SYMBOLIC) {
+	if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
 		ref_name = git_reference_symbolic_target(ref);
 		error = 0;
 	} else {
@@ -1329,7 +1329,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
 		if (error < 0)
 			goto cleanup;
 
-		if (git_reference_type(ref) == GIT_REF_SYMBOLIC) {
+		if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
 			git_reference_free(ref);
 			continue;
 		}
@@ -1450,7 +1450,7 @@ static int update_tips_for_spec(
 			continue;
 
 		/* In autotag mode, don't overwrite any locally-existing tags */
-		error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag, 
+		error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag,
 				log_message);
 
 		if (error == GIT_EEXISTS)
@@ -1919,7 +1919,7 @@ static int rename_one_remote_reference(
 					  git_buf_cstr(&log_message))) < 0)
 		goto cleanup;
 
-	if (git_reference_type(ref) != GIT_REF_SYMBOLIC)
+	if (git_reference_type(ref) != GIT_REFERENCE_SYMBOLIC)
 		goto cleanup;
 
 	/* Handle refs like origin/HEAD -> origin/master */
diff --git a/src/repository.c b/src/repository.c
index c6f7c20..21e4435 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -2119,7 +2119,7 @@ int git_repository_head_detached(git_repository *repo)
 	if (git_reference_lookup(&ref, repo, GIT_HEAD_FILE) < 0)
 		return -1;
 
-	if (git_reference_type(ref) == GIT_REF_SYMBOLIC) {
+	if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
 		git_reference_free(ref);
 		return 0;
 	}
@@ -2146,7 +2146,7 @@ int git_repository_head_detached_for_worktree(git_repository *repo, const char *
 	if ((error = git_repository_head_for_worktree(&ref, repo, name)) < 0)
 		goto out;
 
-	error = (git_reference_type(ref) != GIT_REF_SYMBOLIC);
+	error = (git_reference_type(ref) != GIT_REFERENCE_SYMBOLIC);
 out:
 	git_reference_free(ref);
 
@@ -2163,7 +2163,7 @@ int git_repository_head(git_reference **head_out, git_repository *repo)
 	if ((error = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0)
 		return error;
 
-	if (git_reference_type(head) == GIT_REF_OID) {
+	if (git_reference_type(head) == GIT_REFERENCE_DIRECT) {
 		*head_out = head;
 		return 0;
 	}
@@ -2188,7 +2188,7 @@ int git_repository_head_for_worktree(git_reference **out, git_repository *repo, 
 	    (error = git_reference__read_head(&head, repo, path.ptr)) < 0)
 		goto out;
 
-	if (git_reference_type(head) != GIT_REF_OID) {
+	if (git_reference_type(head) != GIT_REFERENCE_DIRECT) {
 		git_reference *resolved;
 
 		error = git_reference_lookup_resolved(&resolved, repo, git_reference_symbolic_target(head), -1);
@@ -2286,7 +2286,7 @@ int git_repository_is_empty(git_repository *repo)
 	if (git_reference_lookup(&head, repo, GIT_HEAD_FILE) < 0)
 		return -1;
 
-	if (git_reference_type(head) == GIT_REF_SYMBOLIC)
+	if (git_reference_type(head) == GIT_REFERENCE_SYMBOLIC)
 		is_empty =
 			(strcmp(git_reference_symbolic_target(head),
 					GIT_REFS_HEADS_DIR "master") == 0) &&
@@ -2594,7 +2594,7 @@ static int checkout_message(git_buf *out, git_reference *old, const char *new)
 {
 	git_buf_puts(out, "checkout: moving from ");
 
-	if (git_reference_type(old) == GIT_REF_SYMBOLIC)
+	if (git_reference_type(old) == GIT_REFERENCE_SYMBOLIC)
 		git_buf_puts(out, git_reference__shorthand(git_reference_symbolic_target(old)));
 	else
 		git_buf_puts(out, git_oid_tostr_s(git_reference_target(old)));
@@ -2669,7 +2669,7 @@ int git_repository_set_head(
 	if (error < 0 && error != GIT_ENOTFOUND)
 		goto cleanup;
 
-	if (ref && current->type == GIT_REF_SYMBOLIC && git__strcmp(current->target.symbolic, ref->name) &&
+	if (ref && current->type == GIT_REFERENCE_SYMBOLIC && git__strcmp(current->target.symbolic, ref->name) &&
 	    git_reference_is_branch(ref) && git_branch_is_checked_out(ref)) {
 		giterr_set(GITERR_REPOSITORY, "cannot set HEAD to reference '%s' as it is the current HEAD "
 			"of a linked repository.", git_reference_name(ref));
diff --git a/src/transaction.c b/src/transaction.c
index 22ba6b1..cc6d2b7 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -30,7 +30,7 @@ typedef struct {
 	const char *name;
 	void *payload;
 
-	git_ref_t ref_type;
+	git_reference_t ref_type;
 	union {
 		git_oid id;
 		char *symbolic;
@@ -120,7 +120,7 @@ int git_transaction_lock_ref(git_transaction *tx, const char *refname)
 		return error;
 
 	git_strmap_insert(tx->locks, node->name, node, &error);
-	if (error < 0) 
+	if (error < 0)
 		goto cleanup;
 
 	return 0;
@@ -189,7 +189,7 @@ int git_transaction_set_target(git_transaction *tx, const char *refname, const g
 		return error;
 
 	git_oid_cpy(&node->target.id, target);
-	node->ref_type = GIT_REF_OID;
+	node->ref_type = GIT_REFERENCE_DIRECT;
 
 	return 0;
 }
@@ -209,7 +209,7 @@ int git_transaction_set_symbolic_target(git_transaction *tx, const char *refname
 
 	node->target.symbolic = git_pool_strdup(&tx->pool, target);
 	GITERR_CHECK_ALLOC(node->target.symbolic);
-	node->ref_type = GIT_REF_SYMBOLIC;
+	node->ref_type = GIT_REFERENCE_SYMBOLIC;
 
 	return 0;
 }
@@ -223,7 +223,7 @@ int git_transaction_remove(git_transaction *tx, const char *refname)
 		return error;
 
 	node->remove = true;
-	node->ref_type = GIT_REF_OID; /* the id will be ignored */
+	node->ref_type = GIT_REFERENCE_DIRECT; /* the id will be ignored */
 
 	return 0;
 }
@@ -292,9 +292,9 @@ static int update_target(git_refdb *db, transaction_node *node)
 	git_reference *ref;
 	int error, update_reflog;
 
-	if (node->ref_type == GIT_REF_OID) {
+	if (node->ref_type == GIT_REFERENCE_DIRECT) {
 		ref = git_reference__alloc(node->name, &node->target.id, NULL);
-	} else if (node->ref_type == GIT_REF_SYMBOLIC) {
+	} else if (node->ref_type == GIT_REFERENCE_SYMBOLIC) {
 		ref = git_reference__alloc_symbolic(node->name, node->target.symbolic);
 	} else {
 		abort();
@@ -305,9 +305,9 @@ static int update_target(git_refdb *db, transaction_node *node)
 
 	if (node->remove) {
 		error =  git_refdb_unlock(db, node->payload, 2, false, ref, NULL, NULL);
-	} else if (node->ref_type == GIT_REF_OID) {
+	} else if (node->ref_type == GIT_REFERENCE_DIRECT) {
 		error = git_refdb_unlock(db, node->payload, true, update_reflog, ref, node->sig, node->message);
-	} else if (node->ref_type == GIT_REF_SYMBOLIC) {
+	} else if (node->ref_type == GIT_REFERENCE_SYMBOLIC) {
 		error = git_refdb_unlock(db, node->payload, true, update_reflog, ref, node->sig, node->message);
 	} else {
 		abort();
@@ -339,7 +339,7 @@ int git_transaction_commit(git_transaction *tx)
 				return error;
 		}
 
-		if (node->ref_type != GIT_REF_INVALID) {
+		if (node->ref_type != GIT_REFERENCE_INVALID) {
 			if ((error = update_target(tx->db, node)) < 0)
 				return error;
 		}
diff --git a/src/transports/local.c b/src/transports/local.c
index 64a1689..b8cc950 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -100,7 +100,7 @@ static int add_ref(transport_local *t, const char *name)
 
 	git_oid_cpy(&head->oid, &obj_id);
 
-	if (git_reference_type(ref) == GIT_REF_SYMBOLIC) {
+	if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
 		head->symref_target = git__strdup(git_reference_symbolic_target(ref));
 		GITERR_CHECK_ALLOC(head->symref_target);
 	}
@@ -512,7 +512,7 @@ static int foreach_reference_cb(git_reference *reference, void *payload)
 	git_revwalk *walk = (git_revwalk *)payload;
 	int error;
 
-	if (git_reference_type(reference) != GIT_REF_OID) {
+	if (git_reference_type(reference) != GIT_REFERENCE_DIRECT) {
 		git_reference_free(reference);
 		return 0;
 	}
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index 10a5b4e..031f851 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -297,7 +297,7 @@ static int fetch_setup_walk(git_revwalk **out, git_repository *repo)
 		if ((error = git_reference_lookup(&ref, repo, refs.strings[i])) < 0)
 			goto on_error;
 
-		if (git_reference_type(ref) == GIT_REF_SYMBOLIC)
+		if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC)
 			continue;
 
 		if ((error = git_revwalk_push(walk, git_reference_target(ref))) < 0)
diff --git a/tests/checkout/checkout_helpers.c b/tests/checkout/checkout_helpers.c
index cecee6a..8256644 100644
--- a/tests/checkout/checkout_helpers.c
+++ b/tests/checkout/checkout_helpers.c
@@ -10,7 +10,7 @@ void assert_on_branch(git_repository *repo, const char *branch)
 	git_buf bname = GIT_BUF_INIT;
 
 	cl_git_pass(git_reference_lookup(&head, repo, GIT_HEAD_FILE));
-	cl_assert_(git_reference_type(head) == GIT_REF_SYMBOLIC, branch);
+	cl_assert_(git_reference_type(head) == GIT_REFERENCE_SYMBOLIC, branch);
 
 	cl_git_pass(git_buf_joinpath(&bname, "refs/heads", branch));
 	cl_assert_equal_s(bname.ptr, git_reference_symbolic_target(head));
diff --git a/tests/commit/write.c b/tests/commit/write.c
index 2ba74ca..d829c97 100644
--- a/tests/commit/write.c
+++ b/tests/commit/write.c
@@ -157,7 +157,7 @@ void test_commit_write__root(void)
 
 	/* First we need to update HEAD so it points to our non-existant branch */
 	cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
-	cl_assert(git_reference_type(head) == GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(head) == GIT_REFERENCE_SYMBOLIC);
 	head_old = git__strdup(git_reference_symbolic_target(head));
 	cl_assert(head_old != NULL);
 	git_reference_free(head);
diff --git a/tests/network/fetchlocal.c b/tests/network/fetchlocal.c
index 91e2a05..bedbcf9 100644
--- a/tests/network/fetchlocal.c
+++ b/tests/network/fetchlocal.c
@@ -369,7 +369,7 @@ void test_network_fetchlocal__clone_into_mirror(void)
 	cl_git_pass(git_clone(&repo, cl_git_fixture_url("testrepo.git"), "./foo.git", &opts));
 
 	cl_git_pass(git_reference_lookup(&ref, repo, "HEAD"));
-	cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(ref));
+	cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(ref));
 	cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(ref));
 
 	git_reference_free(ref);
diff --git a/tests/online/clone.c b/tests/online/clone.c
index 928b7bc..3f12a02 100644
--- a/tests/online/clone.c
+++ b/tests/online/clone.c
@@ -145,7 +145,7 @@ void test_online_clone__empty_repository(void)
 	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));
+	cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
 	cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
 
 	git_reference_free(head);
@@ -185,7 +185,7 @@ void test_online_clone__can_checkout_a_cloned_repo(void)
 	cl_assert_equal_i(true, git_path_isfile(git_buf_cstr(&path)));
 
 	cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
-	cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
+	cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
 	cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
 
 	cl_assert_equal_i(true, checkout_progress_cb_was_called);
@@ -226,7 +226,7 @@ void test_online_clone__clone_mirror(void)
 	cl_git_pass(git_clone(&g_repo, LIVE_REPO_URL, "./foo.git", &opts));
 
 	cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
-	cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
+	cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
 	cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
 
 	cl_assert_equal_i(true, fetch_progress_cb_was_called);
diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c
index 6a2bd38..cccaac7 100644
--- a/tests/rebase/merge.c
+++ b/tests/rebase/merge.c
@@ -450,7 +450,7 @@ void test_rebase_merge__finish(void)
 	cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));
 
 	cl_git_pass(git_reference_lookup(&head_ref, repo, "HEAD"));
-	cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head_ref));
+	cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head_ref));
 	cl_assert_equal_s("refs/heads/gravy", git_reference_symbolic_target(head_ref));
 
 	/* Make sure the reflogs are updated appropriately */
@@ -512,7 +512,7 @@ void test_rebase_merge__detached_finish(void)
 	cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));
 
 	cl_git_pass(git_reference_lookup(&head_ref, repo, "HEAD"));
-	cl_assert_equal_i(GIT_REF_OID, git_reference_type(head_ref));
+	cl_assert_equal_i(GIT_REFERENCE_DIRECT, git_reference_type(head_ref));
 
 	/* Make sure the reflogs are updated appropriately */
 	cl_git_pass(git_reflog_read(&reflog, repo, "HEAD"));
@@ -561,7 +561,7 @@ void test_rebase_merge__finish_with_ids(void)
 	cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));
 
 	cl_git_pass(git_reference_lookup(&head_ref, repo, "HEAD"));
-	cl_assert_equal_i(GIT_REF_OID, git_reference_type(head_ref));
+	cl_assert_equal_i(GIT_REFERENCE_DIRECT, git_reference_type(head_ref));
 	cl_assert_equal_oid(&commit_id, git_reference_target(head_ref));
 
 	/* reflogs are not updated as if we were operating on proper
diff --git a/tests/refs/branches/delete.c b/tests/refs/branches/delete.c
index 928adf7..553d800 100644
--- a/tests/refs/branches/delete.c
+++ b/tests/refs/branches/delete.c
@@ -72,7 +72,7 @@ void test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD(
 	git_reference *head, *branch;
 
 	cl_git_pass(git_reference_lookup(&head, repo, GIT_HEAD_FILE));
-	cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
+	cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
 	cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
 	git_reference_free(head);
 
diff --git a/tests/refs/create.c b/tests/refs/create.c
index 469cddd..20ac579 100644
--- a/tests/refs/create.c
+++ b/tests/refs/create.c
@@ -41,13 +41,13 @@ void test_refs_create__symbolic(void)
 
 	/* Ensure the reference can be looked-up... */
 	cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
-	cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(looked_up_ref) & GIT_REFERENCE_SYMBOLIC);
 	cl_assert(reference_is_packed(looked_up_ref) == 0);
 	cl_assert_equal_s(looked_up_ref->name, new_head_tracker);
 
 	/* ...peeled.. */
 	cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
-	cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
+	cl_assert(git_reference_type(resolved_ref) == GIT_REFERENCE_DIRECT);
 
 	/* ...and that it points to the current master tip */
 	cl_assert_equal_oid(&id, git_reference_target(resolved_ref));
@@ -91,7 +91,7 @@ void test_refs_create__symbolic_with_arbitrary_content(void)
 
 	/* Ensure the reference can be looked-up... */
 	cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
-	cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(looked_up_ref) & GIT_REFERENCE_SYMBOLIC);
 	cl_assert(reference_is_packed(looked_up_ref) == 0);
 	cl_assert_equal_s(looked_up_ref->name, new_head_tracker);
 	git_reference_free(looked_up_ref);
@@ -104,7 +104,7 @@ void test_refs_create__symbolic_with_arbitrary_content(void)
 
 	/* Ensure the reference can be looked-up... */
 	cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head_tracker));
-	cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(looked_up_ref) & GIT_REFERENCE_SYMBOLIC);
 	cl_assert(reference_is_packed(looked_up_ref) == 0);
 	cl_assert_equal_s(looked_up_ref->name, new_head_tracker);
 
@@ -152,7 +152,7 @@ void test_refs_create__oid(void)
 
 	/* Ensure the reference can be looked-up... */
 	cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head));
-	cl_assert(git_reference_type(looked_up_ref) & GIT_REF_OID);
+	cl_assert(git_reference_type(looked_up_ref) & GIT_REFERENCE_DIRECT);
 	cl_assert(reference_is_packed(looked_up_ref) == 0);
 	cl_assert_equal_s(looked_up_ref->name, new_head);
 
diff --git a/tests/refs/normalize.c b/tests/refs/normalize.c
index c692eda..6da005d 100644
--- a/tests/refs/normalize.c
+++ b/tests/refs/normalize.c
@@ -29,83 +29,83 @@ static void ensure_refname_invalid(unsigned int flags, const char *input_refname
 void test_refs_normalize__can_normalize_a_direct_reference_name(void)
 {
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_NORMAL, "refs/dummy/a", "refs/dummy/a");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/dummy/a", "refs/dummy/a");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_NORMAL, "refs/stash", "refs/stash");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/stash", "refs/stash");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_NORMAL, "refs/tags/a", "refs/tags/a");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/tags/a", "refs/tags/a");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/a/b", "refs/heads/a/b");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/a/b", "refs/heads/a/b");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/a./b", "refs/heads/a./b");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/a./b", "refs/heads/a./b");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/v@ation", "refs/heads/v@ation");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/v@ation", "refs/heads/v@ation");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_NORMAL, "refs///heads///a", "refs/heads/a");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs///heads///a", "refs/heads/a");
 }
 
 void test_refs_normalize__cannot_normalize_any_direct_reference_name(void)
 {
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "a");
+		GIT_REFERENCE_FORMAT_NORMAL, "a");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "/a");
+		GIT_REFERENCE_FORMAT_NORMAL, "/a");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "//a");
+		GIT_REFERENCE_FORMAT_NORMAL, "//a");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "");
+		GIT_REFERENCE_FORMAT_NORMAL, "");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "/refs/heads/a/");
+		GIT_REFERENCE_FORMAT_NORMAL, "/refs/heads/a/");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/a/");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/a/");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/a.");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/a.");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/a.lock");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/a.lock");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/foo?bar");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/foo?bar");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "refs/heads\foo");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads\foo");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/v@ation", "refs/heads/v@ation");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/v@ation", "refs/heads/v@ation");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_NORMAL, "refs///heads///a", "refs/heads/a");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs///heads///a", "refs/heads/a");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/.a/b");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/.a/b");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/foo/../bar");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/foo/../bar");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/foo..bar");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/foo..bar");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/./foo");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/./foo");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "refs/heads/v@{ation");
+		GIT_REFERENCE_FORMAT_NORMAL, "refs/heads/v@{ation");
 }
 
 void test_refs_normalize__symbolic(void)
 {
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "heads\foo");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "heads\foo");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "/");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "/");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "///");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "///");
 
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "ALL_CAPS_AND_UNDERSCORES", "ALL_CAPS_AND_UNDERSCORES");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "ALL_CAPS_AND_UNDERSCORES", "ALL_CAPS_AND_UNDERSCORES");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/MixedCasing", "refs/MixedCasing");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/MixedCasing", "refs/MixedCasing");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs///heads///a", "refs/heads/a");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs///heads///a", "refs/heads/a");
 
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "HEAD", "HEAD");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "HEAD", "HEAD");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "MERGE_HEAD", "MERGE_HEAD");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "MERGE_HEAD", "MERGE_HEAD");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "FETCH_HEAD", "FETCH_HEAD");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "FETCH_HEAD", "FETCH_HEAD");
 }
 
 /* Ported from JGit, BSD licence.
@@ -146,47 +146,47 @@ void test_refs_normalize__symbolic(void)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
 void test_refs_normalize__jgit_suite(void)
 {
 	/* tests borrowed from JGit */
 
 /* EmptyString */
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "/");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "/");
 
 /* MustHaveTwoComponents */
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_NORMAL, "master");
+		GIT_REFERENCE_FORMAT_NORMAL, "master");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_NORMAL, "heads/master", "heads/master");
+		GIT_REFERENCE_FORMAT_NORMAL, "heads/master", "heads/master");
 
 /* ValidHead */
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master", "refs/heads/master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master", "refs/heads/master");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/pu", "refs/heads/pu");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/pu", "refs/heads/pu");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/z", "refs/heads/z");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/z", "refs/heads/z");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/FoO", "refs/heads/FoO");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/FoO", "refs/heads/FoO");
 
 /* ValidTag */
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/tags/v1.0", "refs/tags/v1.0");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/tags/v1.0", "refs/tags/v1.0");
 
 /* NoLockSuffix */
-	ensure_refname_invalid(GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master.lock");
+	ensure_refname_invalid(GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master.lock");
 
 /* NoDirectorySuffix */
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master/");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master/");
 
 /* NoSpace */
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/i haz space");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/i haz space");
 
 /* NoAsciiControlCharacters */
 	{
@@ -194,146 +194,146 @@ void test_refs_normalize__jgit_suite(void)
 		char buffer[GIT_REFNAME_MAX];
 		for (c = '\1'; c < ' '; c++) {
 			p_snprintf(buffer, sizeof(buffer), "refs/heads/mast%cer", c);
-			ensure_refname_invalid(GIT_REF_FORMAT_ALLOW_ONELEVEL, buffer);
+			ensure_refname_invalid(GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, buffer);
 		}
 	}
 
 /* NoBareDot */
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/.");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/.");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/..");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/..");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/./master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/./master");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/../master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/../master");
 
 /* NoLeadingOrTrailingDot */
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, ".");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, ".");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/.bar");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/.bar");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/..bar");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/..bar");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/bar.");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/bar.");
 
 /* ContainsDot */
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/m.a.s.t.e.r", "refs/heads/m.a.s.t.e.r");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/m.a.s.t.e.r", "refs/heads/m.a.s.t.e.r");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master..pu");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master..pu");
 
 /* NoMagicRefCharacters */
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master^");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master^");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/^master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/^master");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "^refs/heads/master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "^refs/heads/master");
 
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master~");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master~");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/~master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/~master");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "~refs/heads/master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "~refs/heads/master");
 
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master:");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master:");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/:master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/:master");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, ":refs/heads/master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, ":refs/heads/master");
 
 /* ShellGlob */
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master?");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master?");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/?master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/?master");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "?refs/heads/master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "?refs/heads/master");
 
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master[");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master[");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/[master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/[master");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "[refs/heads/master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "[refs/heads/master");
 
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master*");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master*");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/*master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/*master");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "*refs/heads/master");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "*refs/heads/master");
 
 /* ValidSpecialCharacters */
 	ensure_refname_normalized
-		(GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/!", "refs/heads/!");
+		(GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/!", "refs/heads/!");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/\"", "refs/heads/\"");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/\"", "refs/heads/\"");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/#", "refs/heads/#");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/#", "refs/heads/#");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/$", "refs/heads/$");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/$", "refs/heads/$");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/%", "refs/heads/%");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/%", "refs/heads/%");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/&", "refs/heads/&");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/&", "refs/heads/&");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/'", "refs/heads/'");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/'", "refs/heads/'");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/(", "refs/heads/(");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/(", "refs/heads/(");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/)", "refs/heads/)");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/)", "refs/heads/)");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/+", "refs/heads/+");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/+", "refs/heads/+");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/,", "refs/heads/,");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/,", "refs/heads/,");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/-", "refs/heads/-");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/-", "refs/heads/-");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/;", "refs/heads/;");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/;", "refs/heads/;");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/<", "refs/heads/<");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/<", "refs/heads/<");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/=", "refs/heads/=");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/=", "refs/heads/=");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/>", "refs/heads/>");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/>", "refs/heads/>");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/@", "refs/heads/@");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/@", "refs/heads/@");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/]", "refs/heads/]");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/]", "refs/heads/]");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/_", "refs/heads/_");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/_", "refs/heads/_");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/`", "refs/heads/`");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/`", "refs/heads/`");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/{", "refs/heads/{");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/{", "refs/heads/{");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/|", "refs/heads/|");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/|", "refs/heads/|");
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/}", "refs/heads/}");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/}", "refs/heads/}");
 
 	/*
 	 * This is valid on UNIX, but not on Windows
 	 * hence we make in invalid due to non-portability
 	 */
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/\\");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/\\");
 
 /* UnicodeNames */
 	/*
 	 * Currently this fails.
-	 * ensure_refname_normalized(GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/\u00e5ngstr\u00f6m", "refs/heads/\u00e5ngstr\u00f6m");
+	 * ensure_refname_normalized(GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/\u00e5ngstr\u00f6m", "refs/heads/\u00e5ngstr\u00f6m");
 	 */
 
 /* RefLogQueryIsValidRef */
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master@{1}");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master@{1}");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_ALLOW_ONELEVEL, "refs/heads/master@{1.hour.ago}");
+		GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL, "refs/heads/master@{1.hour.ago}");
 }
 
 void test_refs_normalize__buffer_has_to_be_big_enough_to_hold_the_normalized_version(void)
@@ -341,61 +341,61 @@ void test_refs_normalize__buffer_has_to_be_big_enough_to_hold_the_normalized_ver
 	char buffer_out[21];
 
 	cl_git_pass(git_reference_normalize_name(
-		buffer_out, 21, "refs//heads///long///name", GIT_REF_FORMAT_NORMAL));
+		buffer_out, 21, "refs//heads///long///name", GIT_REFERENCE_FORMAT_NORMAL));
 	cl_git_fail(git_reference_normalize_name(
-		buffer_out, 20, "refs//heads///long///name", GIT_REF_FORMAT_NORMAL));
+		buffer_out, 20, "refs//heads///long///name", GIT_REFERENCE_FORMAT_NORMAL));
 }
 
 #define ONE_LEVEL_AND_REFSPEC \
-	GIT_REF_FORMAT_ALLOW_ONELEVEL \
-	| GIT_REF_FORMAT_REFSPEC_PATTERN
+	GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL \
+	| GIT_REFERENCE_FORMAT_REFSPEC_PATTERN
 
 void test_refs_normalize__refspec_pattern(void)
 {
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "heads/*foo/bar");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "heads/*foo/bar");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "heads/foo*/bar");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "heads/foo*/bar");
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "heads/f*o/bar");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "heads/f*o/bar");
 
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "foo");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "foo");
 	ensure_refname_normalized(
 		ONE_LEVEL_AND_REFSPEC, "FOO", "FOO");
 
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "foo/bar", "foo/bar");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "foo/bar", "foo/bar");
 	ensure_refname_normalized(
 		ONE_LEVEL_AND_REFSPEC, "foo/bar", "foo/bar");
 
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "*/foo", "*/foo");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "*/foo", "*/foo");
 	ensure_refname_normalized(
 		ONE_LEVEL_AND_REFSPEC, "*/foo", "*/foo");
 
 	ensure_refname_normalized(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "foo/*/bar", "foo/*/bar");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "foo/*/bar", "foo/*/bar");
 	ensure_refname_normalized(
 		ONE_LEVEL_AND_REFSPEC, "foo/*/bar", "foo/*/bar");
 
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "*");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "*");
 	ensure_refname_normalized(
 		ONE_LEVEL_AND_REFSPEC, "*", "*");
 
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "foo/*/*");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "foo/*/*");
 	ensure_refname_invalid(
 		ONE_LEVEL_AND_REFSPEC, "foo/*/*");
 
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "*/foo/*");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "*/foo/*");
 	ensure_refname_invalid(
 		ONE_LEVEL_AND_REFSPEC, "*/foo/*");
 
 	ensure_refname_invalid(
-		GIT_REF_FORMAT_REFSPEC_PATTERN, "*/*/foo");
+		GIT_REFERENCE_FORMAT_REFSPEC_PATTERN, "*/*/foo");
 	ensure_refname_invalid(
 		ONE_LEVEL_AND_REFSPEC, "*/*/foo");
 }
diff --git a/tests/refs/overwrite.c b/tests/refs/overwrite.c
index 2e499b7..1826b12 100644
--- a/tests/refs/overwrite.c
+++ b/tests/refs/overwrite.c
@@ -33,7 +33,7 @@ void test_refs_overwrite__symbolic(void)
 
 	/* Ensure it points to the right place*/
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_SYMBOLIC);
 	cl_assert_equal_s(git_reference_symbolic_target(ref), ref_branch_name);
 	git_reference_free(ref);
 
@@ -44,7 +44,7 @@ void test_refs_overwrite__symbolic(void)
 
 	/* Ensure it points to the right place */
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_SYMBOLIC);
 	cl_assert_equal_s(git_reference_symbolic_target(ref), ref_master_name);
 
 	git_reference_free(ref);
@@ -58,7 +58,7 @@ void test_refs_overwrite__object_id(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_OID);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
 	git_oid_cpy(&id, git_reference_target(ref));
 	git_reference_free(ref);
 
@@ -67,7 +67,7 @@ void test_refs_overwrite__object_id(void)
 	git_reference_free(ref);
 
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_test_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_OID);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
 	git_oid_cpy(&id, git_reference_target(ref));
 	git_reference_free(ref);
 
@@ -90,7 +90,7 @@ void test_refs_overwrite__object_id_with_symbolic(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_OID);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
 	git_oid_cpy(&id, git_reference_target(ref));
 	git_reference_free(ref);
 
@@ -102,7 +102,7 @@ void test_refs_overwrite__object_id_with_symbolic(void)
 
 	/* Ensure it points to the right place */
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_SYMBOLIC);
 	cl_assert_equal_s(git_reference_symbolic_target(ref), ref_master_name);
 
 	git_reference_free(ref);
@@ -115,7 +115,7 @@ void test_refs_overwrite__symbolic_with_object_id(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_OID);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
 	git_oid_cpy(&id, git_reference_target(ref));
 	git_reference_free(ref);
 
@@ -129,7 +129,7 @@ void test_refs_overwrite__symbolic_with_object_id(void)
 
 	/* Ensure it points to the right place */
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_OID);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
 	cl_assert_equal_oid(&id, git_reference_target(ref));
 
 	git_reference_free(ref);
diff --git a/tests/refs/read.c b/tests/refs/read.c
index 5a1f554..1bbc387 100644
--- a/tests/refs/read.c
+++ b/tests/refs/read.c
@@ -34,7 +34,7 @@ void test_refs_read__loose_tag(void)
 	git_buf ref_name_from_tag_name = GIT_BUF_INIT;
 
 	cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
-	cl_assert(git_reference_type(reference) & GIT_REF_OID);
+	cl_assert(git_reference_type(reference) & GIT_REFERENCE_DIRECT);
 	cl_assert(reference_is_packed(reference) == 0);
 	cl_assert_equal_s(reference->name, loose_tag_ref_name);
 
@@ -71,12 +71,12 @@ void test_refs_read__symbolic(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
-	cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(reference) & GIT_REFERENCE_SYMBOLIC);
 	cl_assert(reference_is_packed(reference) == 0);
 	cl_assert_equal_s(reference->name, GIT_HEAD_FILE);
 
 	cl_git_pass(git_reference_resolve(&resolved_ref, reference));
-	cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
+	cl_assert(git_reference_type(resolved_ref) == GIT_REFERENCE_DIRECT);
 
 	cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJECT_ANY));
 	cl_assert(object != NULL);
@@ -99,12 +99,12 @@ void test_refs_read__nested_symbolic(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&reference, g_repo, head_tracker_sym_ref_name));
-	cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(reference) & GIT_REFERENCE_SYMBOLIC);
 	cl_assert(reference_is_packed(reference) == 0);
 	cl_assert_equal_s(reference->name, head_tracker_sym_ref_name);
 
 	cl_git_pass(git_reference_resolve(&resolved_ref, reference));
-	cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
+	cl_assert(git_reference_type(resolved_ref) == GIT_REFERENCE_DIRECT);
 
 	cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJECT_ANY));
 	cl_assert(object != NULL);
@@ -167,7 +167,7 @@ void test_refs_read__packed(void)
 	git_object *object;
 
 	cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
-	cl_assert(git_reference_type(reference) & GIT_REF_OID);
+	cl_assert(git_reference_type(reference) & GIT_REFERENCE_DIRECT);
 	cl_assert(reference_is_packed(reference));
 	cl_assert_equal_s(reference->name, packed_head_name);
 
@@ -188,7 +188,7 @@ void test_refs_read__loose_first(void)
 	cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
 	git_reference_free(reference);
 	cl_git_pass(git_reference_lookup(&reference, g_repo, packed_test_head_name));
-	cl_assert(git_reference_type(reference) & GIT_REF_OID);
+	cl_assert(git_reference_type(reference) & GIT_REFERENCE_DIRECT);
 	cl_assert(reference_is_packed(reference) == 0);
 	cl_assert_equal_s(reference->name, packed_test_head_name);
 
diff --git a/tests/refs/rename.c b/tests/refs/rename.c
index 6ec8f65..9933bee 100644
--- a/tests/refs/rename.c
+++ b/tests/refs/rename.c
@@ -264,7 +264,7 @@ void test_refs_rename__overwrite(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_OID);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
 
 	git_oid_cpy(&id, git_reference_target(ref));
 
@@ -297,7 +297,7 @@ void test_refs_rename__prefix(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_OID);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
 
 	git_oid_cpy(&id, git_reference_target(ref));
 
@@ -330,7 +330,7 @@ void test_refs_rename__move_up(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
-	cl_assert(git_reference_type(ref) & GIT_REF_OID);
+	cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
 
 	git_oid_cpy(&id, git_reference_target(ref));
 
diff --git a/tests/refs/setter.c b/tests/refs/setter.c
index 03c2146..b34c71e 100644
--- a/tests/refs/setter.c
+++ b/tests/refs/setter.c
@@ -27,12 +27,12 @@ void test_refs_setter__update_direct(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
-	cl_assert(git_reference_type(ref) == GIT_REF_OID);
+	cl_assert(git_reference_type(ref) == GIT_REFERENCE_DIRECT);
 	git_oid_cpy(&id, git_reference_target(ref));
 	git_reference_free(ref);
 
 	cl_git_pass(git_reference_lookup(&test_ref, g_repo, ref_test_name));
-	cl_assert(git_reference_type(test_ref) == GIT_REF_OID);
+	cl_assert(git_reference_type(test_ref) == GIT_REFERENCE_DIRECT);
 
 	cl_git_pass(git_reference_set_target(&new_ref, test_ref, &id, NULL));
 
@@ -40,7 +40,7 @@ void test_refs_setter__update_direct(void)
 	git_reference_free(new_ref);
 
 	cl_git_pass(git_reference_lookup(&test_ref, g_repo, ref_test_name));
-	cl_assert(git_reference_type(test_ref) == GIT_REF_OID);
+	cl_assert(git_reference_type(test_ref) == GIT_REFERENCE_DIRECT);
 	cl_assert_equal_oid(&id, git_reference_target(test_ref));
 	git_reference_free(test_ref);
 }
@@ -50,7 +50,7 @@ void test_refs_setter__update_symbolic(void)
 	git_reference *head, *new_head;
 
 	cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
-	cl_assert(git_reference_type(head) == GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(head) == GIT_REFERENCE_SYMBOLIC);
 	cl_assert(strcmp(git_reference_symbolic_target(head), ref_master_name) == 0);
 
 	cl_git_pass(git_reference_symbolic_set_target(&new_head, head, ref_test_name, NULL));
@@ -58,7 +58,7 @@ void test_refs_setter__update_symbolic(void)
 	git_reference_free(head);
 
 	cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
-	cl_assert(git_reference_type(head) == GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(head) == GIT_REFERENCE_SYMBOLIC);
 	cl_assert(strcmp(git_reference_symbolic_target(head), ref_test_name) == 0);
 	git_reference_free(head);
 }
@@ -70,7 +70,7 @@ void test_refs_setter__cant_update_direct_with_symbolic(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
-	cl_assert(git_reference_type(ref) == GIT_REF_OID);
+	cl_assert(git_reference_type(ref) == GIT_REFERENCE_DIRECT);
 	git_oid_cpy(&id, git_reference_target(ref));
 
 	cl_git_fail(git_reference_symbolic_set_target(&new, ref, ref_name, NULL));
@@ -85,7 +85,7 @@ void test_refs_setter__cant_update_symbolic_with_direct(void)
 	git_oid id;
 
 	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
-	cl_assert(git_reference_type(ref) == GIT_REF_OID);
+	cl_assert(git_reference_type(ref) == GIT_REFERENCE_DIRECT);
 	git_oid_cpy(&id, git_reference_target(ref));
 	git_reference_free(ref);
 
diff --git a/tests/refs/update.c b/tests/refs/update.c
index 403ea75..1c5127d 100644
--- a/tests/refs/update.c
+++ b/tests/refs/update.c
@@ -19,7 +19,7 @@ void test_refs_update__updating_the_target_of_a_symref_with_an_invalid_name_retu
 	git_reference *head;
 
 	cl_git_pass(git_reference_lookup(&head, g_repo, GIT_HEAD_FILE));
-	cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
+	cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
 	git_reference_free(head);
 
 	cl_assert_equal_i(GIT_EINVALIDSPEC, git_reference_symbolic_create(&head, g_repo, GIT_HEAD_FILE, "refs/heads/inv@{id", 1, NULL));
diff --git a/tests/repo/init.c b/tests/repo/init.c
index 2611f05..91b25a5 100644
--- a/tests/repo/init.c
+++ b/tests/repo/init.c
@@ -442,7 +442,7 @@ void test_repo_init__extended_1(void)
 		cl_assert((S_ISGID & st.st_mode) == 0);
 
 	cl_git_pass(git_reference_lookup(&ref, _repo, "HEAD"));
-	cl_assert(git_reference_type(ref) == GIT_REF_SYMBOLIC);
+	cl_assert(git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC);
 	cl_assert_equal_s("refs/heads/development", git_reference_symbolic_target(ref));
 	git_reference_free(ref);