-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDOCS.txt
2849 lines (1644 loc) · 84.9 KB
/
DOCS.txt
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
PHP libgit2 bindings API documentation
--------------------------------------------------------------------------------
The API is divided (roughly) by the kind of libgit2 object on which the API
function operates (e.g. git_repository, git_reference, ETC.). In most cases the
PHP API uses resource values for the major libgit2 opaque data types.
Since PHP has native exception handling, most API calls are reworked to return
the main result value and throw an exception on error. For example,
git_repository_new() returns a resource to the repository (originally assigned
to the first by-reference parameter). We also rework the structure of some
library calls due to inherent difficulties porting the C interface to PHP
(e.g. when pointers are used). Sometimes this requires adding API routines not
originally in the libgit2 specification.
Please consult the official libgit2 documentation for descriptions of the
behavior of the functions and their arguments. This section only details the PHP
interface.
--------------------------------------------------------------------------------
API Structure Reference
The following structures are represented as resources in the PHP API. They
generally represent opaque structures from the C API (but not necessarily).
Note that the PHP resource type names (which are really just diagnostic in
purpose) are determined by the C++ compiler via 'typeid'.
git2 type
---------
git_annotated_commit
git_blame
git_blob
git_branch_iterator
git_commit
git_config
git_config_iterator
git_credential
git_describe_result
git_diff
git_diff_stats
git_index
git_index_conflict_iterator
git_indexer
git_note
git_note_iterator
git_object
git_odb
git_odb_object
git_packbuilder
git_patch
git_rebase
git_refdb
git_reference
git_reference_iterator
git_reflog
git_refspec
git_remote
git_repository
git_revwalk
git_signature
git_status_list
git_submodule
git_tag
git_tree
git_tree_entry
git_treebuilder
The following structures are not represented as resources in the PHP
API. Instead a scalar, array or object type is used:
git2 type PHP type
--------- --------
git_blame_hunk array
git_buf string
git_cherrypick_options array
git_config_backend \GitConfigBackend
git_config_entry array
git_describe_format_options array
git_describe_options array
git_diff_binary array
git_diff_binary_file array
git_diff_delta array
git_diff_file array
git_diff_format_email_options array
git_diff_hunk array
git_diff_line array
git_diff_options array
git_index_entry array
git_merge_file_input array
git_merge_file_options array
git_merge_file_result array
git_merge_options array
git_odb_backend \GitODBBackend
git_odb_stream \GitODBStream
git_odb_writepack \GitODBWritepack
git_oid string
git_refdb_backend \GitRefDBBackend
git_reflog_entry array
git_revspec array
git_status_entry array
git_status_options array
git_writestream \GitWritestream
For objects, see the later section regarding Classes.
Enumeration types are treated as integers in PHP userspace. A global constant is
generally defined for enumerator. If an enumerator is missing, then it is
acceptable to define it yourself using "define(...)" or by just using the
correct constant value from the git2 headers.
--------------------------------------------------------------------------------
Error Handling
When an underlying libgit2 function fails with an error code, the extension will
throw an exception of type Git2Exception (see declaration below). The error code
returned is accessible via the $code property on the thrown exception.
Example:
function render_reference($repo,string $refName) {
try {
$oid = git_reference_name_to_id($repo,$refName);
echo "<p>The OID for <code>$refName</code> is <code>$oid</code></p>";
} catch (\Git2Exception $ex) {
if ($ex->getCode() == GIT_ENOTFOUND) {
echo '<p>Not Found</p>';
}
else {
throw $ex;
}
}
}
Declaration of exception class Git2Exception:
class Git2Exception extends RuntimeException
--------------------------------------------------------------------------------
Function API Reference
Core API routines operate on opaque, resource values. They try to conform to the
original, C library calls they wrap. Most if not all of these functions have the
prefix "git_".
Functions provided by the extension that are not git2 wrappers have the prefix
'git2_*'. These are provided as supplements or additions where appropriate.
----------------------------------------
[general]
----------------------------------------
int git_libgit2_features()
?string git_libgit2_prerelease()
void git_libgit2_version(int &$major,int &$minor,int &$rev)
string git2_version()
Gets a string representing both the php-git2 and libgit2 versions.
----------------------------------------
[git_annotated_commit]
----------------------------------------
resource git_annotated_commit_from_fetchhead(resource $repo,string $branch_name,string $remote_url,string $oid)
Returns git_annotated_commit resource
resource git_annotated_commit_from_ref(resource,resource)
Returns git_annotated_commit resource
resource git_annotated_commit_from_revspec(resource,string)
Returns git_annotated_commit resource
resource git_annotated_commit_lookup(resource,string)
Returns git_annotated_commit resource
string git_annotated_commit_id(resource)
void git_annotated_commit_free(resource)
----------------------------------------
[git_attr]
----------------------------------------
void git_attr_add_macro(resource $repo,string $name,string $values)
void git_attr_cache_flush(resource $repo)
void git_attr_foreach(resource $repo,int $flags,string $path,callable $callback,mixed $payload)
Callback signature:
void callback(string $name,?string $value,mixed $payload)
The function should throw on error.
string git_attr_get(resource $repo,int $flags,string $path,string $name)
int git_attr_value(string $attr)
----------------------------------------
[git_blame]
----------------------------------------
resource git_blame_buffer(resource $reference,string $buffer)
Parameter $reference is a resource of type git_blame.
Returns git_blame resource
resource git_blame_file(resource $repo,string $path,?array $options)
The final parameter $options is an array of options with keys corresponding
to the git_blame_options struct. It may be null if you want to use the
defaults.
Returns git_blame resource
void git_blame_free(resource $blame)
array git_blame_get_hunk_byindex(resource $blame,int $index)
Note: the return array contains a single dimensional representation of
the hunk data. Example:
array(15) {
["lines_in_hunk"]
["final_commit_id"]
["final_start_line_number"]
["final_signature.name"]
["final_signature.email"]
["final_signature.when.time"]
["final_signature.when.offset"]
["orig_commit_id"]
["orig_path"]
["orig_start_line_number"]
["orig_signature.name"]
["orig_signature.email"]
["orig_signature.when.time"]
["orig_signature.when.offset"]
["boundary"]
}
array git_blame_get_hunk_byline(resource $blame,int $lineno)
See git_blame_get_hunk_by_index() for an example of what the return
result looks like.
int git_blame_get_hunk_count(resource $blame)
----------------------------------------
[git_blob]
----------------------------------------
string git_blob_create_frombuffer(resource $repo,string $buffer)
string git_blob_create_fromdisk(resource $repo,string $path)
\GitWritestream git_blob_create_fromstream(resource $repo,?string $hintpath)
string git_blob_create_fromstream_commit(GitWritestream $stream)
string git_blob_create_fromworkdir(resource $repo,string $relative_path)
resource git_blob_dup(resource $blob)
Returns git_blob resource
string git_blob_filtered_content(resource $blob,string $as_path,bool $check_for_binary_data)
void git_blob_free(resource $blob)
string git_blob_id(resource $blob)
bool git_blob_is_binary(resource $blob)
Returns bool
resource git_blob_lookup(resource $repo,string $id)
Returns git_blob resource
resource git_blob_lookup_prefix(resource $repo,string $id)
Returns resource
resource git_blob_owner(resource $blob)
Returns git_repository resource
string git_blob_rawcontent(resource $blob)
int git_blob_rawsize(resource $blob)
----------------------------------------
[git_branch]
----------------------------------------
resource git_branch_create(resource $repo,string $branch_name,resource $target,bool $force)
Returns git_reference resource
resource git_branch_create_from_annotated(resource $repo,string $branch_name,resource $commit,bool $force)
Parameter $commit is a resource of type git_annotated_commit.
Returns git_reference resource
void git_branch_delete(resource $branch)
bool git_branch_is_head(resource $branch)
void git_branch_iterator_free(resource $iter)
Parameter $iter is a resource of type git_branch_iterator.
resource git_branch_iterator_new(resource $repo,int $flags)
Returns git_branch_iterator resource
resource git_branch_lookup(resource $repo,string $branch_name,int $branch_type)
Returns git_reference resource
resource git_branch_move(resource $branch,string $new_branch_name,bool $force)
Returns git_reference resource
string git_branch_name(resource $branch)
resource|bool git_branch_next(&int $type,resource $iter)
Parameter $iter is a resource of type git_branch_iterator.
Returns git_reference resource or false at iter over
void git_branch_set_upstream(resource $branch,?string $branch_name)
resource|bool git_branch_upstream(resource $branch)
Returns git_reference resource if found, false otherwise
string|bool git_branch_upstream_name(resource $repo,string $refname)
Returns string if found, false otherwise
string git_branch_upstream_remote(resource $repo,string $refname)
----------------------------------------
[git_checkout]
----------------------------------------
void git_checkout_head(resource $repo,?array $options = null)
Note: the last parameter ($options) is passed as an array with the keys
matching the properties of the git_checkout_options struct. Any properties
that are not specified inherit the defaults provided via calling
git_checkout_init_options(). You may specify null to use only the defaults.
void git_checkout_index(resource $repo,resource $index,?array $options = null)
See notes for git_checkout_head().
void git_checkout_tree(resource $repo,resource $treeish,?array $options = null)
Parameter $treeish is a resource of type git_object.
See notes for git_checkout_head().
----------------------------------------
[git_cherrypick]
----------------------------------------
void git_cherrypick(resource $repo,resource $commit,?array $options = null)
Parameter $options is an array having the keys of the git_cherrypick_options
struct. Any properties that are not specified inherit the defaults provided
via calling git_cherrypick_options_init(). You may specify null to use only
the defaults.
resource git_cherrypick_commit(resource $repo,resource $cherrypick_commit,resource $our_commit,int $mainline,?array $options = null)
Parameter $options is an array having the keys of the git_merge_options
struct. Any properties that are not specified inherit the defaults provided
via calling git_merge_options_init(). You may specify null to use only the
defaults.
Returns git_index resource
----------------------------------------
[git_clone]
----------------------------------------
resource git_clone(string $url,string $local_path,?array $options = null)
Parameter $options is passed as an array with the keys representing the
properties of the git_clone_options struct. The checkout_opts and fetch_opts
properties may be arrays to their respective structures. Any properties that
are not specified inherit the defaults provided via calling
git_clone_init_options(). You may specify null to use only the defaults.
Callback $options['repository_cb'] signature:
resource callback(string $path,bool $bare,mixed $payload)
The callback should return git_repository resource.
The callback should throw on error.
Returns git_repository resource
----------------------------------------
[git_commit]
----------------------------------------
string git_commit_amend(resource $commit_to_amend,?string $update_ref,?resource $author,?resource $committer,?string $message_encoding,?string $message,?resource $tree)
The arguments behave like the C function in that NULL's are disregarded when
amending the commit.
resource git_commit_author(resource $commit)
Returns git_signature resource
string git_commit_body(resource $commit)
resource git_commit_committer(resource $commit)
Returns git_signature resource
string git_commit_create(resource $repo,?string $update_ref,resource $author,resource $committer,?string $message_encoding,string $message,resource $tree,array $parents)
Parameter $parents be an array of git_commit resource values.
string git_commit_create_buffer(resource $repo,resource $author,resource $committer,?string $message_encoding,string $message,resource $tree,array $parents)
Parameter $parents should be an array of git_commit resource values.
string git_commit_create_from_callback(resource $repo,?string $update_ref,resource $author,resource $committer,?string $message_encoding,string $message,string $tree_id,callable $callback,mixed $payload)
Callback signature:
string callback(int $idx,mixed $payload)
This callback is not designed to report errors. If an error occures,
then the calling function will finish and the error will be logged as a
warning.
string git_commit_create_from_ids(resource $repo,?string $update_ref,resource $author,resource $committer,?string $message_encoding,string $message,string $tree_id,array $parents)
Parameter $parents should be a list of strings representing the parent
commit OIDs.
string git_commit_create_with_signature(resource $repo,string $commit_content,string $signature,?string $signature_field = null)
resource git_commit_dup(resource $source)
Parameter $source is a resource of type git_commit.
Returns git_commit resource
string git_commit_extract_signature(string &$signed_data_out,resource $repo,string $commit_id,string $field = null)
Returns the signature block
void git_commit_free(resource $commit)
string git_commit_header_field(resource $commit,string $field)
string git_commit_id(resource $commit)
resource git_commit_lookup(resource $repo,string $id)
Returns git_commit resource
resource git_commit_lookup_prefix(resource $repo,string $id)
Returns git_commit resource
string git_commit_message(resource $commit)
?string git_commit_message_encoding(resource $commit)
string git_commit_message_raw(resource $commit)
resource git_commit_nth_gen_ancestor(resource $commit,int $n)
Returns git_commit resource
resource git_commit_owner(resource $commit)
Returns git_repository resource
resource git_commit_parent(resource $commit,int $n)
Returns git_commit resource
string git_commit_parent_id(resource $commit,int $n)
int git_commit_parentcount(resource $commit)
string git_commit_raw_header(resource $commit)
string git_commit_summary(resource $commit)
int git_commit_time(resource $commit)
int git_commit_time_offset(resource $commit)
resource git_commit_tree(resource $commit)
Returns git_tree resource
string git_commit_tree_id(resource $commit)
----------------------------------------
[git_config]
----------------------------------------
void git_config_add_backend(resource $cfg,\GitConfigBackend $backend,int $level,?resource $repo,bool $force)
void git_config_add_file_ondisk(resource $cfg,string $path,int $level,?resource $repo,bool $force)
void git_config_backend_foreach_match(\GitConfigBackend $backend,?string $regexp,callable $callback,mixed $payload)
See notes for git_config_foreach.
void git_config_delete_entry(resource $cfg,string $name)
void git_config_delete_multivar(resource $cfg,string $name,string $regexp)
string git_config_find_global()
string git_config_find_programdata()
string git_config_find_system()
string git_config_find_xdg()
void git_config_foreach(resource $cfg,callable $callback,mixed $payload)
Callback signature:
bool callback(array $entry,mixed $payload)
Note: if an iteration of the callback returns TRUE, the operation is
considered over and iterator stops.
The callback should throw on error.
void git_config_foreach_match(resource $cfg,string $regexp,callable $callback,mixed $payload)
See notes for git_config_foreach.
void git_config_free(resource $cfg)
bool git_config_get_bool(resource $cfg,string $name)
array git_config_get_entry(resource $cfg,string $name)
Returns an array with the following structure:
array(3) {
["name"]
["value"]
["level"]
}
int git_config_get_int32(resource $cfg,string $name)
int git_config_get_int64(resource $cfg,string $name)
int git_config_get_mapped(resource $cfg,string $name,array $maps)
Parameter $maps must be an indexed array of 3-tuple array elements, with
each inner 3-tuple array containing the git_configmap fields in the order
[type,str_match,map_value]. The map_value entry is forced to be an integer.
void git_config_get_multivar_foreach(resource $cfg,string $name,?string $regexp,callable $callback,mixed $payload)
Callback signature:
bool callback(array $entry,mixed $payload)
string git_config_get_path(resource $cfg,string $name)
string git_config_get_string(resource $cfg,string $name)
string git_config_get_string_buf(resource $cfg,string $name)
Note: this function is functionally equivalent to git_config_get_string() in
PHP, except that it can encode binary strings. However binary strings are
typically not stored in git config files...
void git_config_iterator_free(resource $iter)
Parameter $iter is a resource of type git_config_iterator.
resource git_config_iterator_glob_new(resource $cfg,string $regexp)
Returns git_config_iterator resource
resource git_config_iterator_new(resource $cfg)
Returns git_config_iterator resource
int git_config_lookup_map_value(array $maps,string $value)
Parameter $maps must be an indexed array of 3-tuple array elements, with
each inner 3-tuple array containing the git_configmap fields in the order
[type,str_match,map_value]. The map_value entry is forced to be an integer.
resource git_config_multivar_iterator_new(resource $cfg,string $name,?string $regexp)
Returns git_config_iterator resource
resource git_config_new()
Returns git_config resource
array|bool git_config_next(resource $iter)
Parameter $iter is a resource of type git_config_iterator.
See git_config_get_entry() for details on returned value. Returns FALSE when
iteration is over.
resource git_config_open_default()
Returns git_config resource
resource git_config_open_global(resource $cfg)
Returns git_config resource
resource git_config_open_level(resource $parent,int $level)
Parameter $parent is a resource of type git_config.
Returns git_config resource
resource git_config_open_ondisk(string $path)
Returns git_config resource
bool git_config_parse_bool(string $value)
int git_config_parse_int32(string $value)
int git_config_parse_int64(string $value)
string git_config_parse_path(string $value)
void git_config_set_bool(resource $cfg,string $name,bool $value)
void git_config_set_int32(resource $cfg,string $name,int $value)
void git_config_set_int64(resource $cfg,string $name,int $value)
void git_config_set_multivar(resource $cfg,string $name,string $regexp,string $value)
void git_config_set_string(resource $cfg,string $name,string $value)
resource git_config_snapshot(resource $cfg)
Returns git_config resource
----------------------------------------
[git_credential]
----------------------------------------
Note: all git_credential_* functions are aliased as git_cred_* for backwards
compatibility. The git_cred_* API is deprecated in libgit2 version 1 and will be
removed in later versions.
resource git_credential_default_new()
Returns git_credential resource
void git_credential_free(resource $cred)
bool git_credential_has_username(resource $cred)
resource git_credential_ssh_key_from_agent(string $username)
Returns git_credential resource
resource git_credential_ssh_key_memory_new(string $username,string $publickey,string $privatekey,string $passphrase)
Returns git_credential resource
resource git_credential_ssh_key_new(string $username,string $publickey,string $privatekey,string $passphrase)
Returns git_credential resource
resource git_credential_username_new(string $username)
Returns git_credential resource
resource git_credential_userpass_plaintext_new(string $username,string $password)
Returns git_credential resource
----------------------------------------
[git_describe]
----------------------------------------
resource git_describe_commit(resource $committish,?array $options = null)
Parameter $committish is a resource of type git_object.
Parameter $options is an array corresponding to the git_describe_options
struct. Options omitted from the array will default to values provided via
git_describe_init_options(). If $options is omitted then default options are
passed via git_describe_init_options().
Returns git_describe_result resource
string git_describe_format(resource $result,?array $options = null)
Parameter $result is a resource of type git_describe_result.
Parameter $options is an array corresponding to the
git_describe_format_options struct. Options omitted from the array will
default to values provided via git_describe_format_options_init(). If
$options is omitted then default options are passed via
git_describe_format_options_init().
void git_describe_result_free(resource $result)
Parameter $result is a resource of type git_describe_result.
resource git_describe_workdir(resource $repo,?array $options = null)
Parameter $options is an array corresponding to the git_describe_options
struct. Options omitted from the array will default to values provided via
git_describe_init_options(). If $options is omitted then default options are
passed via git_describe_init_options().
Returns git_describe_result resource
----------------------------------------
[git_diff]
----------------------------------------
Callback signatures for git_diff functions:
notify_callback:
int callback(resource $diff,array $delta,string $matchedPathspec,mixed $payload)
NOTE: Errors generated by this callback cannot be handled and will be
logged as warnings.
progress_callback:
bool callback(resource $diff,string $oldPath,string $newPath,mixed $payload)
NOTE: Errors generated by this callback cannot be handled and will be
logged as warnings.
A return value of FALSE aborts the diff
file_callback:
void callback(array $delta,float $progress,mixed $payload)
The callback should throw on error.
binary_callback:
void callback(array $delta,array $binary,mixed $payload)
The callback should throw on error.
hunk_callback:
void callback(array $delta,array $hunk,mixed $payload)
The callback should throw on error.
line_callback:
void callback(array $delta,array $hunk,array $line,mixed $payload)
The callback should throw on error.
void git_diff_blob_to_buffer(?resource $old_blob,?string $old_as_path,?string $buffer,?string $buffer_as_path,?array $options,?callable $file_callback,?callable $binary_callback,?callable $hunk_callback,?callable $line_callback,mixed $payload)
Parameter $options is an array corresponding to git_diff_options. Options
are defaulted using git_diff_options_init().
void git_diff_blobs(?resource $old_blob,?string $old_as_path,?resource $new_blob,?string $new_as_path,?array $options,?callable $file_callback,?callable $binary_callback,?callable $hunk_callback,?callable $line_callback,mixed $payload)
Parameter $options is an array corresponding to git_diff_options. Options
are defaulted using git_diff_options_init().
void git_diff_buffers(?string $old_buffer,?string $old_as_path,?string $new_buffer,?string $new_as_path,?array $options,?callable $file_callback,?callable $binary_callback,?callable $hunk_callback,?callable $line_callback,mixed $payload)
Parameter $options is an array corresponding to git_diff_options. Options
are defaulted using git_diff_options_init().
string git_diff_commit_as_email(resource $repo,resource $commit,int $patch_no,int $total_patches,int $flags,?array $options)
Parameter $options is an array corresponding to git_diff_options. Options
are defaulted using git_diff_options_init().
void git_diff_find_similar(resource $diff,?array $options)
Parameter $options is an array corresponding to
git_diff_find_options. Options are defaulted using
git_diff_find_options_init().
void git_diff_foreach(resource $diff,?callable $file_callback,?callable $binary_callback,?callable $hunk_callback,?callable $line_callback,mixed $payload)
string git_diff_format_email(resource $diff,?array $options)
Parameter $options is an array corresponding to
git_diff_format_email_options. Options are defaulted using
git_diff_format_email_options_init().
The $options['author'] option can be either an array like those returned
from git2_signature_convert() OR a git_signature resource.
void git_diff_free(resource $diff)
resource git_diff_from_buffer(string $buffer)
Returns git_diff resource
array git_diff_get_delta(resource $diff,int $idx)
array git_diff_get_perfdata(resource $diff)
resource git_diff_get_stats(resource $diff)
Returns git_diff_stats resource
resource git_diff_index_to_index(resource $repo,?resource $old_index,?resource $new_index,?array $options)
Parameter $options is an array corresponding to git_diff_options. Options
are defaulted using git_diff_options_init().
Returns git_diff resource
resource git_diff_index_to_workdir(resource $repo,?resource $index,?array $options)
Returns git_diff resource
bool git_diff_is_sorted_icase(resource $diff)
void git_diff_merge(resource $diff_onto,resource $diff_from)
int git_diff_num_deltas(resource $diff)
int git_diff_num_deltas_of_type(resource $diff,int $type)
void git_diff_print(resource $diff,int $format,callable $callback,mixed $payload)
int git_diff_stats_deletions(resource $stats)
int git_diff_stats_files_changed(resource $stats)
void git_diff_stats_free(resource $stats)
int git_diff_stats_insertions(resource $stats)
string git_diff_stats_to_buf(resource $stats,int $format,int $width)
string git_diff_status_char(int $status)
string git_diff_to_buf(resource $diff,int $format)
resource git_diff_tree_to_index(resource $repo,?resource $old_tree,?resource $index,?array $options)
Parameter $options is an array corresponding to git_diff_options. Options
are defaulted using git_diff_options_init().
Returns git_diff resource
resource git_diff_tree_to_tree(resource $repo,?resource $old_tree,?resource $new_tree,?array $options)
Parameter $options is an array corresponding to git_diff_options. Options
are defaulted using git_diff_options_init().
Returns git_diff resource
resource git_diff_tree_to_workdir(resource $repo,?resource $old_tree,?array $options)
Parameter $options is an array corresponding to git_diff_options. Options
are defaulted using git_diff_options_init().
Returns git_diff resource
resource git_diff_tree_to_workdir_with_index(resource $repo,?resource $old_tree,?array $options)
Parameter $options is an array corresponding to git_diff_options. Options
are defaulted using git_diff_options_init().
Returns git_diff resource
----------------------------------------
[git_ignore]
----------------------------------------
void git_ignore_add_rule(resource $repo,string $rules)
void git_ignore_clear_internal_rules(resource $repo)
bool git_ignore_path_is_ignored(resource $repo,string $path)
----------------------------------------
[git_index]
----------------------------------------
void git_index_add(resource $index,array $source_entry)
bool git_index_add_all(resource $index,array $pathspec,int $flags,callable $callback,mixed $paylaod)
Callback signature: void callback(string $path,string $matched_pathspec,mixed $payload)
The callback should throw on error and return less than zero to stop
iteration early.
This function returns FALSE if the scan was aborted (i.e. iteration
stopped).
void git_index_add_bypath(resource $index,string $path)
void git_index_add_from_buffer(resource $index,array $entry,string $buffer)
int git_index_caps(resource $index)
string git_index_checksum(resource $index)
void git_index_clear(resource $index)
void git_index_conflict_add(resource $index,array $ancestor_entry,array $our_entry,array $their_entry)
void git_index_conflict_cleanup(resource $index)
void git_index_conflict_get(array &$ancestor,array &$ours,array &$theirs,resource $index,string $path)
void git_index_conflict_iterator_free(resource $iter)
resource git_index_conflict_iterator_new(resource $index)
Returns git_index_conflict_iterator resource
bool git_index_conflict_next(array &$ancestor,array &$ours,array &$theirs,resource $iterator)
Returns false when iteration is over.
void git_index_conflict_remove(resource $index,string $path)
int git_index_entrycount(resource $index)
bool git_index_entry_is_conflict(array $entry)
int git_index_stage(array $entry)
int git_index_find(resource $index,string $path)
int git_index_find_prefix(resource $index,string $prefix)
void git_index_free(resource $index)
array|bool git_index_get_byindex(resource $index,int $n)
Returns git_index_entry array, or false if out of bounds
array|bool git_index_get_bypath(resource $index,string $path,int $stage)
Returns git_index_entry array, or false if does not exist
bool git_index_has_conflicts(resource $index)
resource git_index_new()
Returns git_index resource
resource git_index_open(string $index_path)
Returns git_index resource
resource git_index_owner(resource $index)
Returns git_repository resource
?string git_index_path(resource $index)
void git_index_read(resource $index,bool $force)
void git_index_read_tree(resource $index,resource $tree)
void git_index_remove(resource $index,string $path,int $stage)
bool git_index_remove_all(resource $index,array $pathspec,callable $callback,mixed $payload)
See git_index_add_all() for callback description.
void git_index_remove_bypath(resource $index,string $path)
void git_index_remove_directory(resource $index,string $dir,int $stage)