This repository has been archived by the owner on Dec 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
/
uGitForDelphi.pas
1589 lines (1434 loc) · 88.1 KB
/
uGitForDelphi.pas
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
unit uGitForDelphi;
interface
uses
SysUtils, Windows;
function InitLibgit2: Boolean;
const
// /** Size (in bytes) of a raw/binary oid */
// #define GIT_OID_RAWSZ 20
GIT_OID_RAWSZ = 20;
// /** Size (in bytes) of a hex formatted oid */
// #define GIT_OID_HEXSZ (GIT_OID_RAWSZ * 2)
GIT_OID_HEXSZ = (GIT_OID_RAWSZ * 2);
// #define GIT_OID_MINPREFIXLEN 4
GIT_OID_MINPREFIXLEN = 4;
// #define GIT_PACK_NAME_MAX (5 + 40 + 1)
GIT_PACK_NAME_MAX = (5 + 40 + 1);
// git_otype, enum with integer values
// typedef enum {
// GIT_OBJ_ANY = -2, /**< Object can be any of the following */
// GIT_OBJ_BAD = -1, /**< Object is invalid. */
// GIT_OBJ__EXT1 = 0, /**< Reserved for future use. */
// GIT_OBJ_COMMIT = 1, /**< A commit object. */
// GIT_OBJ_TREE = 2, /**< A tree (directory listing) object. */
// GIT_OBJ_BLOB = 3, /**< A file revision object. */
// GIT_OBJ_TAG = 4, /**< An annotated tag object. */
// GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */
// GIT_OBJ_OFS_DELTA = 6, /**< A delta, base is given by an offset. */
// GIT_OBJ_REF_DELTA = 7, /**< A delta, base is given by object id. */
// } git_otype;
GIT_OBJ_ANY = -2;
GIT_OBJ_BAD = -1;
GIT_OBJ__EXT1 = 0;
GIT_OBJ_COMMIT = 1;
GIT_OBJ_TREE = 2;
GIT_OBJ_BLOB = 3;
GIT_OBJ_TAG = 4;
GIT_OBJ__EXT2 = 5;
GIT_OBJ_OFS_DELTA = 6;
GIT_OBJ_REF_DELTA = 7;
// typedef enum {
// GIT_SUCCESS = 0,
// GIT_ERROR = -1,
//
// /** Input was not a properly formatted Git object id. */
// GIT_ENOTOID = -2,
//
// /** Input does not exist in the scope searched. */
// GIT_ENOTFOUND = -3,
//
// /** Not enough space available. */
// GIT_ENOMEM = -4,
//
// /** Consult the OS error information. */
// GIT_EOSERR = -5,
//
// /** The specified object is of invalid type */
// GIT_EOBJTYPE = -6,
//
// /** The specified repository is invalid */
// GIT_ENOTAREPO = -7,
//
// /** The object type is invalid or doesn't match */
// GIT_EINVALIDTYPE = -8,
//
// /** The object cannot be written because it's missing internal data */
// GIT_EMISSINGOBJDATA = -9,
//
// /** The packfile for the ODB is corrupted */
// GIT_EPACKCORRUPTED = -10,
//
// /** Failed to acquire or release a file lock */
// GIT_EFLOCKFAIL = -11,
//
// /** The Z library failed to inflate/deflate an object's data */
// GIT_EZLIB = -12,
//
// /** The queried object is currently busy */
// GIT_EBUSY = -13,
//
// /** The index file is not backed up by an existing repository */
// GIT_EBAREINDEX = -14,
//
// /** The name of the reference is not valid */
// GIT_EINVALIDREFNAME = -15,
//
// /** The specified reference has its data corrupted */
// GIT_EREFCORRUPTED = -16,
//
// /** The specified symbolic reference is too deeply nested */
// GIT_ETOONESTEDSYMREF = -17,
//
// /** The pack-refs file is either corrupted or its format is not currently supported */
// GIT_EPACKEDREFSCORRUPTED = -18,
//
// /** The path is invalid */
// GIT_EINVALIDPATH = -19,
//
// /** The revision walker is empty; there are no more commits left to iterate */
// GIT_EREVWALKOVER = -20,
//
// /** The state of the reference is not valid */
// GIT_EINVALIDREFSTATE = -21,
//
// /** This feature has not been implemented yet */
// GIT_ENOTIMPLEMENTED = -22,
//
// /** A reference with this name already exists */
// GIT_EEXISTS = -23,
//
// /** The given integer literal is too large to be parsed */
// GIT_EOVERFLOW = -24,
//
// /** The given literal is not a valid number */
// GIT_ENOTNUM = -25,
//
// /** Streaming error */
// GIT_ESTREAM = -26,
//
// /** invalid arguments to function */
// GIT_EINVALIDARGS = -27,
//
// /** The specified object has its data corrupted */
// GIT_EOBJCORRUPTED = -28,
//
// /** The given short oid is ambiguous */
// GIT_EAMBIGUOUSOIDPREFIX = -29,
//
// /** Skip and passthrough the given ODB backend */
// GIT_EPASSTHROUGH = -30,
//
// /** The path pattern and string did not match */
// GIT_ENOMATCH = -31,
//
// /** The buffer is too short to satisfy the request */
// GIT_ESHORTBUFFER = -32,
// } git_error;
GIT_SUCCESS = 0;
GIT_ERROR = -1;
GIT_ENOTOID = -2;
GIT_ENOTFOUND = -3;
GIT_ENOMEM = -4;
GIT_EOSERR = -5;
GIT_EOBJTYPE = -6;
GIT_ENOTAREPO = -7;
GIT_EINVALIDTYPE = -8;
GIT_EMISSINGOBJDATA = -9;
GIT_EPACKCORRUPTED = -10;
GIT_EFLOCKFAIL = -11;
GIT_EZLIB = -12;
GIT_EBUSY = -13;
GIT_EBAREINDEX = -14;
GIT_EINVALIDREFNAME = -15;
GIT_EREFCORRUPTED = -16;
GIT_ETOONESTEDSYMREF = -17;
GIT_EPACKEDREFSCORRUPTED = -18;
GIT_EINVALIDPATH = -19;
GIT_EREVWALKOVER = -20;
GIT_EINVALIDREFSTATE = -21;
GIT_ENOTIMPLEMENTED = -22;
GIT_EEXISTS = -23;
GIT_EOVERFLOW = -24;
GIT_ENOTNUM = -25;
GIT_ESTREAM = -26;
GIT_EINVALIDARGS = -27;
GIT_EOBJCORRUPTED = -28;
GIT_EAMBIGUOUSOIDPREFIX = -29;
GIT_EPASSTHROUGH = -30;
GIT_ENOMATCH = -31;
GIT_ESHORTBUFFER = -32;
//
// /**
// * Sort the repository contents in no particular ordering;
// * this sorting is arbitrary, implementation-specific
// * and subject to change at any time.
// * This is the default sorting for new walkers.
// */
// #define GIT_SORT_NONE (0)
//
// /**
// * Sort the repository contents in topological order
// * (parents before children); this sorting mode
// * can be combined with time sorting.
// */
// #define GIT_SORT_TOPOLOGICAL (1 << 0)
//
// /**
// * Sort the repository contents by commit time;
// * this sorting mode can be combined with
// * topological sorting.
// */
// #define GIT_SORT_TIME (1 << 1)
//
// /**
// * Iterate through the repository contents in reverse
// * order; this sorting mode can be combined with
// * any of the above.
// */
// #define GIT_SORT_REVERSE (1 << 2)
GIT_SORT_NONE = (0);
GIT_SORT_TOPOLOGICAL = (1 shl 0);
GIT_SORT_TIME = (1 shl 1);
GIT_SORT_REVERSE = (1 shl 2);
// /** Basic type of any Git reference. */
// typedef enum {
// GIT_REF_INVALID = 0, /** Invalid reference */
// GIT_REF_OID = 1, /** A reference which points at an object id */
// GIT_REF_SYMBOLIC = 2, /** A reference which points at another reference */
// GIT_REF_PACKED = 4,
// GIT_REF_HAS_PEEL = 8,
// GIT_REF_LISTALL = GIT_REF_OID|GIT_REF_SYMBOLIC|GIT_REF_PACKED,
// } git_rtype
GIT_REF_INVALID = 0;
GIT_REF_OID = 1;
GIT_REF_SYMBOLIC = 2;
GIT_REF_PACKED = 4;
GIT_REF_HAS_PEEL = 8;
GIT_REF_LISTALL = GIT_REF_OID or GIT_REF_SYMBOLIC or GIT_REF_PACKED;
// typedef enum {
// GIT_STREAM_RDONLY = (1 << 1),
// GIT_STREAM_WRONLY = (1 << 2),
// GIT_STREAM_RW = (GIT_STREAM_RDONLY | GIT_STREAM_WRONLY),
// } git_odb_streammode;
GIT_STREAM_RDONLY = (1 shl 1);
GIT_STREAM_WRONLY = (1 shl 2);
GIT_STREAM_RW = (GIT_STREAM_RDONLY or GIT_STREAM_WRONLY);
// #define GIT_IDXENTRY_UPDATE (1 << 0)
// #define GIT_IDXENTRY_REMOVE (1 << 1)
// #define GIT_IDXENTRY_UPTODATE (1 << 2)
// #define GIT_IDXENTRY_ADDED (1 << 3)
//
// #define GIT_IDXENTRY_HASHED (1 << 4)
// #define GIT_IDXENTRY_UNHASHED (1 << 5)
// #define GIT_IDXENTRY_WT_REMOVE (1 << 6) /* remove in work directory */
// #define GIT_IDXENTRY_CONFLICTED (1 << 7)
//
// #define GIT_IDXENTRY_UNPACKED (1 << 8)
// #define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
//
// /*
// * Extended on-disk flags:
// */
// #define GIT_IDXENTRY_INTENT_TO_ADD (1 << 13)
// #define GIT_IDXENTRY_SKIP_WORKTREE (1 << 14)
// /* GIT_IDXENTRY_EXTENDED2 is for future extension */
// #define GIT_IDXENTRY_EXTENDED2 (1 << 15)
//
// #define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE)
GIT_IDXENTRY_UPDATE = (1 shl 0);
GIT_IDXENTRY_REMOVE = (1 shl 1);
GIT_IDXENTRY_UPTODATE = (1 shl 2);
GIT_IDXENTRY_ADDED = (1 shl 3);
GIT_IDXENTRY_HASHED = (1 shl 4);
GIT_IDXENTRY_UNHASHED = (1 shl 5);
GIT_IDXENTRY_WT_REMOVE = (1 shl 6); //* remove in work directory */
GIT_IDXENTRY_CONFLICTED = (1 shl 7);
GIT_IDXENTRY_UNPACKED = (1 shl 8);
GIT_IDXENTRY_NEW_SKIP_WORKTREE = (1 shl 9);
// * Extended on-disk flags:
GIT_IDXENTRY_INTENT_TO_ADD = (1 shl 13);
GIT_IDXENTRY_SKIP_WORKTREE = (1 shl 14);
//* GIT_IDXENTRY_EXTENDED2 is for future extension */
GIT_IDXENTRY_EXTENDED2 = (1 shl 15);
GIT_IDXENTRY_EXTENDED_FLAGS = (GIT_IDXENTRY_INTENT_TO_ADD or GIT_IDXENTRY_SKIP_WORKTREE);
GIT_STATUS_CURRENT = 0;
//** Flags for index status */
GIT_STATUS_INDEX_NEW = (1 shl 0);
GIT_STATUS_INDEX_MODIFIED = (1 shl 1);
GIT_STATUS_INDEX_DELETED = (1 shl 2);
//** Flags for worktree status */
GIT_STATUS_WT_NEW = (1 shl 3);
GIT_STATUS_WT_MODIFIED = (1 shl 4);
GIT_STATUS_WT_DELETED = (1 shl 5);
GIT_STATUS_IGNORED = (1 shl 6);
GIT_HEAD_FILE: PAnsiChar = 'HEAD';
GIT_MERGE_HEAD_FILE: PAnsiChar = 'MERGE_HEAD';
GIT_DIR: PAnsiChar = '.git/';
GIT_INDEX_FILE: PAnsiChar = 'index';
GIT_OBJECTS_DIR: PAnsiChar = 'objects/';
GIT_REFS_HEADS_DIR: PAnsiChar = 'heads/';
GIT_PACKEDREFS_FILE: PAnsiChar = 'packed-refs';
GIT_REFS_TAGS_DIR: PAnsiChar = 'refs/tags/';
GIT_DIR_FETCH = 0;
GIT_DIR_PUSH = 1;
type
size_t = LongWord;
time_t = Int64;
off_t = Int64;
git_off_t = Int64; // typedef __int64 git_off_t;
git_time_t = Int64; // typedef __time64_t git_time_t;
PInt32_t = ^Int32;
PInt64_t = PInt64;
git_otype = Integer; // enum as constants above
git_rtype = Integer;
git_odb_streammode = Integer;
git_file = Integer;
// typedef struct {
// /** raw binary formatted id */
// unsigned char id[GIT_OID_RAWSZ];
// } git_oid;
git_oid = record
id: array[0..GIT_OID_RAWSZ-1] of Byte;
end;
PPByte = ^PByte;
Pgit_oid = ^git_oid;
PPgit_oid = ^Pgit_oid;
PPgit_odb = ^Pgit_odb;
PPgit_commit = ^Pgit_commit;
PPgit_index_entry = ^Pgit_index_entry;
Pgit_index_entry = ^git_index_entry;
PPgit_index_tree = ^Pgit_index_tree;
Pgit_signature = ^git_signature;
PPgit_tree_entry = ^Pgit_tree_entry;
Pgit_odb_backend = ^git_odb_backend;
Pgit_strarray = ^git_strarray;
Pgit_index_entry_unmerged = ^git_index_entry_unmerged;
Pgit_config_file = ^git_config_file;
// structs not translated because they should be internal details,
// and not necessary from GitForDelphi
Pgit_odb = Pointer;
Pgit_commit = Pointer;
Pgit_index = Pointer;
Pgit_index_tree = Pointer;
Pgit_object = Pointer;
Pgit_tree = Pointer;
Pgit_tag = Pointer;
Pgit_blob = Pointer;
Pgit_reference = Pointer;
Pgit_repository = Pointer;
Pgit_tree_entry = Pointer;
Pgit_rawobj = Pointer;
Pgit_odb_object = Pointer;
Pgit_odb_stream = Pointer;
Pgit_revwalk = Pointer;
Pgit_treebuilder = Pointer;
Pgit_config = Pointer;
Pgit_indexer = Pointer;
Pgit_indexer_stats= Pointer;
Pgit_reflog = Pointer;
Pgit_reflog_entry = Pointer;
Pgit_remote = Pointer;
Pgit_refspec = Pointer;
// typedef int (*git_vector_cmp)(const void *, const void *);
git_vector_cmp = Pointer;
// int (*callback)(const char *, void *)
git_reference_foreach_callback = function (const name: PAnsiChar; payload: PByte): Integer; stdcall;
Pgit_reference_foreach_callback = ^git_reference_foreach_callback;
// int (*callback)(const char *, unsigned int, void *)
git_status_foreach_callback = function (const name: PAnsiChar; flags: UInt; payload: PByte): Integer; stdcall;
Pgit_status_foreach_callback = ^git_status_foreach_callback;
// typedef int (*git_treewalk_cb)(const char *root, git_tree_entry *entry, void *payload);
git_treewalk_cb = function(root: PAnsiChar; entry: Pgit_tree_entry; payload: PByte): Integer; stdcall;
Pgit_treewalk_cb = ^git_treewalk_cb;
// struct git_remote_head {
// int local:1; /* available locally */
// git_oid oid;
// git_oid loid;
// char *name;
// };
git_remote_head = record
local: Integer;
oid: git_oid;
loid: git_oid;
name: PAnsiChar;
end;
Pgit_remote_head = ^git_remote_head;
// typedef int (*git_headlist_cb)(git_remote_head *, void *);
git_headlist_cb = function (head: Pgit_remote_head; payload: PByte): Integer; stdcall;
Pgit_headlist_cb = ^git_headlist_cb;
// struct git_odb_backend {
// git_odb *odb;
//
// int (* read)(
// void **, size_t *, git_otype *,
// struct git_odb_backend *,
// const git_oid *);
//
// /* To find a unique object given a prefix
// * of its oid.
// * The oid given must be so that the
// * remaining (GIT_OID_HEXSZ - len)*4 bits
// * are 0s.
// */
// int (* read_prefix)(
// git_oid *,
// void **, size_t *, git_otype *,
// struct git_odb_backend *,
// const git_oid *,
// unsigned int);
//
// int (* read_header)(
// size_t *, git_otype *,
// struct git_odb_backend *,
// const git_oid *);
//
// int (* write)(
// git_oid *,
// struct git_odb_backend *,
// const void *,
// size_t,
// git_otype);
//
// int (* writestream)(
// struct git_odb_stream **,
// struct git_odb_backend *,
// size_t,
// git_otype);
//
// int (* readstream)(
// struct git_odb_stream **,
// struct git_odb_backend *,
// const git_oid *);
//
// int (* exists)(
// struct git_odb_backend *,
// const git_oid *);
//
// void (* free)(struct git_odb_backend *);
// };
git_odb_backend_read = function (var buffer_p: PByte; var len_p: size_t; var type_p: git_otype; backend: Pgit_odb_backend; const oid: Pgit_oid ): Integer; stdcall;
git_odb_backend_read_prefix = function (id: Pgit_oid; var buffer_p: PByte; var len_p: size_t; var type_p: git_otype; backend: Pgit_odb_backend; const short_oid: Pgit_oid; len: UInt): Integer; stdcall;
git_odb_backend_read_header = function (var len_p: size_t; var type_p: git_otype; backend: Pgit_odb_backend; const oid: Pgit_oid ): Integer; stdcall;
git_odb_backend_write = function (id: Pgit_oid; backend: Pgit_odb_backend; const data: PByte; len: size_t; type_: git_otype): Integer; stdcall;
git_odb_backend_writestream = function (var stream_out: Pgit_odb_stream; backend: Pgit_odb_backend; length: size_t; type_: git_otype): Integer; stdcall;
git_odb_backend_readstream = function (var stream_out: Pgit_odb_stream; backend: Pgit_odb_backend; const oid: Pgit_oid): Integer; stdcall;
git_odb_backend_exists = function (backend: Pgit_odb_backend; const oid: Pgit_oid): Integer; stdcall;
git_odb_backend_free = procedure (backend: Pgit_odb_backend); stdcall;
git_odb_backend = record
odb: Pgit_odb;
read: ^git_odb_backend_read;
read_prefix: ^git_odb_backend_read_prefix;
read_header: ^git_odb_backend_read_header;
write: ^git_odb_backend_write;
writestream: ^git_odb_backend_writestream;
readstream: ^git_odb_backend_readstream;
exists: ^git_odb_backend_exists;
free: ^git_odb_backend_free;
end;
// typedef struct {
// git_time_t seconds;
// /* nsec should not be stored as time_t compatible */
// unsigned int nanoseconds;
// } git_index_time;
git_index_time = record
seconds: git_time_t;
nanoseconds: UInt;
end;
// typedef struct git_index_entry {
// git_index_time ctime;
// git_index_time mtime;
//
// unsigned int dev;
// unsigned int ino;
// unsigned int mode;
// unsigned int uid;
// unsigned int gid;
// git_off_t file_size;
//
// git_oid oid;
//
// unsigned short flags;
// unsigned short flags_extended;
//
// const char *path;
// } git_index_entry;
git_index_entry = record
ctime: git_index_time;
mtime: git_index_time;
dev: UInt;
ino: UInt;
mode: UInt;
uid: UInt;
gid: UInt;
file_size: git_off_t;
oid: git_oid;
flags: SHORT;
flags_extended: SHORT;
path: PAnsiChar;
end;
// typedef struct git_index_entry_unmerged {
// unsigned int mode[3];
// git_oid oid[3];
// char *path;
// } git_index_entry_unmerged;
git_index_entry_unmerged = record
mode: array [0..2] of UInt;
oid: array [0..2] of git_oid;
path: PAnsiChar;
end;
// typedef struct {
// volatile int val;
// } git_atomic;
git_atomic = record
val: Integer;
end;
// typedef struct {
// git_oid oid;
// git_atomic refcount;
// } git_cached_obj;
git_cached_obj = record
oid: git_oid;
refcount: git_atomic;
end;
// /** Time in a signature */
// typedef struct git_time {
// time_t time; /** time in seconds from epoch */
// int offset; /** timezone offset, in minutes */
// } git_time;
git_time = record
time: time_t;
offset: Integer;
end;
// /** An action signature (e.g. for committers, taggers, etc) */
// typedef struct git_signature {
// char *name; /** full name of the author */
// char *email; /** email of the author */
// git_time when; /** time when the action happened */
// } git_signature;
git_signature = record
name: PAnsiChar;
email: PAnsiChar;
when: git_time;
end;
// typedef struct {
// char **strings;
// size_t count;
// } git_strarray;
git_strarray = record
strings: PPAnsiChar;
count: size_t;
end;
Pgit_treebuilder_filter_filter = ^git_treebuilder_filter_filter;
git_treebuilder_filter_filter = function (const entry: Pgit_tree_entry; payload: PByte): Integer; stdcall;
Pgit_config_file_foreach_callback = ^git_config_file_foreach_callback;
git_config_file_foreach_callback = function (const key, value: PAnsiChar; data: PByte): Integer; stdcall;
Pgit_config_file_open = ^git_config_file_open;
Pgit_config_file_get = ^git_config_file_get;
Pgit_config_file_set = ^git_config_file_set;
Pgit_config_file_del = ^git_config_file_del;
Pgit_config_file_foreach = ^git_config_file_foreach;
Pgit_config_file_free = ^git_config_file_free;
git_config_file_open = function (f: Pgit_config_file): Integer; stdcall;
git_config_file_get = function (f: Pgit_config_file; const key: PAnsiChar; out value: PAnsiChar): Integer; stdcall;
git_config_file_set = function (f: Pgit_config_file; const key, value: PAnsiChar): Integer; stdcall;
git_config_file_del = function (f: Pgit_config_file; const key: PAnsiChar): Integer; stdcall;
git_config_file_foreach = function (f: Pgit_config_file; fn: Pgit_config_file_foreach_callback; data: PByte): Integer; stdcall;
git_config_file_free = function (f: Pgit_config_file): Integer; stdcall;
// struct git_config_file {
// struct git_config *cfg;
//
// /* Open means open the file/database and parse if necessary */
// int (*open)(struct git_config_file *);
// int (*get)(struct git_config_file *, const char *key, const char **value);
// int (*set)(struct git_config_file *, const char *key, const char *value);
// int (*del)(struct git_config_file *, const char *key);
// int (*foreach)(struct git_config_file *, int (*fn)(const char *, void *), void *data);
// void (*free)(struct git_config_file *);
// };
git_config_file = record
cfg: Pgit_config;
open: Pgit_config_file_open;
get: Pgit_config_file_get;
set_: Pgit_config_file_set;
del: Pgit_config_file_del;
foreach: Pgit_config_file_foreach;
free: Pgit_config_file_free;
end;
// int (*callback)(const char *var_name, const char *value, void *payload)
Pgit_config_foreach_callback = ^git_config_foreach_callback;
git_config_foreach_callback = function (const key, value: PAnsiChar; payload: PByte): Integer; stdcall;
// int (*callback)(const char *name, const char *value, void *payload)
Pgit_attr_foreach_callback = ^git_attr_foreach_callback;
git_attr_foreach_callback = function (name, value: PAnsiChar; payload: PByte): Integer; stdcall;
// typedef enum {
// GIT_REPO_PATH,
// GIT_REPO_PATH_INDEX,
// GIT_REPO_PATH_ODB,
// GIT_REPO_PATH_WORKDIR
// } git_repository_pathid;
const
GIT_REPO_PATH = 0;
GIT_REPO_PATH_INDEX = 1;
GIT_REPO_PATH_ODB = 2;
GIT_REPO_PATH_WORKDIR = 3;
type
git_repository_pathid = Integer;
var
/// attr.h
/// Attribute management
// GIT_EXTERN(const char *)git_attr__true;
git_attr__true: function (): PAnsiChar; stdcall;
// GIT_EXTERN(const char *)git_attr__false;
git_attr__false: function (): PAnsiChar; stdcall;
// GIT_EXTERN(int) git_attr_get(git_repository *repo, const char *path, const char *name, const char **value);
git_attr_get: function (repo: Pgit_repository; path, name: PAnsiChar; var value: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_attr_get_many(git_repository *repo, const char *path, size_t num_attr, const char **names, const char **values);
git_attr_get_many: function (repo: Pgit_repository; path: PAnsiChar; num_attr: size_t; names: PPAnsiChar; var values: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_attr_foreach(git_repository *repo, const char *path, int (*callback)(const char *name, const char *value, void *payload), void *payload);
git_attr_foreach: function (repo: Pgit_repository; path: PAnsiChar; callback: Pgit_attr_foreach_callback; payload: PByte): Integer; stdcall;
// GIT_EXTERN(void) git_attr_cache_flush(git_repository *repo);
git_attr_cache_flush: procedure (repo: Pgit_repository); stdcall;
// GIT_EXTERN(int) git_attr_add_macro(git_repository *repo, const char *name, const char *values);
git_attr_add_macro: function (repo: Pgit_repository; name, values: PAnsiChar): Integer; stdcall;
/// blob.h
///
// GIT_EXTERN(const void *) git_blob_rawcontent(git_blob *blob);
git_blob_rawcontent: function (blob: Pgit_blob): PByte; stdcall;
// GIT_EXTERN(size_t) git_blob_rawsize(git_blob *blob);
git_blob_rawsize: function (blob: Pgit_blob): size_t; stdcall;
// GIT_EXTERN(int) git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *path);
git_blob_create_fromfile: function (oid: Pgit_oid; repo: Pgit_repository; const path: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_blob_create_frombuffer(git_oid *oid, git_repository *repo, const void *buffer, size_t len);
git_blob_create_frombuffer: function (oid: Pgit_oid; repo: Pgit_repository; const buffer: PByte; len: size_t): Integer; stdcall;
/// commit.h
///
// GIT_EXTERN(const git_oid *) git_commit_id(git_commit *commit);
git_commit_id: function (commit: Pgit_commit): Pgit_oid; stdcall;
// GIT_EXTERN(const char *) git_commit_message_encoding(git_commit *commit);
git_commit_message_encoding: function (commit: Pgit_commit): PAnsiChar; stdcall;
// GIT_EXTERN(const char *) git_commit_message(git_commit *commit);
git_commit_message: function (commit: Pgit_commit): PAnsiChar; stdcall;
// GIT_EXTERN(git_time_t) git_commit_time(git_commit *commit);
git_commit_time: function (commit: Pgit_commit): git_time_t; stdcall;
// GIT_EXTERN(int) git_commit_time_offset(git_commit *commit);
git_commit_time_offset: function (commit: Pgit_commit): Integer; stdcall;
// GIT_EXTERN(const git_signature *) git_commit_committer(git_commit *commit);
git_commit_committer: function (commit: Pgit_commit): Pgit_signature; stdcall;
// GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit);
git_commit_author: function (commit: Pgit_commit): Pgit_signature; stdcall;
// GIT_EXTERN(int) git_commit_tree(git_tree **tree_out, git_commit *commit);
git_commit_tree: function (var tree_out: Pgit_tree; commit: Pgit_commit): Integer; stdcall;
// GIT_EXTERN(const git_oid *) git_commit_tree_oid(git_commit *commit);
git_commit_tree_oid: function (commit: Pgit_commit): Pgit_oid; stdcall;
// GIT_EXTERN(unsigned int) git_commit_parentcount(git_commit *commit);
git_commit_parentcount: function (commit: Pgit_commit): UInt; stdcall;
// GIT_EXTERN(int) git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n);
git_commit_parent: function (var parent: Pgit_commit; commit: Pgit_commit; n: UInt): Integer; stdcall;
// GIT_EXTERN(const git_oid *) git_commit_parent_oid(git_commit *commit, unsigned int n);
git_commit_parent_oid: function (commit: Pgit_commit; n: UInt): Pgit_oid; stdcall;
// GIT_EXTERN(int) git_commit_create(git_oid *oid, git_repository *repo, const char *update_ref, const git_signature *author, const git_signature *committer, const char *message_encoding, const char *message, const git_tree *tree, int parent_count, const git_commit *parents[]);
git_commit_create: function (oid: Pgit_oid; repo: Pgit_repository; const update_ref: PAnsiChar; const author, committer: Pgit_signature; const message_encoding, message_: PAnsiChar; const tree: Pgit_tree; parent_count: Integer; const parents: PPgit_commit): Integer; stdcall;
// GIT_EXTERN(int) git_commit_create_v(git_oid *oid, git_repository *repo, const char *update_ref, const git_signature *author, const git_signature *committer, const char *message_encoding, const char *message, const git_tree *tree, int parent_count, ...);
git_commit_create_v: function (oid: Pgit_oid; repo: Pgit_repository; const update_ref: PAnsiChar; const author, committer: Pgit_signature; const message_encoding, message_: PAnsiChar; const tree: Pgit_tree; parent_count: Integer): Integer; cdecl varargs; // varargs has to be cdecl
/// common.h
///
// GIT_EXTERN(void) git_strarray_free(git_strarray *array);
git_strarray_free: procedure (array_: Pgit_strarray); stdcall;
// GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
git_libgit2_version: procedure (out major, minor, rev: Integer); stdcall;
/// config.h
///
// GIT_EXTERN(int) git_config_find_global(char *global_config_path);
git_config_find_global: function (global_config_path: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_config_find_system(char *system_config_path);
git_config_find_system: function (system_config_path: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_config_open_global(git_config **out);
git_config_open_global: function (var out_: Pgit_config): Integer; stdcall;
// GIT_EXTERN(int) git_config_file__ondisk(struct git_config_file **out, const char *path);
git_config_file__ondisk: function (var out_: Pgit_config_file; const path: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_config_new(git_config **out);
git_config_new: function (var out_: Pgit_config): Integer; stdcall;
// GIT_EXTERN(int) git_config_add_file(git_config *cfg, git_config_file *file, int priority);
git_config_add_file: function (cfg: Pgit_config; file_: Pgit_config_file; priority: Integer): Integer; stdcall;
// GIT_EXTERN(int) git_config_add_file_ondisk(git_config *cfg, const char *path, int priority);
git_config_add_file_ondisk: function (cfg: Pgit_config; const path: PAnsiChar; priority: Integer): Integer; stdcall;
// GIT_EXTERN(int) git_config_open_ondisk(git_config **cfg, const char *path);
git_config_open_ondisk: function (out cfg: Pgit_config; const path: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(void) git_config_free(git_config *cfg);
git_config_free: procedure (cfg: Pgit_config); stdcall;
// GIT_EXTERN(int) git_config_get_int32(git_config *cfg, const char *name, int32_t *out);
git_config_get_int32: function (cfg: Pgit_config; name: PAnsiChar; out_: PInt32_t): Integer; stdcall;
// GIT_EXTERN(int) git_config_get_int64(git_config *cfg, const char *name, int64_t *out);
git_config_get_int64: function (cfg: Pgit_config; name: PAnsiChar; out_: PInt64_t): Integer; stdcall;
// GIT_EXTERN(int) git_config_get_bool(git_config *cfg, const char *name, int *out);
git_config_get_bool: function (cfg: Pgit_config; const name: PAnsiChar; var out_: Integer): Integer; stdcall;
// GIT_EXTERN(int) git_config_get_string(git_config *cfg, const char *name, const char **out);
git_config_get_string: function (cfg: Pgit_config; const name: PAnsiChar; var out_: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_config_set_int32(git_config *cfg, const char *name, int32_t value);
git_config_set_int32: function (cfg: Pgit_config; name: PAnsiChar; value: Int32): Integer; stdcall;
// GIT_EXTERN(int) git_config_set_int64(git_config *cfg, const char *name, int64_t value);
git_config_set_int64: function (cfg: Pgit_config; name: PAnsiChar; value: Int64): Integer; stdcall;
// GIT_EXTERN(int) git_config_set_bool(git_config *cfg, const char *name, int value);
git_config_set_bool: function (cfg: Pgit_config; const name: PAnsiChar; value: Integer): Integer; stdcall;
// GIT_EXTERN(int) git_config_set_string(git_config *cfg, const char *name, const char *value);
git_config_set_string: function (cfg: Pgit_config; const name: PAnsiChar; const value: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_config_delete(git_config *cfg, const char *name);
git_config_delete: function (cfg: Pgit_config; name: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_config_foreach(git_config *cfg, int (*callback)(const char *var_name, const char *value, void *payload), void *payload);
git_config_foreach: function (cfg: Pgit_config; callback: Pgit_config_foreach_callback; payload: PByte): Integer; stdcall;
/// errors.h
///
// GIT_EXTERN(const char *) git_lasterror(void);
git_lasterror: function: PAnsiChar; stdcall;
// GIT_EXTERN(const char *) git_strerror(int num);
git_strerror: function (num: Integer): PAnsiChar; stdcall;
// GIT_EXTERN(void) git_clearerror(void);
git_clearerror: procedure; stdcall;
/// index.h
///
// GIT_EXTERN(int) git_index_open(git_index **index, const char *index_path);
git_index_open: function (var index: Pgit_index; const index_path: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(void) git_index_clear(git_index *index);
git_index_clear: procedure (index: Pgit_index); stdcall;
// GIT_EXTERN(void) git_index_free(git_index *index);
git_index_free: procedure (index: Pgit_index); stdcall;
// GIT_EXTERN(int) git_index_read(git_index *index);
git_index_read: function (index: Pgit_index): Integer; stdcall;
// GIT_EXTERN(int) git_index_write(git_index *index);
git_index_write: function (index: Pgit_index): Integer; stdcall;
// GIT_EXTERN(int) git_index_find(git_index *index, const char *path);
git_index_find: function (index: Pgit_index; const path: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(void) git_index_uniq(git_index *index);
git_index_uniq: procedure (index: Pgit_index); stdcall;
// GIT_EXTERN(int) git_index_add(git_index *index, const char *path, int stage);
git_index_add: function (index: Pgit_index; const path: PAnsiChar; stage: Integer): Integer; stdcall;
// GIT_EXTERN(int) git_index_add2(git_index *index, const git_index_entry *source_entry);
git_index_add2: function (index: Pgit_index; const source_entry: Pgit_index_entry): Integer; stdcall;
// GIT_EXTERN(int) git_index_append(git_index *index, const char *path, int stage);
git_index_append: function (index: Pgit_index; const path: PAnsiChar; stage: Integer): Integer; stdcall;
// GIT_EXTERN(int) git_index_append2(git_index *index, const git_index_entry *source_entry);
git_index_append2: function (index: Pgit_index; const source_entry: Pgit_index_entry): Integer; stdcall;
// GIT_EXTERN(int) git_index_remove(git_index *index, int position);
git_index_remove: function (index: Pgit_index; position: Integer): Integer; stdcall;
// GIT_EXTERN(git_index_entry *) git_index_get(git_index *index, unsigned int n);
git_index_get: function (index: Pgit_index; n: UInt): Pgit_index_entry; stdcall;
// GIT_EXTERN(unsigned int) git_index_entrycount(git_index *index);
git_index_entrycount: function (index: Pgit_index): UInt; stdcall;
// GIT_EXTERN(unsigned int) git_index_entrycount_unmerged(git_index *index);
git_index_entrycount_unmerged: function (index: Pgit_index): UInt; stdcall;
// GIT_EXTERN(const git_index_entry_unmerged *) git_index_get_unmerged_bypath(git_index *index, const char *path);
git_index_get_unmerged_bypath: function (index: Pgit_index; const path: PAnsiChar): Pgit_index_entry_unmerged; stdcall;
// GIT_EXTERN(const git_index_entry_unmerged *) git_index_get_unmerged_byindex(git_index *index, unsigned int n);
git_index_get_unmerged_byindex: function (index: Pgit_index; n: UInt): Pgit_index_entry_unmerged; stdcall;
// GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
git_index_entry_stage: function (const entry: Pgit_index_entry): Integer; stdcall;
// GIT_EXTERN(int) git_index_read_tree(git_index *index, git_tree *tree);
git_index_read_tree: function (index: Pgit_index; tree: Pgit_tree): Integer; stdcall;
/// indexer.h
///
// GIT_EXTERN(int) git_indexer_new(git_indexer **out, const char *packname);
git_indexer_new: function (var out_: Pgit_indexer; packname: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_indexer_run(git_indexer *idx, git_indexer_stats *stats);
git_indexer_run: function (idx: Pgit_indexer; stats: Pgit_indexer_stats): Integer; stdcall;
// GIT_EXTERN(int) git_indexer_write(git_indexer *idx);
git_indexer_write: function (idx: Pgit_indexer): Integer; stdcall;
// GIT_EXTERN(const git_oid *) git_indexer_hash(git_indexer *idx);
git_indexer_hash: function (idx: Pgit_indexer): Pgit_oid; stdcall;
// GIT_EXTERN(void) git_indexer_free(git_indexer *idx);
git_indexer_free: procedure (idx: Pgit_indexer); stdcall;
/// object.h
///
// GIT_EXTERN(int) git_object_lookup(git_object **object, git_repository *repo, const git_oid *id, git_otype type);
git_object_lookup: function (var object_: Pgit_object; repo: Pgit_repository; const id: Pgit_oid; type_: git_otype): Integer; stdcall;
// GIT_EXTERN(int) git_object_lookup_prefix(git_object **object_out, git_repository *repo, const git_oid *id, unsigned int len, git_otype type);
git_object_lookup_prefix: function (var object_out: Pgit_object; repo: Pgit_repository; const id: Pgit_oid; len: UInt; type_: git_otype): Integer; stdcall;
// GIT_EXTERN(const git_oid *) git_object_id(const git_object *obj);
git_object_id: function (obj: Pgit_object): Pgit_oid; stdcall;
// GIT_EXTERN(git_otype) git_object_type(const git_object *obj);
git_object_type: function(obj: Pgit_object): git_otype; stdcall;
// GIT_EXTERN(git_repository *) git_object_owner(const git_object *obj);
git_object_owner: function (obj: Pgit_object): Pgit_repository; stdcall;
// GIT_EXTERN(void) git_object_free(git_object *object);
git_object_free: procedure (object_: Pgit_object); stdcall;
// GIT_EXTERN(const char *) git_object_type2string(git_otype type);
git_object_type2string: function (type_: git_otype): PAnsiChar; stdcall;
// GIT_EXTERN(git_otype) git_object_string2type(const char *str);
git_object_string2type: function (const str: PAnsiChar): git_otype; stdcall;
// GIT_EXTERN(int) git_object_typeisloose(git_otype type);
git_object_typeisloose: function (type_: git_otype): Integer; stdcall;
// GIT_EXTERN(size_t) git_object__size(git_otype type);
git_object__size: function (type_: git_otype): size_t; stdcall;
/// odb.h
///
// GIT_EXTERN(int) git_odb_new(git_odb **out);
git_odb_new: function (var out_: Pgit_odb): Integer; stdcall;
// GIT_EXTERN(int) git_odb_open(git_odb **out, const char *objects_dir);
git_odb_open: function (var out_: Pgit_odb; const objects_dir: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_odb_add_backend(git_odb *odb, git_odb_backend *backend, int priority);
git_odb_add_backend: function (odb: Pgit_odb; backend: Pgit_odb_backend; priority: Integer): Integer; stdcall;
// GIT_EXTERN(int) git_odb_add_alternate(git_odb *odb, git_odb_backend *backend, int priority);
git_odb_add_alternate: function (odb: Pgit_odb; backend: Pgit_odb_backend; priority: Integer): Integer; stdcall;
// GIT_EXTERN(void) git_odb_free(git_odb *db);
git_odb_free: procedure (db: Pgit_odb); stdcall;
// GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id);
git_odb_read: function (var out_: Pgit_odb_object; db: Pgit_odb; const id: Pgit_oid): Integer; stdcall;
// GIT_EXTERN(int) git_odb_read_prefix(git_odb_object **out, git_odb *db, const git_oid *short_id, unsigned int len);
git_odb_read_prefix: function (var out_: Pgit_odb_object; db: Pgit_odb; const short_id: Pgit_oid; len: UInt): Integer; stdcall;
// GIT_EXTERN(int) git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id);
git_odb_read_header: function (var len_p: size_t; var type_p: git_otype; db: Pgit_odb; const id: Pgit_oid): Integer; stdcall;
// GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id);
git_odb_exists: function (db: Pgit_odb; const id: Pgit_oid): Integer; stdcall;
// GIT_EXTERN(int) git_odb_write(git_oid *oid, git_odb *odb, const void *data, size_t len, git_otype type);
git_odb_write: function (oid: Pgit_oid; odb: Pgit_odb; const data: PByte; len: size_t; type_: git_otype): Integer; stdcall;
// GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **stream, git_odb *db, size_t size, git_otype type);
git_odb_open_wstream: function (var stream: Pgit_odb_stream; db: Pgit_odb; size: size_t; type_: git_otype): Integer; stdcall;
// GIT_EXTERN(int) git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const git_oid *oid);
git_odb_open_rstream: function (var stream: Pgit_odb_stream; db: Pgit_odb; const oid: Pgit_oid): Integer; stdcall;
// GIT_EXTERN(int) git_odb_hash(git_oid *id, const void *data, size_t len, git_otype type);
git_odb_hash: function (id: Pgit_oid; const data: PByte; len: size_t; type_: git_otype): Integer; stdcall;
// GIT_EXTERN(int) git_odb_hashfile(git_oid *out, const char *path, git_otype type);
git_odb_hashfile: function (out_: Pgit_oid; path: PAnsiChar; type_: git_otype): Integer; stdcall;
// GIT_EXTERN(void) git_odb_object_free(git_odb_object *object);
git_odb_object_free: procedure (object_: Pgit_odb_object); stdcall;
// GIT_EXTERN(const git_oid *) git_odb_object_id(git_odb_object *object);
git_odb_object_id: function (object_: Pgit_odb_object): Pgit_oid; stdcall;
// GIT_EXTERN(const void *) git_odb_object_data(git_odb_object *object);
git_odb_object_data: function (object_: Pgit_odb_object): PByte; stdcall;
// GIT_EXTERN(size_t) git_odb_object_size(git_odb_object *object);
git_odb_object_size: function (object_: Pgit_odb_object): size_t; stdcall;
// GIT_EXTERN(git_otype) git_odb_object_type(git_odb_object *object);
git_odb_object_type: function (object_: Pgit_odb_object): git_otype; stdcall;
/// odb_backend.h
///
// GIT_EXTERN(int) git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir);
git_odb_backend_pack: function (var backend_out: Pgit_odb_backend; const objects_dir: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_odb_backend_loose(git_odb_backend **backend_out, const char *objects_dir, int compression_level, int do_fsync);
git_odb_backend_loose: function (var backend_out: Pgit_odb_backend; const objects_dir: PAnsiChar; compression_leve: Integer; do_fsync: Integer): Integer; stdcall;
/// oid.h
///
// GIT_EXTERN(int) git_oid_fromstr(git_oid *out, const char *str);
git_oid_fromstr: function (aOut: Pgit_oid; aStr: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_oid_fromstrn(git_oid *out, const char *str, size_t length);
git_oid_fromstrn: function (out_: Pgit_oid; str: PAnsiChar; length: size_t): Integer; stdcall;
// GIT_EXTERN(void) git_oid_fromraw(git_oid *out, const unsigned char *raw);
git_oid_fromraw: procedure (out_: Pgit_oid; const raw: PByte); stdcall;
// GIT_EXTERN(void) git_oid_fmt(char *str, const git_oid *oid);
git_oid_fmt: procedure (aStr: PAnsiChar; const oid: Pgit_oid); stdcall;
// GIT_EXTERN(void) git_oid_pathfmt(char *str, const git_oid *oid);
git_oid_pathfmt: procedure (aStr: PAnsiChar; const oid: Pgit_oid); stdcall;
// GIT_EXTERN(char *) git_oid_allocfmt(const git_oid *oid);
git_oid_allocfmt: function (const oid: Pgit_oid): PAnsiChar; stdcall;
// GIT_EXTERN(char *) git_oid_to_string(char *out, size_t n, const git_oid *oid);
git_oid_to_string: function (out_: PAnsiChar; n: size_t; const oid: Pgit_oid): PAnsiChar; stdcall;
// GIT_EXTERN(void) git_oid_cpy(git_oid *out, const git_oid *src);
git_oid_cpy: procedure (out_: Pgit_oid; const src: Pgit_oid); stdcall;
// GIT_EXTERN(int) git_oid_cmp(const git_oid *a, const git_oid *b);
git_oid_cmp: function (const a, b: Pgit_oid): Integer; stdcall;
// GIT_EXTERN(int) git_oid_ncmp(const git_oid *a, const git_oid *b, unsigned int len);
git_oid_ncmp: function (const a, b: Pgit_oid; len: UInt): Integer; stdcall;
// GIT_EXTERN(int) git_oid_streq(const git_oid *a, const char *str);
git_oid_streq: function (a: Pgit_oid; str: PAnsiChar): Integer; stdcall;
/// reflog.h
///
// GIT_EXTERN(int) git_reflog_read(git_reflog **reflog, git_reference *ref);
git_reflog_read: function (var reflog: Pgit_reflog; ref: Pgit_reference): Integer; stdcall;
// GIT_EXTERN(int) git_reflog_write(git_reference *ref, const git_oid *oid_old, const git_signature *committer, const char *msg);
git_reflog_write: function (ref: Pgit_reference; oid_old: Pgit_oid; committer: Pgit_signature; msg: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_reflog_rename(git_reference *ref, const char *new_name);
git_reflog_rename: function (ref: Pgit_reference; new_name: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_reflog_delete(git_reference *ref);
git_reflog_delete: function (ref: Pgit_reference): Integer; stdcall;
// GIT_EXTERN(unsigned int) git_reflog_entrycount(git_reflog *reflog);
git_reflog_entrycount: function (reflog: Pgit_reflog): UInt; stdcall;
// GIT_EXTERN(const git_reflog_entry *) git_reflog_entry_byindex(git_reflog *reflog, unsigned int idx);
git_reflog_entry_byindex: function (reflog: Pgit_reflog; idx: UInt): Pgit_reflog_entry; stdcall;
// GIT_EXTERN(const git_oid *) git_reflog_entry_oidold(const git_reflog_entry *entry);
git_reflog_entry_oidold: function (entry: Pgit_reflog_entry): Pgit_oid; stdcall;
// GIT_EXTERN(const git_oid *) git_reflog_entry_oidnew(const git_reflog_entry *entry);
git_reflog_entry_oidnew: function (entry: Pgit_reflog_entry): Pgit_oid; stdcall;
// GIT_EXTERN(git_signature *) git_reflog_entry_committer(const git_reflog_entry *entry);
git_reflog_entry_committer: function (entry: Pgit_reflog_entry): Pgit_signature; stdcall;
// GIT_EXTERN(char *) git_reflog_entry_msg(const git_reflog_entry *entry);
git_reflog_entry_msg: function (entry: Pgit_reflog_entry): PAnsiChar; stdcall;
// GIT_EXTERN(void) git_reflog_free(git_reflog *reflog);
git_reflog_free: procedure (reflog: Pgit_reflog); stdcall;
/// refs.h
///
// GIT_EXTERN(int) git_reference_lookup(git_reference **reference_out, git_repository *repo, const char *name);
git_reference_lookup: function (var reference_out: Pgit_reference; repo: Pgit_repository; const name: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repository *repo, const char *name, const char *target, int force);
git_reference_create_symbolic: function (var ref_out: Pgit_reference; repo: Pgit_repository; const name: PAnsiChar; const target: PAnsiChar; force: Integer): Integer; stdcall;
// GIT_EXTERN(int) git_reference_create_oid(git_reference **ref_out, git_repository *repo, const char *name, const git_oid *id, int force);
git_reference_create_oid: function (var ref_out: Pgit_reference; repo: Pgit_repository; const name: PAnsiChar; const id: Pgit_oid; force: Integer): Integer; stdcall;
// GIT_EXTERN(const git_oid *) git_reference_oid(git_reference *ref);
git_reference_oid: function (ref: Pgit_reference): Pgit_oid; stdcall;
// GIT_EXTERN(const char *) git_reference_target(git_reference *ref);
git_reference_target: function (ref: Pgit_reference): PAnsiChar; stdcall;
// GIT_EXTERN(git_rtype) git_reference_type(git_reference *ref);
git_reference_type: function (ref: Pgit_reference): git_rtype; stdcall;
// GIT_EXTERN(const char *) git_reference_name(git_reference *ref);
git_reference_name: function (ref: Pgit_reference): PAnsiChar; stdcall;
// GIT_EXTERN(int) git_reference_resolve(git_reference **resolved_ref, git_reference *ref);
git_reference_resolve: function (var resolved_ref: Pgit_reference; ref: Pgit_reference): Integer; stdcall;
// GIT_EXTERN(git_repository *) git_reference_owner(git_reference *ref);
git_reference_owner: function (ref: Pgit_reference): Pgit_repository; stdcall;
// GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const char *target);
git_reference_set_target: function (ref: Pgit_reference; const target: PAnsiChar): Integer; stdcall;
// GIT_EXTERN(int) git_reference_set_oid(git_reference *ref, const git_oid *id);
git_reference_set_oid: function (ref: Pgit_reference; const id: Pgit_oid): Integer; stdcall;
// GIT_EXTERN(int) git_reference_rename(git_reference *ref, const char *new_name, int force);
git_reference_rename: function (ref: Pgit_reference; const new_name: PAnsiChar; force: Integer): Integer; stdcall;
// GIT_EXTERN(int) git_reference_delete(git_reference *ref);
git_reference_delete: function (ref: Pgit_reference): Integer; stdcall;
// GIT_EXTERN(int) git_reference_packall(git_repository *repo);
git_reference_packall: function (repo: Pgit_repository): Integer; stdcall;
// GIT_EXTERN(int) git_reference_listall(git_strarray *array, git_repository *repo, unsigned int list_flags);
git_reference_listall: function (array_: Pgit_strarray; repo: Pgit_repository; list_flags: UInt): Integer; stdcall;
// GIT_EXTERN(int) git_reference_foreach(git_repository *repo, unsigned int list_flags, int (*callback)(const char *, void *), void *payload);
git_reference_foreach: function (repo: Pgit_repository; list_flags: UInt; callback: Pgit_reference_foreach_callback; payload: PByte): Integer; stdcall;
// GIT_EXTERN(int) git_reference_is_packed(git_reference *ref);
git_reference_is_packed: function (ref: Pgit_reference): Integer; stdcall;
// GIT_EXTERN(int) git_reference_reload(git_reference *ref);
git_reference_reload: function (ref: Pgit_reference): Integer; stdcall;
// GIT_EXTERN(void) git_reference_free(git_reference *ref);
git_reference_free: procedure (ref: Pgit_reference); stdcall;
/// remote.h
///
// GIT_EXTERN(int) git_remote_new(git_remote **out, git_repository *repo, const char *url, const char *name);
git_remote_new: function (var out_: Pgit_remote; repo: Pgit_repository; url, name: PAnsiChar): Integer; stdcall;