Commit 96a5f38f51bc53895000787542f92d0a3352c026

Patrick Steinhardt 2020-06-10T07:42:52

Merge pull request #5551 from pks-t/pks/missing-declarations Missing declarations

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
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1fb1c53..481707c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -21,6 +21,8 @@ SET(LIBGIT2_INCLUDES
 SET(LIBGIT2_SYSTEM_INCLUDES "")
 SET(LIBGIT2_LIBS "")
 
+enable_warnings(missing-declarations)
+
 # Enable tracing
 IF(ENABLE_TRACE)
 	SET(GIT_TRACE 1)
diff --git a/src/blame.c b/src/blame.c
index 23c2102..1046dab 100644
--- a/src/blame.c
+++ b/src/blame.c
@@ -538,7 +538,9 @@ int git_blame_options_init(git_blame_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_blame_init_options(git_blame_options *opts, unsigned int version)
 {
 	return git_blame_options_init(opts, version);
 }
+#endif
diff --git a/src/blob.c b/src/blob.c
index 5e734e2..da4e6ff 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -445,6 +445,7 @@ int git_blob_filter(
 
 /* Deprecated functions */
 
+#ifndef GIT_DEPRECATE_HARD
 int git_blob_create_frombuffer(
 	git_oid *id, git_repository *repo, const void *buffer, size_t len)
 {
@@ -491,3 +492,4 @@ int git_blob_filtered_content(
 
 	return git_blob_filter(out, blob, path, &opts);
 }
+#endif
diff --git a/src/buffer.c b/src/buffer.c
index 328fdfe..3ee2775 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -133,10 +133,12 @@ void git_buf_dispose(git_buf *buf)
 	git_buf_init(buf, 0);
 }
 
+#ifndef GIT_DEPRECATE_HARD
 void git_buf_free(git_buf *buf)
 {
 	git_buf_dispose(buf);
 }
+#endif
 
 void git_buf_sanitize(git_buf *buf)
 {
diff --git a/src/cache.c b/src/cache.c
index af42b39..1d2c015 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -41,27 +41,6 @@ int git_cache_set_max_object_size(git_object_t type, size_t size)
 	return 0;
 }
 
-void git_cache_dump_stats(git_cache *cache)
-{
-	git_cached_obj *object;
-
-	if (git_cache_size(cache) == 0)
-		return;
-
-	printf("Cache %p: %"PRIuZ" items cached, %"PRIdZ" bytes\n",
-		cache, git_cache_size(cache), cache->used_memory);
-
-	git_oidmap_foreach_value(cache->map, object, {
-		char oid_str[9];
-		printf(" %s%c %s (%"PRIuZ")\n",
-			git_object_type2string(object->type),
-			object->flags == GIT_CACHE_STORE_PARSED ? '*' : ' ',
-			git_oid_tostr(oid_str, sizeof(oid_str), &object->oid),
-			object->size
-		);
-	});
-}
-
 int git_cache_init(git_cache *cache)
 {
 	memset(cache, 0, sizeof(*cache));
diff --git a/src/checkout.c b/src/checkout.c
index 1e6ea4d..b18e8d9 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -806,7 +806,7 @@ static int checkout_conflictdata_cmp(const void *a, const void *b)
 	return diff;
 }
 
-int checkout_conflictdata_empty(
+static int checkout_conflictdata_empty(
 	const git_vector *conflicts, size_t idx, void *payload)
 {
 	checkout_conflictdata *conflict;
@@ -2820,7 +2820,9 @@ int git_checkout_options_init(git_checkout_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_checkout_init_options(git_checkout_options *opts, unsigned int version)
 {
 	return git_checkout_options_init(opts, version);
 }
+#endif
diff --git a/src/cherrypick.c b/src/cherrypick.c
index 640d11a..103897a 100644
--- a/src/cherrypick.c
+++ b/src/cherrypick.c
@@ -229,8 +229,10 @@ int git_cherrypick_options_init(
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_cherrypick_init_options(
 	git_cherrypick_options *opts, unsigned int version)
 {
 	return git_cherrypick_options_init(opts, version);
 }
+#endif
diff --git a/src/clone.c b/src/clone.c
index 3d749c3..8ca6cea 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -479,10 +479,12 @@ int git_clone_options_init(git_clone_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_clone_init_options(git_clone_options *opts, unsigned int version)
 {
 	return git_clone_options_init(opts, version);
 }
+#endif
 
 static bool can_link(const char *src, const char *dst, int link)
 {
diff --git a/src/config.c b/src/config.c
index 8338da0..81f010f 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1000,7 +1000,7 @@ static int multivar_iter_next(git_config_entry **entry, git_config_iterator *_it
 	return error;
 }
 
-void multivar_iter_free(git_config_iterator *_iter)
+static void multivar_iter_free(git_config_iterator *_iter)
 {
 	multivar_iter *iter = (multivar_iter *) _iter;
 
diff --git a/src/config_snapshot.c b/src/config_snapshot.c
index 62b9068..e295d2f 100644
--- a/src/config_snapshot.c
+++ b/src/config_snapshot.c
@@ -5,8 +5,9 @@
  * a Linking Exception. For full terms see the included COPYING file.
  */
 
-#include "config.h"
+#include "config_backend.h"
 
+#include "config.h"
 #include "config_entries.h"
 
 typedef struct {
diff --git a/src/describe.c b/src/describe.c
index 42e5848..c8a1752 100644
--- a/src/describe.c
+++ b/src/describe.c
@@ -876,10 +876,12 @@ int git_describe_options_init(git_describe_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_describe_init_options(git_describe_options *opts, unsigned int version)
 {
 	return git_describe_options_init(opts, version);
 }
+#endif
 
 int git_describe_format_options_init(git_describe_format_options *opts, unsigned int version)
 {
@@ -888,7 +890,9 @@ int git_describe_format_options_init(git_describe_format_options *opts, unsigned
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_describe_init_format_options(git_describe_format_options *opts, unsigned int version)
 {
 	return git_describe_format_options_init(opts, version);
 }
+#endif
diff --git a/src/diff.c b/src/diff.c
index 47f49d9..3e52e3f 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -32,11 +32,6 @@ GIT_INLINE(const char *) diff_delta__path(const git_diff_delta *delta)
 	return str;
 }
 
-const char *git_diff_delta__path(const git_diff_delta *delta)
-{
-	return diff_delta__path(delta);
-}
-
 int git_diff_delta__cmp(const void *a, const void *b)
 {
 	const git_diff_delta *da = a, *db = b;
@@ -155,7 +150,7 @@ int git_diff_foreach(
 	return error;
 }
 
-int git_diff_format_email__append_header_tobuf(
+static int diff_format_email_append_header_tobuf(
 	git_buf *out,
 	const git_oid *id,
 	const git_signature *author,
@@ -212,7 +207,7 @@ int git_diff_format_email__append_header_tobuf(
 	return error;
 }
 
-int git_diff_format_email__append_patches_tobuf(
+static int diff_format_email_append_patches_tobuf(
 	git_buf *out,
 	git_diff *diff)
 {
@@ -292,7 +287,7 @@ int git_diff_format_email(
 		strncpy(summary, opts->summary, offset);
 	}
 
-	error = git_diff_format_email__append_header_tobuf(out,
+	error = diff_format_email_append_header_tobuf(out,
 		opts->id, opts->author, summary == NULL ? opts->summary : summary,
 		opts->body, opts->patch_no, opts->total_patches, ignore_marker);
 
@@ -305,7 +300,7 @@ int git_diff_format_email(
 		(error = git_diff_get_stats(&stats, diff)) < 0 ||
 		(error = git_diff_stats_to_buf(out, stats, format_flags, 0)) < 0 ||
 		(error = git_buf_putc(out, '\n')) < 0 ||
-		(error = git_diff_format_email__append_patches_tobuf(out, diff)) < 0)
+		(error = diff_format_email_append_patches_tobuf(out, diff)) < 0)
 			goto on_error;
 
 	error = git_buf_puts(out, "--\nlibgit2 " LIBGIT2_VERSION "\n\n");
@@ -357,10 +352,12 @@ int git_diff_options_init(git_diff_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_diff_init_options(git_diff_options *opts, unsigned int version)
 {
 	return git_diff_options_init(opts, version);
 }
+#endif
 
 int git_diff_find_options_init(
 	git_diff_find_options *opts, unsigned int version)
@@ -370,11 +367,13 @@ int git_diff_find_options_init(
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_diff_find_init_options(
 	git_diff_find_options *opts, unsigned int version)
 {
 	return git_diff_find_options_init(opts, version);
 }
+#endif
 
 int git_diff_format_email_options_init(
 	git_diff_format_email_options *opts, unsigned int version)
@@ -385,11 +384,13 @@ int git_diff_format_email_options_init(
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_diff_format_email_init_options(
 	git_diff_format_email_options *opts, unsigned int version)
 {
 	return git_diff_format_email_options_init(opts, version);
 }
+#endif
 
 static int flush_hunk(git_oid *result, git_hash_ctx *ctx)
 {
@@ -426,7 +427,7 @@ static void strip_spaces(git_buf *buf)
 	git_buf_truncate(buf, len);
 }
 
-int git_diff_patchid_print_callback__to_buf(
+static int diff_patchid_print_callback_to_buf(
 	const git_diff_delta *delta,
 	const git_diff_hunk *hunk,
 	const git_diff_line *line,
@@ -485,7 +486,7 @@ int git_diff_patchid(git_oid *out, git_diff *diff, git_diff_patchid_options *opt
 
 	if ((error = git_diff_print(diff,
 				    GIT_DIFF_FORMAT_PATCH_ID,
-				    git_diff_patchid_print_callback__to_buf,
+				    diff_patchid_print_callback_to_buf,
 				    &args)) < 0)
 		goto out;
 
diff --git a/src/diff_generate.c b/src/diff_generate.c
index e9e5242..e7bfd62 100644
--- a/src/diff_generate.c
+++ b/src/diff_generate.c
@@ -301,14 +301,14 @@ GIT_INLINE(const char *) diff_delta__i2w_path(const git_diff_delta *delta)
 		delta->old_file.path : delta->new_file.path;
 }
 
-int git_diff_delta__i2w_cmp(const void *a, const void *b)
+static int diff_delta_i2w_cmp(const void *a, const void *b)
 {
 	const git_diff_delta *da = a, *db = b;
 	int val = strcmp(diff_delta__i2w_path(da), diff_delta__i2w_path(db));
 	return val ? val : ((int)da->status - (int)db->status);
 }
 
-int git_diff_delta__i2w_casecmp(const void *a, const void *b)
+static int diff_delta_i2w_casecmp(const void *a, const void *b)
 {
 	const git_diff_delta *da = a, *db = b;
 	int val = strcasecmp(diff_delta__i2w_path(da), diff_delta__i2w_path(db));
@@ -361,7 +361,7 @@ static const char *diff_mnemonic_prefix(
 	return pfx;
 }
 
-void git_diff__set_ignore_case(git_diff *diff, bool ignore_case)
+static void diff_set_ignore_case(git_diff *diff, bool ignore_case)
 {
 	if (!ignore_case) {
 		diff->opts.flags &= ~GIT_DIFF_IGNORE_CASE;
@@ -431,7 +431,7 @@ static git_diff_generated *diff_generated_alloc(
 
 	/* Use case-insensitive compare if either iterator has
 	 * the ignore_case bit set */
-	git_diff__set_ignore_case(
+	diff_set_ignore_case(
 		&diff->base,
 		git_iterator_ignore_case(old_iter) ||
 		git_iterator_ignore_case(new_iter));
@@ -1375,7 +1375,7 @@ int git_diff_tree_to_index(
 
 	/* if index is in case-insensitive order, re-sort deltas to match */
 	if (index_ignore_case)
-		git_diff__set_ignore_case(diff, true);
+		diff_set_ignore_case(diff, true);
 
 	*out = diff;
 	diff = NULL;
@@ -1526,7 +1526,7 @@ int git_diff_index_to_index(
 
 	/* if index is in case-insensitive order, re-sort deltas to match */
 	if (old_index->ignore_case || new_index->ignore_case)
-		git_diff__set_ignore_case(diff, true);
+		diff_set_ignore_case(diff, true);
 
 	*out = diff;
 	diff = NULL;
@@ -1583,10 +1583,10 @@ int git_diff__paired_foreach(
 	if (i2w_icase && !icase_mismatch) {
 		strcomp = git__strcasecmp;
 
-		git_vector_set_cmp(&idx2wd->deltas, git_diff_delta__i2w_casecmp);
+		git_vector_set_cmp(&idx2wd->deltas, diff_delta_i2w_casecmp);
 		git_vector_sort(&idx2wd->deltas);
 	} else if (idx2wd != NULL) {
-		git_vector_set_cmp(&idx2wd->deltas, git_diff_delta__i2w_cmp);
+		git_vector_set_cmp(&idx2wd->deltas, diff_delta_i2w_cmp);
 		git_vector_sort(&idx2wd->deltas);
 	}
 
diff --git a/src/diff_print.c b/src/diff_print.c
index a78953c..9ff6d9a 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -337,7 +337,7 @@ static int diff_delta_format_with_paths(
 	return git_buf_printf(out, template, oldpath, newpath);
 }
 
-int diff_delta_format_similarity_header(
+static int diff_delta_format_similarity_header(
 	git_buf *out,
 	const git_diff_delta *delta)
 {
diff --git a/src/diff_stats.c b/src/diff_stats.c
index 19c9da0..1028b01 100644
--- a/src/diff_stats.c
+++ b/src/diff_stats.c
@@ -46,7 +46,7 @@ static int digits_for_value(size_t val)
 	return count;
 }
 
-int git_diff_file_stats__full_to_buf(
+static int diff_file_stats_full_to_buf(
 	git_buf *out,
 	const git_diff_delta *delta,
 	const diff_file_stats *filestat,
@@ -134,7 +134,7 @@ on_error:
 	return (git_buf_oom(out) ? -1 : 0);
 }
 
-int git_diff_file_stats__number_to_buf(
+static int diff_file_stats_number_to_buf(
 	git_buf *out,
 	const git_diff_delta *delta,
 	const diff_file_stats *filestats)
@@ -151,7 +151,7 @@ int git_diff_file_stats__number_to_buf(
 	return error;
 }
 
-int git_diff_file_stats__summary_to_buf(
+static int diff_file_stats_summary_to_buf(
 	git_buf *out,
 	const git_diff_delta *delta)
 {
@@ -288,7 +288,7 @@ int git_diff_stats_to_buf(
 			if ((delta = git_diff_get_delta(stats->diff, i)) == NULL)
 				continue;
 
-			error = git_diff_file_stats__number_to_buf(
+			error = diff_file_stats_number_to_buf(
 				out, delta, &stats->filestats[i]);
 			if (error < 0)
 				return error;
@@ -309,7 +309,7 @@ int git_diff_stats_to_buf(
 			if ((delta = git_diff_get_delta(stats->diff, i)) == NULL)
 				continue;
 
-			error = git_diff_file_stats__full_to_buf(
+			error = diff_file_stats_full_to_buf(
 				out, delta, &stats->filestats[i], stats, width);
 			if (error < 0)
 				return error;
@@ -342,7 +342,7 @@ int git_diff_stats_to_buf(
 			if ((delta = git_diff_get_delta(stats->diff, i)) == NULL)
 				continue;
 
-			error = git_diff_file_stats__summary_to_buf(out, delta);
+			error = diff_file_stats_summary_to_buf(out, delta);
 			if (error < 0)
 				return error;
 		}
diff --git a/src/errors.c b/src/errors.c
index b34aa3a..8570226 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -210,6 +210,7 @@ void git_error_system_set(int code)
 
 /* Deprecated error values and functions */
 
+#ifndef GIT_DEPRECATE_HARD
 const git_error *giterr_last(void)
 {
 	return git_error_last();
@@ -229,3 +230,4 @@ void giterr_set_oom(void)
 {
 	git_error_set_oom();
 }
+#endif
diff --git a/src/fetch.c b/src/fetch.c
index f2f3131..f4a4c9f 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -155,7 +155,9 @@ int git_fetch_options_init(git_fetch_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_fetch_init_options(git_fetch_options *opts, unsigned int version)
 {
 	return git_fetch_options_init(opts, version);
 }
+#endif
diff --git a/src/filter.c b/src/filter.c
index bb9d66a..09b57dc 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -941,7 +941,7 @@ out:
 	return error;
 }
 
-void stream_list_free(git_vector *streams)
+static void filter_streams_free(git_vector *streams)
 {
 	git_writestream *stream;
 	size_t i;
@@ -990,7 +990,7 @@ done:
 
 	if (fd >= 0)
 		p_close(fd);
-	stream_list_free(&filter_streams);
+	filter_streams_free(&filter_streams);
 	git_buf_dispose(&abspath);
 	return error;
 }
@@ -1018,7 +1018,7 @@ out:
 	if (initialized)
 		error |= stream_start->close(stream_start);
 
-	stream_list_free(&filter_streams);
+	filter_streams_free(&filter_streams);
 	return error;
 }
 
diff --git a/src/idxmap.c b/src/idxmap.c
index 4dcf963..bc23608 100644
--- a/src/idxmap.c
+++ b/src/idxmap.c
@@ -138,28 +138,6 @@ void *git_idxmap_icase_get(git_idxmap_icase *map, const git_index_entry *key)
 	return kh_val(map, idx);
 }
 
-void git_idxmap_insert(git_idxmap *map, const git_index_entry *key, void *value, int *rval)
-{
-	khiter_t idx = kh_put(idx, map, key, rval);
-
-	if ((*rval) >= 0) {
-		if ((*rval) == 0)
-			kh_key(map, idx) = key;
-		kh_val(map, idx) = value;
-	}
-}
-
-void git_idxmap_icase_insert(git_idxmap_icase *map, const git_index_entry *key, void *value, int *rval)
-{
-	khiter_t idx = kh_put(idxicase, map, key, rval);
-
-	if ((*rval) >= 0) {
-		if ((*rval) == 0)
-			kh_key(map, idx) = key;
-		kh_val(map, idx) = value;
-	}
-}
-
 int git_idxmap_delete(git_idxmap *map, const git_index_entry *key)
 {
 	khiter_t idx = kh_get(idx, map, key);
diff --git a/src/index.c b/src/index.c
index 774321d..361288b 100644
--- a/src/index.c
+++ b/src/index.c
@@ -3717,9 +3717,11 @@ void git_indexwriter_cleanup(git_indexwriter *writer)
 
 /* Deprecated functions */
 
+#ifndef GIT_DEPRECATE_HARD
 int git_index_add_frombuffer(
     git_index *index, const git_index_entry *source_entry,
     const void *buffer, size_t len)
 {
 	return git_index_add_from_buffer(index, source_entry, buffer, len);
 }
+#endif
diff --git a/src/indexer.c b/src/indexer.c
index 8dc6c7a..412dfc9 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -123,10 +123,12 @@ int git_indexer_options_init(git_indexer_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_indexer_init_options(git_indexer_options *opts, unsigned int version)
 {
 	return git_indexer_options_init(opts, version);
 }
+#endif
 
 int git_indexer_new(
 		git_indexer **out,
diff --git a/src/merge.c b/src/merge.c
index 6e3a6c6..2f6bf6f 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -80,7 +80,7 @@ static int cache_invalid_marker;
 
 /* Merge base computation */
 
-int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_repository *repo, size_t length, const git_oid input_array[])
+static int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_repository *repo, size_t length, const git_oid input_array[])
 {
 	git_revwalk *walk = NULL;
 	git_vector list;
@@ -2845,7 +2845,7 @@ on_error:
 	return error;
 }
 
-const char *merge_their_label(const char *branchname)
+static const char *merge_their_label(const char *branchname)
 {
 	const char *slash;
 
@@ -3351,10 +3351,12 @@ int git_merge_options_init(git_merge_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_merge_init_options(git_merge_options *opts, unsigned int version)
 {
 	return git_merge_options_init(opts, version);
 }
+#endif
 
 int git_merge_file_input_init(git_merge_file_input *input, unsigned int version)
 {
@@ -3363,10 +3365,12 @@ int git_merge_file_input_init(git_merge_file_input *input, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_merge_file_init_input(git_merge_file_input *input, unsigned int version)
 {
 	return git_merge_file_input_init(input, version);
 }
+#endif
 
 int git_merge_file_options_init(
 	git_merge_file_options *opts, unsigned int version)
@@ -3376,8 +3380,10 @@ int git_merge_file_options_init(
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_merge_file_init_options(
 	git_merge_file_options *opts, unsigned int version)
 {
 	return git_merge_file_options_init(opts, version);
 }
+#endif
diff --git a/src/merge_file.c b/src/merge_file.c
index 23daa84..755340f 100644
--- a/src/merge_file.c
+++ b/src/merge_file.c
@@ -28,7 +28,7 @@
 
 #define GIT_MERGE_FILE_SIDE_EXISTS(X)	((X)->mode != 0)
 
-int git_merge_file__input_from_index(
+static int merge_file_input_from_index(
 	git_merge_file_input *input_out,
 	git_odb_object **odb_object_out,
 	git_odb *odb,
@@ -276,17 +276,15 @@ int git_merge_file_from_index(
 		goto done;
 
 	if (ancestor) {
-		if ((error = git_merge_file__input_from_index(
+		if ((error = merge_file_input_from_index(
 			&ancestor_input, &odb_object[0], odb, ancestor)) < 0)
 			goto done;
 
 		ancestor_ptr = &ancestor_input;
 	}
 
-	if ((error = git_merge_file__input_from_index(
-			&our_input, &odb_object[1], odb, ours)) < 0 ||
-		(error = git_merge_file__input_from_index(
-			&their_input, &odb_object[2], odb, theirs)) < 0)
+	if ((error = merge_file_input_from_index(&our_input, &odb_object[1], odb, ours)) < 0 ||
+	    (error = merge_file_input_from_index(&their_input, &odb_object[2], odb, theirs)) < 0)
 		goto done;
 
 	error = merge_file__from_inputs(out,
diff --git a/src/odb.c b/src/odb.c
index 68d9a9a..90565b7 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -1510,10 +1510,12 @@ void *git_odb_backend_data_alloc(git_odb_backend *backend, size_t len)
 	return git__malloc(len);
 }
 
+#ifndef GIT_DEPRECATE_HARD
 void *git_odb_backend_malloc(git_odb_backend *backend, size_t len)
 {
 	return git_odb_backend_data_alloc(backend, len);
 }
+#endif
 
 void git_odb_backend_data_free(git_odb_backend *backend, void *data)
 {
diff --git a/src/oid.c b/src/oid.c
index 6419566..7831aca 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -253,10 +253,12 @@ int git_oid_is_zero(const git_oid *oid_a)
 	return 1;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_oid_iszero(const git_oid *oid_a)
 {
 	return git_oid_is_zero(oid_a);
 }
+#endif
 
 typedef short node_index;
 
diff --git a/src/pack-objects.c b/src/pack-objects.c
index 1ac618a..cf10e6c 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -1642,7 +1642,7 @@ static int mark_edges_uninteresting(git_packbuilder *pb, git_commit_list *commit
 	return 0;
 }
 
-int insert_tree(git_packbuilder *pb, git_tree *tree)
+static int pack_objects_insert_tree(git_packbuilder *pb, git_tree *tree)
 {
 	size_t i;
 	int error;
@@ -1669,7 +1669,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
 			if ((error = git_tree_lookup(&subtree, pb->repo, entry_id)) < 0)
 				return error;
 
-			error = insert_tree(pb, subtree);
+			error = pack_objects_insert_tree(pb, subtree);
 			git_tree_free(subtree);
 
 			if (error < 0)
@@ -1695,7 +1695,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
 	return error;
 }
 
-int insert_commit(git_packbuilder *pb, struct walk_object *obj)
+static int pack_objects_insert_commit(git_packbuilder *pb, struct walk_object *obj)
 {
 	int error;
 	git_commit *commit = NULL;
@@ -1712,7 +1712,7 @@ int insert_commit(git_packbuilder *pb, struct walk_object *obj)
 	if ((error = git_tree_lookup(&tree, pb->repo, git_commit_tree_id(commit))) < 0)
 		goto cleanup;
 
-	if ((error = insert_tree(pb, tree)) < 0)
+	if ((error = pack_objects_insert_tree(pb, tree)) < 0)
 		goto cleanup;
 
 cleanup:
@@ -1747,7 +1747,7 @@ int git_packbuilder_insert_walk(git_packbuilder *pb, git_revwalk *walk)
 		if (obj->seen || obj->uninteresting)
 			continue;
 
-		if ((error = insert_commit(pb, obj)) < 0)
+		if ((error = pack_objects_insert_commit(pb, obj)) < 0)
 			return error;
 	}
 
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 0e251cb..9185753 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -941,7 +941,7 @@ static int parse_patch_body(
 		return parse_patch_hunks(patch, ctx);
 }
 
-int check_header_names(
+static int check_header_names(
 	const char *one,
 	const char *two,
 	const char *old_or_new,
diff --git a/src/path.c b/src/path.c
index 625b95c..0d0b40f 100644
--- a/src/path.c
+++ b/src/path.c
@@ -322,7 +322,7 @@ int git_path_root(const char *path)
 	return -1;	/* Not a real error - signals that path is not rooted */
 }
 
-void git_path_trim_slashes(git_buf *path)
+static void path_trim_slashes(git_buf *path)
 {
 	int ceiling = git_path_root(path->ptr) + 1;
 	assert(ceiling >= 0);
@@ -1219,7 +1219,7 @@ int git_path_diriter_init(
 	if (git_buf_puts(&diriter->path_utf8, path) < 0)
 		return -1;
 
-	git_path_trim_slashes(&diriter->path_utf8);
+	path_trim_slashes(&diriter->path_utf8);
 
 	if (diriter->path_utf8.size == 0) {
 		git_error_set(GIT_ERROR_FILESYSTEM, "could not open directory '%s'", path);
@@ -1368,7 +1368,7 @@ int git_path_diriter_init(
 	if (git_buf_puts(&diriter->path, path) < 0)
 		return -1;
 
-	git_path_trim_slashes(&diriter->path);
+	path_trim_slashes(&diriter->path);
 
 	if (diriter->path.size == 0) {
 		git_error_set(GIT_ERROR_FILESYSTEM, "could not open directory '%s'", path);
diff --git a/src/pool.c b/src/pool.c
index baae918..cb98f1a 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -21,7 +21,7 @@ struct git_pool_page {
 
 static void *pool_alloc_page(git_pool *pool, size_t size);
 
-size_t git_pool__system_page_size(void)
+static size_t pool_system_page_size(void)
 {
 	static size_t size = 0;
 
@@ -44,7 +44,7 @@ int git_pool_init(git_pool *pool, size_t item_size)
 
 	memset(pool, 0, sizeof(git_pool));
 	pool->item_size = item_size;
-	pool->page_size = git_pool__system_page_size();
+	pool->page_size = pool_system_page_size();
 
 	return 0;
 }
diff --git a/src/proxy.c b/src/proxy.c
index 367c4b1..78a4c55 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -16,10 +16,12 @@ int git_proxy_options_init(git_proxy_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_proxy_init_options(git_proxy_options *opts, unsigned int version)
 {
 	return git_proxy_options_init(opts, version);
 }
+#endif
 
 int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
 {
diff --git a/src/push.c b/src/push.c
index 34867c2..b724188 100644
--- a/src/push.c
+++ b/src/push.c
@@ -555,7 +555,9 @@ int git_push_options_init(git_push_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_push_init_options(git_push_options *opts, unsigned int version)
 {
 	return git_push_options_init(opts, version);
 }
+#endif
diff --git a/src/rebase.c b/src/rebase.c
index 0a38807..7c65611 100644
--- a/src/rebase.c
+++ b/src/rebase.c
@@ -501,10 +501,12 @@ int git_rebase_options_init(git_rebase_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_rebase_init_options(git_rebase_options *opts, unsigned int version)
 {
 	return git_rebase_options_init(opts, version);
 }
+#endif
 
 static int rebase_ensure_not_in_progress(git_repository *repo)
 {
diff --git a/src/reflog.c b/src/reflog.c
index 24dada0..34537aa 100644
--- a/src/reflog.c
+++ b/src/reflog.c
@@ -12,12 +12,8 @@
 #include "signature.h"
 #include "refdb.h"
 
-#include <git2/sys/refdb_backend.h>
-
-git_reflog_entry *git_reflog_entry__alloc(void)
-{
-	return git__calloc(1, sizeof(git_reflog_entry));
-}
+#include "git2/sys/refdb_backend.h"
+#include "git2/sys/reflog.h"
 
 void git_reflog_entry__free(git_reflog_entry *entry)
 {
diff --git a/src/refs.c b/src/refs.c
index 633d83a..c5d69c1 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -480,7 +480,7 @@ static int reference__create(
 	return 0;
 }
 
-int configured_ident(git_signature **out, const git_repository *repo)
+static int refs_configured_ident(git_signature **out, const git_repository *repo)
 {
 	if (repo->ident_name && repo->ident_email)
 		return git_signature_now(out, repo->ident_name, repo->ident_email);
@@ -494,7 +494,7 @@ int git_reference__log_signature(git_signature **out, git_repository *repo)
 	int error;
 	git_signature *who;
 
-	if(((error = configured_ident(&who, repo)) < 0) &&
+	if(((error = refs_configured_ident(&who, repo)) < 0) &&
 	   ((error = git_signature_default(&who, repo)) < 0) &&
 	   ((error = git_signature_now(&who, "unknown", "unknown")) < 0))
 		return error;
diff --git a/src/refs.h b/src/refs.h
index adc345a..ece6646 100644
--- a/src/refs.h
+++ b/src/refs.h
@@ -90,6 +90,7 @@ int git_reference__is_valid_name(const char *refname, unsigned int flags);
 int git_reference__is_branch(const char *ref_name);
 int git_reference__is_remote(const char *ref_name);
 int git_reference__is_tag(const char *ref_name);
+int git_reference__is_note(const char *ref_name);
 const char *git_reference__shorthand(const char *name);
 
 /**
diff --git a/src/remote.c b/src/remote.c
index b0ccf03..23054c8 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -195,10 +195,12 @@ int git_remote_create_options_init(git_remote_create_options *opts, unsigned int
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_remote_create_init_options(git_remote_create_options *opts, unsigned int version)
 {
 	return git_remote_create_options_init(opts, version);
 }
+#endif
 
 int git_remote_create_with_opts(git_remote **out, const char *url, const git_remote_create_options *opts)
 {
@@ -686,7 +688,7 @@ int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int
 	return resolve_url(url_out, url, direction, callbacks);
 }
 
-int set_transport_callbacks(git_transport *t, const git_remote_callbacks *cbs)
+static int remote_transport_set_callbacks(git_transport *t, const git_remote_callbacks *cbs)
 {
 	if (!t->set_callbacks || !cbs)
 		return 0;
@@ -744,7 +746,7 @@ int git_remote__connect(git_remote *remote, git_direction direction, const git_r
 	if ((error = set_transport_custom_headers(t, conn->custom_headers)) != 0)
 		goto on_error;
 
-	if ((error = set_transport_callbacks(t, callbacks)) < 0 ||
+	if ((error = remote_transport_set_callbacks(t, callbacks)) < 0 ||
 	    (error = t->connect(t, url.ptr, credentials, payload, conn->proxy, direction, flags)) != 0)
 		goto on_error;
 
diff --git a/src/repository.c b/src/repository.c
index 5806155..5e818fb 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -2928,11 +2928,13 @@ int git_repository_init_options_init(
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_repository_init_init_options(
 	git_repository_init_options *opts, unsigned int version)
 {
 	return git_repository_init_options_init(opts, version);
 }
+#endif
 
 int git_repository_ident(const char **name, const char **email, const git_repository *repo)
 {
diff --git a/src/revert.c b/src/revert.c
index b41a2a1..b84bc7d 100644
--- a/src/revert.c
+++ b/src/revert.c
@@ -231,7 +231,9 @@ int git_revert_options_init(git_revert_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_revert_init_options(git_revert_options *opts, unsigned int version)
 {
 	return git_revert_options_init(opts, version);
 }
+#endif
diff --git a/src/revparse.c b/src/revparse.c
index c627de6..9e0790f 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -659,7 +659,7 @@ static int ensure_left_hand_identifier_is_not_known_yet(git_object *object, git_
 	return GIT_EINVALIDSPEC;
 }
 
-int revparse__ext(
+static int revparse(
 	git_object **object_out,
 	git_reference **reference_out,
 	size_t *identifier_len_out,
@@ -835,7 +835,7 @@ int git_revparse_ext(
 	git_object *obj = NULL;
 	git_reference *ref = NULL;
 
-	if ((error = revparse__ext(&obj, &ref, &identifier_len, repo, spec)) < 0)
+	if ((error = revparse(&obj, &ref, &identifier_len, repo, spec)) < 0)
 		goto cleanup;
 
 	*object_out = obj;
diff --git a/src/stash.c b/src/stash.c
index 790f56f..0d5dc43 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -776,10 +776,12 @@ int git_stash_apply_options_init(git_stash_apply_options *opts, unsigned int ver
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_stash_apply_init_options(git_stash_apply_options *opts, unsigned int version)
 {
 	return git_stash_apply_options_init(opts, version);
 }
+#endif
 
 #define NOTIFY_PROGRESS(opts, progress_type)				\
 	do {								\
diff --git a/src/status.c b/src/status.c
index 6a12844..eca1f49 100644
--- a/src/status.c
+++ b/src/status.c
@@ -548,10 +548,12 @@ int git_status_options_init(git_status_options *opts, unsigned int version)
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_status_init_options(git_status_options *opts, unsigned int version)
 {
 	return git_status_options_init(opts, version);
 }
+#endif
 
 int git_status_list_get_perfdata(
 	git_diff_perfdata *out, const git_status_list *status)
diff --git a/src/strarray.c b/src/strarray.c
index 7ad4134..54fe9fb 100644
--- a/src/strarray.c
+++ b/src/strarray.c
@@ -55,7 +55,9 @@ void git_strarray_dispose(git_strarray *array)
 	memset(array, 0, sizeof(*array));
 }
 
+#ifndef GIT_DEPRECATE_HARD
 void git_strarray_free(git_strarray *array)
 {
 	git_strarray_dispose(array);
 }
+#endif
diff --git a/src/streams/registry.c b/src/streams/registry.c
index 3300320..2844312 100644
--- a/src/streams/registry.c
+++ b/src/streams/registry.c
@@ -5,9 +5,10 @@
  * a Linking Exception. For full terms see the included COPYING file.
  */
 
-#include "git2/errors.h"
-
 #include "common.h"
+
+#include "streams/registry.h"
+
 #include "global.h"
 #include "streams/tls.h"
 #include "streams/mbedtls.h"
@@ -100,7 +101,7 @@ int git_stream_register(git_stream_t type, git_stream_registration *registration
 	return 0;
 }
 
-
+#ifndef GIT_DEPRECATE_HARD
 int git_stream_register_tls(
 	int GIT_CALLBACK(ctor)(git_stream **out, const char *host, const char *port))
 {
@@ -116,3 +117,4 @@ int git_stream_register_tls(
 		return git_stream_register(GIT_STREAM_TLS, NULL);
 	}
 }
+#endif
diff --git a/src/submodule.c b/src/submodule.c
index 1690e08..c32b977 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -958,7 +958,7 @@ cleanup:
 	return error;
 }
 
-const char *git_submodule_update_to_str(git_submodule_update_t update)
+static const char *submodule_update_to_str(git_submodule_update_t update)
 {
 	int i;
 	for (i = 0; i < (int)ARRAY_SIZE(_sm_update_map); ++i)
@@ -1240,10 +1240,12 @@ int git_submodule_update_options_init(git_submodule_update_options *opts, unsign
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version)
 {
 	return git_submodule_update_options_init(opts, version);
 }
+#endif
 
 int git_submodule_update(git_submodule *sm, int init, git_submodule_update_options *_update_options)
 {
@@ -1401,7 +1403,7 @@ int git_submodule_init(git_submodule *sm, int overwrite)
 	/* write "submodule.NAME.update" if not default */
 
 	val = (sm->update == GIT_SUBMODULE_UPDATE_CHECKOUT) ?
-		NULL : git_submodule_update_to_str(sm->update);
+		NULL : submodule_update_to_str(sm->update);
 
 	if ((error = git_buf_printf(&key, "submodule.%s.update", sm->name)) < 0 ||
 		(error = git_config__update_entry(
@@ -1838,7 +1840,7 @@ int git_submodule_parse_update(git_submodule_update_t *out, const char *value)
 	return 0;
 }
 
-int git_submodule_parse_recurse(git_submodule_recurse_t *out, const char *value)
+static int submodule_parse_recurse(git_submodule_recurse_t *out, const char *value)
 {
 	int val;
 
@@ -1934,7 +1936,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
 
 	if ((error = get_value(&value, cfg, &key, sm->name, "fetchRecurseSubmodules")) == 0) {
 		in_config = 1;
-		if ((error = git_submodule_parse_recurse(&sm->fetch_recurse, value)) < 0)
+		if ((error = submodule_parse_recurse(&sm->fetch_recurse, value)) < 0)
 			goto cleanup;
 		sm->fetch_recurse_default = sm->fetch_recurse;
 	} else if (error != GIT_ENOTFOUND) {
diff --git a/src/tag.c b/src/tag.c
index a7a005c..037dc66 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -524,7 +524,9 @@ int git_tag_peel(git_object **tag_target, const git_tag *tag)
 
 /* Deprecated Functions */
 
+#ifndef GIT_DEPRECATE_HARD
 int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *buffer, int allow_ref_overwrite)
 {
 	return git_tag_create_from_buffer(oid, repo, buffer, allow_ref_overwrite);
 }
+#endif
diff --git a/src/transports/credential.c b/src/transports/credential.c
index 0cf50a0..7b28364 100644
--- a/src/transports/credential.c
+++ b/src/transports/credential.c
@@ -391,6 +391,7 @@ void git_credential_free(git_credential *cred)
 
 /* Deprecated credential functions */
 
+#ifndef GIT_DEPRECATE_HARD
 int git_cred_has_username(git_credential *cred)
 {
 	return git_credential_has_username(cred);
@@ -474,3 +475,4 @@ void git_cred_free(git_credential *cred)
 {
 	git_credential_free(cred);
 }
+#endif
diff --git a/src/transports/credential_helpers.c b/src/transports/credential_helpers.c
index 6b975e1..6d34a4e 100644
--- a/src/transports/credential_helpers.c
+++ b/src/transports/credential_helpers.c
@@ -54,6 +54,7 @@ int git_credential_userpass(
 
 /* Deprecated credential functions */
 
+#ifndef GIT_DEPRECATE_HARD
 int git_cred_userpass(
 	git_credential **out,
 	const char *url,
@@ -64,3 +65,4 @@ int git_cred_userpass(
 	return git_credential_userpass(out, url, user_from_url,
 		allowed_types, payload);
 }
+#endif
diff --git a/src/transports/httpclient.c b/src/transports/httpclient.c
index 010baa6..dda2678 100644
--- a/src/transports/httpclient.c
+++ b/src/transports/httpclient.c
@@ -445,7 +445,7 @@ GIT_INLINE(int) client_write_request(git_http_client *client)
 				      0);
 }
 
-const char *name_for_method(git_http_method method)
+static const char *name_for_method(git_http_method method)
 {
 	switch (method) {
 	case GIT_HTTP_METHOD_GET:
diff --git a/src/util.c b/src/util.c
index c4e322d..2efb212 100644
--- a/src/util.c
+++ b/src/util.c
@@ -777,7 +777,7 @@ static const int8_t utf8proc_utf8class[256] = {
 	4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
-int git__utf8_charlen(const uint8_t *str, size_t str_len)
+static int util_utf8_charlen(const uint8_t *str, size_t str_len)
 {
 	size_t length, i;
 
@@ -802,7 +802,7 @@ int git__utf8_iterate(const uint8_t *str, int str_len, int32_t *dst)
 	int32_t uc = -1;
 
 	*dst = -1;
-	length = git__utf8_charlen(str, str_len);
+	length = util_utf8_charlen(str, str_len);
 	if (length < 0)
 		return -1;
 
@@ -839,7 +839,7 @@ size_t git__utf8_valid_buf_length(const uint8_t *str, size_t str_len)
 	size_t offset = 0;
 
 	while (offset < str_len) {
-		int length = git__utf8_charlen(str + offset, str_len - offset);
+		int length = util_utf8_charlen(str + offset, str_len - offset);
 
 		if (length < 0)
 			break;
diff --git a/src/win32/path_w32.c b/src/win32/path_w32.c
index 18b43e7..9faddcf 100644
--- a/src/win32/path_w32.c
+++ b/src/win32/path_w32.c
@@ -151,7 +151,7 @@ int git_win32_path_canonicalize(git_win32_path path)
 	return (int)(to - path);
 }
 
-int git_win32_path__cwd(wchar_t *out, size_t len)
+static int win32_path_cwd(wchar_t *out, size_t len)
 {
 	int cwd_len;
 
@@ -241,7 +241,7 @@ int git_win32_path_from_utf8(git_win32_path out, const char *src)
 	else {
 		int cwd_len;
 
-		if ((cwd_len = git_win32_path__cwd(dest, MAX_PATH)) < 0)
+		if ((cwd_len = win32_path_cwd(dest, MAX_PATH)) < 0)
 			goto on_error;
 
 		dest[cwd_len++] = L'\\';
diff --git a/src/worktree.c b/src/worktree.c
index 74b32f9..fda9b0b 100644
--- a/src/worktree.c
+++ b/src/worktree.c
@@ -271,11 +271,13 @@ int git_worktree_add_options_init(git_worktree_add_options *opts,
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_worktree_add_init_options(git_worktree_add_options *opts,
 	unsigned int version)
 {
 	return git_worktree_add_options_init(opts, version);
 }
+#endif
 
 int git_worktree_add(git_worktree **out, git_repository *repo,
 	const char *name, const char *worktree,
@@ -506,11 +508,13 @@ int git_worktree_prune_options_init(
 	return 0;
 }
 
+#ifndef GIT_DEPRECATE_HARD
 int git_worktree_prune_init_options(git_worktree_prune_options *opts,
 	unsigned int version)
 {
 	return git_worktree_prune_options_init(opts, version);
 }
+#endif
 
 int git_worktree_is_prunable(git_worktree *wt,
 	git_worktree_prune_options *opts)
diff --git a/tests/stream/deprecated.c b/tests/stream/deprecated.c
index 2c2bbfd..fecd1be 100644
--- a/tests/stream/deprecated.c
+++ b/tests/stream/deprecated.c
@@ -1,19 +1,18 @@
-#undef GIT_DEPRECATE_HARD
-
 #include "clar_libgit2.h"
 #include "git2/sys/stream.h"
 #include "streams/tls.h"
 #include "streams/socket.h"
 #include "stream.h"
 
-static git_stream test_stream;
-static int ctor_called;
-
 void test_stream_deprecated__cleanup(void)
 {
 	cl_git_pass(git_stream_register(GIT_STREAM_TLS | GIT_STREAM_STANDARD, NULL));
 }
 
+#ifndef GIT_DEPRECATE_HARD
+static git_stream test_stream;
+static int ctor_called;
+
 static int test_stream_init(git_stream **out, const char *host, const char *port)
 {
 	GIT_UNUSED(host);
@@ -24,9 +23,11 @@ static int test_stream_init(git_stream **out, const char *host, const char *port
 
 	return 0;
 }
+#endif
 
 void test_stream_deprecated__register_tls(void)
 {
+#ifndef GIT_DEPRECATE_HARD
 	git_stream *stream;
 	int error;
 
@@ -55,4 +56,5 @@ void test_stream_deprecated__register_tls(void)
 	cl_assert(&test_stream != stream);
 
 	git_stream_free(stream);
+#endif
 }