@@ -3,9 +3,11 @@ typedef ... git_remote;
3
3
typedef ... git_refspec ;
4
4
typedef ... git_push ;
5
5
typedef ... git_cred ;
6
- typedef ... git_diff_file ;
7
6
typedef ... git_tree ;
8
7
typedef ... git_signature ;
8
+ typedef ... git_index ;
9
+ typedef ... git_diff ;
10
+ typedef ... git_index_conflict_iterator ;
9
11
10
12
#define GIT_OID_RAWSZ ...
11
13
#define GIT_PATH_MAX ...
@@ -25,6 +27,7 @@ typedef struct git_strarray {
25
27
size_t count ;
26
28
} git_strarray ;
27
29
30
+ typedef int64_t git_off_t ;
28
31
29
32
typedef enum {
30
33
GIT_OK = 0 ,
@@ -181,6 +184,76 @@ int git_cred_ssh_key_new(
181
184
const char * privatekey ,
182
185
const char * passphrase );
183
186
187
+ /*
188
+ * git_diff
189
+ */
190
+
191
+ typedef enum {
192
+ GIT_SUBMODULE_IGNORE_RESET = -1 ,
193
+
194
+ GIT_SUBMODULE_IGNORE_NONE = 1 ,
195
+ GIT_SUBMODULE_IGNORE_UNTRACKED = 2 ,
196
+ GIT_SUBMODULE_IGNORE_DIRTY = 3 ,
197
+ GIT_SUBMODULE_IGNORE_ALL = 4 ,
198
+ GIT_SUBMODULE_IGNORE_DEFAULT = 0
199
+ } git_submodule_ignore_t ;
200
+
201
+ typedef enum {
202
+ GIT_DELTA_UNMODIFIED = 0 ,
203
+ GIT_DELTA_ADDED = 1 ,
204
+ GIT_DELTA_DELETED = 2 ,
205
+ GIT_DELTA_MODIFIED = 3 ,
206
+ GIT_DELTA_RENAMED = 4 ,
207
+ GIT_DELTA_COPIED = 5 ,
208
+ GIT_DELTA_IGNORED = 6 ,
209
+ GIT_DELTA_UNTRACKED = 7 ,
210
+ GIT_DELTA_TYPECHANGE = 8 ,
211
+ } git_delta_t ;
212
+
213
+ typedef struct {
214
+ git_oid id ;
215
+ const char * path ;
216
+ git_off_t size ;
217
+ uint32_t flags ;
218
+ uint16_t mode ;
219
+ } git_diff_file ;
220
+
221
+ typedef struct {
222
+ git_delta_t status ;
223
+ uint32_t flags ;
224
+ uint16_t similarity ;
225
+ uint16_t nfiles ;
226
+ git_diff_file old_file ;
227
+ git_diff_file new_file ;
228
+ } git_diff_delta ;
229
+
230
+ typedef int (* git_diff_notify_cb )(
231
+ const git_diff * diff_so_far ,
232
+ const git_diff_delta * delta_to_add ,
233
+ const char * matched_pathspec ,
234
+ void * payload );
235
+
236
+ typedef struct {
237
+ unsigned int version ;
238
+ uint32_t flags ;
239
+
240
+ git_submodule_ignore_t ignore_submodules ;
241
+ git_strarray pathspec ;
242
+ git_diff_notify_cb notify_cb ;
243
+ void * notify_payload ;
244
+
245
+ uint16_t context_lines ;
246
+ uint16_t interhunk_lines ;
247
+ uint16_t id_abbrev ;
248
+ git_off_t max_size ;
249
+ const char * old_prefix ;
250
+ const char * new_prefix ;
251
+ } git_diff_options ;
252
+
253
+ int git_diff_init_options (git_diff_options * opts , unsigned int version );
254
+ int git_diff_index_to_workdir (git_diff * * diff , git_repository * repo , git_index * index , const git_diff_options * opts );
255
+ int git_diff_tree_to_index (git_diff * * diff , git_repository * repo , git_tree * old_tree , git_index * index , const git_diff_options * opts );
256
+
184
257
/*
185
258
* git_checkout
186
259
*/
@@ -369,3 +442,60 @@ int git_repository_init_ext(
369
442
git_repository * * out ,
370
443
const char * repo_path ,
371
444
git_repository_init_options * opts );
445
+
446
+ /*
447
+ * git_index
448
+ */
449
+ typedef int64_t git_time_t ;
450
+
451
+ typedef struct {
452
+ git_time_t seconds ;
453
+ unsigned int nanoseconds ;
454
+ } git_index_time ;
455
+
456
+ typedef struct git_index_entry {
457
+ git_index_time ctime ;
458
+ git_index_time mtime ;
459
+
460
+ unsigned int dev ;
461
+ unsigned int ino ;
462
+ unsigned int mode ;
463
+ unsigned int uid ;
464
+ unsigned int gid ;
465
+ git_off_t file_size ;
466
+
467
+ git_oid id ;
468
+
469
+ unsigned short flags ;
470
+ unsigned short flags_extended ;
471
+
472
+ const char * path ;
473
+ } git_index_entry ;
474
+
475
+ typedef int (* git_index_matched_path_cb )(
476
+ const char * path , const char * matched_pathspec , void * payload );
477
+
478
+ void git_index_free (git_index * index );
479
+ int git_repository_index (git_index * * out , git_repository * repo );
480
+ int git_index_open (git_index * * out , const char * index_path );
481
+ int git_index_read (git_index * index , int force );
482
+ int git_index_write (git_index * index );
483
+ size_t git_index_entrycount (const git_index * index );
484
+ int git_index_find (size_t * at_pos , git_index * index , const char * path );
485
+ int git_index_add_bypath (git_index * index , const char * path );
486
+ int git_index_add (git_index * index , const git_index_entry * source_entry );
487
+ int git_index_remove (git_index * index , const char * path , int stage );
488
+ int git_index_read_tree (git_index * index , const git_tree * tree );
489
+ int git_index_clear (git_index * index );
490
+ int git_index_write_tree (git_oid * out , git_index * index );
491
+ int git_index_write_tree_to (git_oid * out , git_index * index , git_repository * repo );
492
+ const git_index_entry * git_index_get_bypath (git_index * index , const char * path , int stage );
493
+ const git_index_entry * git_index_get_byindex (git_index * index , size_t n );
494
+ int git_index_add_all (git_index * index , const git_strarray * pathspec , unsigned int flags ,
495
+ git_index_matched_path_cb callback , void * payload );
496
+ int git_index_has_conflicts (const git_index * index );
497
+ void git_index_conflict_iterator_free (git_index_conflict_iterator * iterator );
498
+ int git_index_conflict_iterator_new (git_index_conflict_iterator * * iterator_out , git_index * index );
499
+ int git_index_conflict_get (const git_index_entry * * ancestor_out , const git_index_entry * * our_out , const git_index_entry * * their_out , git_index * index , const char * path );
500
+ int git_index_conflict_next (const git_index_entry * * ancestor_out , const git_index_entry * * our_out , const git_index_entry * * their_out , git_index_conflict_iterator * iterator );
501
+ int git_index_conflict_remove (git_index * index , const char * path );
0 commit comments