github.com/whamcloud/lemur@v0.0.0-20190827193804-4655df8a52af/packaging/ci/lambda/GitPullS3/pygit2/decl.h (about)

     1  typedef ... git_repository;
     2  typedef ... git_submodule;
     3  typedef ... git_remote;
     4  typedef ... git_transport;
     5  typedef ... git_refspec;
     6  typedef ... git_cred;
     7  typedef ... git_object;
     8  typedef ... git_tree;
     9  typedef ... git_commit;
    10  typedef ... git_index;
    11  typedef ... git_diff;
    12  typedef ... git_index_conflict_iterator;
    13  
    14  #define GIT_OID_RAWSZ ...
    15  #define GIT_PATH_MAX ...
    16  
    17  typedef struct git_oid {
    18  	unsigned char id[20];
    19  } git_oid;
    20  
    21  typedef struct {
    22  	char   *ptr;
    23  	size_t asize, size;
    24  } git_buf;
    25  void git_buf_free(git_buf *buffer);
    26  
    27  typedef struct git_strarray {
    28  	char **strings;
    29  	size_t count;
    30  } git_strarray;
    31  
    32  typedef int64_t git_off_t;
    33  typedef int64_t git_time_t;
    34  
    35  typedef enum {
    36  	GIT_REF_INVALID = 0,
    37  	GIT_REF_OID = 1,
    38  	GIT_REF_SYMBOLIC = 2,
    39  	GIT_REF_LISTALL = 3,
    40  } git_ref_t;
    41  
    42  typedef enum {
    43  	GIT_OK = 0,
    44  	GIT_ERROR = -1,
    45  	GIT_ENOTFOUND = -3,
    46  	GIT_EEXISTS = -4,
    47  	GIT_EAMBIGUOUS = -5,
    48  	GIT_EBUFS = -6,
    49  	GIT_EUSER = -7,
    50  	GIT_EBAREREPO = -8,
    51  	GIT_EUNBORNBRANCH = -9,
    52  	GIT_EUNMERGED = -10,
    53  	GIT_ENONFASTFORWARD = -11,
    54  	GIT_EINVALIDSPEC = -12,
    55  	GIT_ECONFLICT = -13,
    56  	GIT_ELOCKED = -14,
    57  	GIT_EMODIFIED       = -15,
    58  	GIT_EAUTH           = -16,
    59  	GIT_ECERTIFICATE    = -17,
    60  	GIT_EAPPLIED        = -18,
    61  	GIT_EPEEL           = -19,
    62  	GIT_EEOF            = -20,
    63  	GIT_EINVALID        = -21,
    64  	GIT_EUNCOMMITTED    = -22,
    65  	GIT_EDIRECTORY      = -23,
    66  	GIT_EMERGECONFLICT  = -24,
    67  
    68  	GIT_PASSTHROUGH = -30,
    69  	GIT_ITEROVER = -31,
    70  } git_error_code;
    71  
    72  typedef struct {
    73  	char *message;
    74  	int klass;
    75  } git_error;
    76  
    77  typedef struct git_time {
    78  	git_time_t time;
    79  	int offset;
    80  } git_time;
    81  
    82  typedef struct git_signature {
    83  	char *name;
    84  	char *email;
    85  	git_time when;
    86  } git_signature;
    87  
    88  #define GIT_FEATURE_THREADS ...
    89  #define GIT_FEATURE_HTTPS ...
    90  #define GIT_FEATURE_SSH ...
    91  
    92  int git_libgit2_features(void);
    93  
    94  const git_error * giterr_last(void);
    95  
    96  void git_strarray_free(git_strarray *array);
    97  void git_repository_free(git_repository *repo);
    98  
    99  typedef struct git_transfer_progress {
   100  	unsigned int total_objects;
   101  	unsigned int indexed_objects;
   102  	unsigned int received_objects;
   103  	unsigned int local_objects;
   104  	unsigned int total_deltas;
   105  	unsigned int indexed_deltas;
   106  	size_t received_bytes;
   107  } git_transfer_progress;
   108  
   109  typedef enum git_remote_completion_type {
   110  	GIT_REMOTE_COMPLETION_DOWNLOAD,
   111  	GIT_REMOTE_COMPLETION_INDEXING,
   112  	GIT_REMOTE_COMPLETION_ERROR,
   113  } git_remote_completion_type;
   114  
   115  typedef enum {
   116  	GIT_DIRECTION_FETCH = 0,
   117  	GIT_DIRECTION_PUSH  = 1
   118  } git_direction;
   119  
   120  
   121  typedef enum {
   122  	GIT_CREDTYPE_USERPASS_PLAINTEXT,
   123  	GIT_CREDTYPE_SSH_KEY,
   124  	GIT_CREDTYPE_SSH_CUSTOM,
   125  	GIT_CREDTYPE_DEFAULT,
   126      GIT_CREDTYPE_SSH_INTERACTIVE,
   127      GIT_CREDTYPE_USERNAME,
   128  	...
   129  } git_credtype_t;
   130  
   131  typedef enum git_cert_t {
   132  	GIT_CERT_NONE,
   133  	GIT_CERT_X509,
   134  	GIT_CERT_HOSTKEY_LIBSSH2,
   135  } git_cert_t;
   136  
   137  typedef enum {
   138  	GIT_CERT_SSH_MD5 = 1,
   139  	GIT_CERT_SSH_SHA1 = 2,
   140  } git_cert_ssh_t;
   141  
   142  typedef struct {
   143  	git_cert_t cert_type;
   144  } git_cert;
   145  
   146  typedef struct {
   147      git_cert parent;
   148  	git_cert_ssh_t type;
   149  	unsigned char hash_md5[16];
   150      unsigned char hash_sha1[20];
   151  } git_cert_hostkey;
   152  
   153  typedef struct {
   154      git_cert parent;
   155  	void *data;
   156  	size_t len;
   157  } git_cert_x509;
   158  
   159  typedef int (*git_transport_message_cb)(const char *str, int len, void *data);
   160  typedef int (*git_cred_acquire_cb)(
   161  	git_cred **cred,
   162  	const char *url,
   163  	const char *username_from_url,
   164  	unsigned int allowed_types,
   165  	void *payload);
   166  typedef int (*git_transfer_progress_cb)(const git_transfer_progress *stats, void *payload);
   167  typedef int (*git_transport_certificate_check_cb)(git_cert *cert, int valid, const char *host, void *payload);
   168  
   169  typedef int (*git_packbuilder_progress)(
   170  	int stage,
   171  	unsigned int current,
   172  	unsigned int total,
   173  	void *payload);
   174  typedef int (*git_push_transfer_progress)(
   175  	unsigned int current,
   176  	unsigned int total,
   177  	size_t bytes,
   178  	void* payload);
   179  
   180  typedef struct {
   181  	char *src_refname;
   182  	char *dst_refname;
   183  	git_oid src;
   184  	git_oid dst;
   185  } git_push_update;
   186  
   187  typedef int (*git_push_negotiation)(const git_push_update **updates, size_t len, void *payload);
   188  typedef int (*git_transport_cb)(git_transport **out, git_remote *owner, void *param);
   189  
   190  struct git_remote_callbacks {
   191  	unsigned int version;
   192  	git_transport_message_cb sideband_progress;
   193  	int (*completion)(git_remote_completion_type type, void *data);
   194  	git_cred_acquire_cb credentials;
   195      git_transport_certificate_check_cb certificate_check;
   196  	git_transfer_progress_cb transfer_progress;
   197  	int (*update_tips)(const char *refname, const git_oid *a, const git_oid *b, void *data);
   198  	git_packbuilder_progress pack_progress;
   199  	git_push_transfer_progress push_transfer_progress;
   200  	int (*push_update_reference)(const char *refname, const char *status, void *data);
   201  	git_push_negotiation push_negotiation;
   202  	git_transport_cb transport;
   203  	void *payload;
   204  };
   205  
   206  #define GIT_REMOTE_CALLBACKS_VERSION ...
   207  
   208  typedef struct git_remote_callbacks git_remote_callbacks;
   209  
   210  typedef struct {
   211  	unsigned int version;
   212  	unsigned int pb_parallelism;
   213  	git_remote_callbacks callbacks;
   214      git_strarray custom_headers;
   215  } git_push_options;
   216  
   217  #define GIT_PUSH_OPTIONS_VERSION ...
   218  int git_push_init_options(git_push_options *opts, unsigned int version);
   219  
   220  typedef enum {
   221  	GIT_FETCH_PRUNE_UNSPECIFIED,
   222  	GIT_FETCH_PRUNE,
   223  	GIT_FETCH_NO_PRUNE,
   224  } git_fetch_prune_t;
   225  
   226  typedef enum {
   227  	GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED = 0,
   228  	GIT_REMOTE_DOWNLOAD_TAGS_AUTO,
   229  	GIT_REMOTE_DOWNLOAD_TAGS_NONE,
   230  	GIT_REMOTE_DOWNLOAD_TAGS_ALL,
   231  } git_remote_autotag_option_t;
   232  
   233  typedef struct {
   234  	int version;
   235  	git_remote_callbacks callbacks;
   236  	git_fetch_prune_t prune;
   237  	int update_fetchhead;
   238  	git_remote_autotag_option_t download_tags;
   239      git_strarray custom_headers;
   240  } git_fetch_options;
   241  
   242  #define GIT_FETCH_OPTIONS_VERSION ...
   243  int git_fetch_init_options(git_fetch_options *opts,	unsigned int version);
   244  
   245  int git_remote_list(git_strarray *out, git_repository *repo);
   246  int git_remote_lookup(git_remote **out, git_repository *repo, const char *name);
   247  int git_remote_create(
   248  	git_remote **out,
   249  	git_repository *repo,
   250  	const char *name,
   251  	const char *url);
   252  int git_remote_create_with_fetchspec(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch);
   253  int git_remote_delete(git_repository *repo, const char *name);
   254  int git_repository_state_cleanup(git_repository *repo);
   255  
   256  const char * git_remote_name(const git_remote *remote);
   257  
   258  int git_remote_rename(git_strarray *problems, git_repository *repo, const char *name, const char *new_name);
   259  const char * git_remote_url(const git_remote *remote);
   260  int git_remote_set_url(git_repository *repo, const char *remote, const char* url);
   261  const char * git_remote_pushurl(const git_remote *remote);
   262  int git_remote_set_pushurl(git_repository *repo, const char *remote, const char* url);
   263  int git_remote_fetch(git_remote *remote, const git_strarray *refspecs, const git_fetch_options *opts, const char *reflog_message);
   264  int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_push_options *opts);
   265  const git_transfer_progress * git_remote_stats(git_remote *remote);
   266  int git_remote_add_push(git_repository *repo, const char *remote, const char *refspec);
   267  int git_remote_add_fetch(git_repository *repo, const char *remote, const char *refspec);
   268  int git_remote_init_callbacks(git_remote_callbacks *opts, unsigned int version);
   269  size_t git_remote_refspec_count(git_remote *remote);
   270  const git_refspec * git_remote_get_refspec(git_remote *remote, size_t n);
   271  
   272  int git_remote_get_fetch_refspecs(git_strarray *array, git_remote *remote);
   273  int git_remote_get_push_refspecs(git_strarray *array, git_remote *remote);
   274  
   275  void git_remote_free(git_remote *remote);
   276  
   277  const char * git_refspec_src(const git_refspec *refspec);
   278  const char * git_refspec_dst(const git_refspec *refspec);
   279  int git_refspec_force(const git_refspec *refspec);
   280  const char * git_refspec_string(const git_refspec *refspec);
   281  git_direction git_refspec_direction(const git_refspec *spec);
   282  
   283  int git_refspec_src_matches(const git_refspec *refspec, const char *refname);
   284  int git_refspec_dst_matches(const git_refspec *refspec, const char *refname);
   285  
   286  int git_refspec_transform(git_buf *buf, const git_refspec *spec, const char *name);
   287  int git_refspec_rtransform(git_buf *buf, const git_refspec *spec, const char *name);
   288  
   289  int git_cred_userpass_plaintext_new(
   290  	git_cred **out,
   291  	const char *username,
   292  	const char *password);
   293  int git_cred_ssh_key_new(
   294  	git_cred **out,
   295  	const char *username,
   296  	const char *publickey,
   297  	const char *privatekey,
   298  	const char *passphrase);
   299  int git_cred_ssh_key_from_agent(
   300      git_cred **out,
   301      const char *username);
   302  
   303  /*
   304   * git_diff
   305   */
   306  
   307  typedef enum {
   308  	GIT_SUBMODULE_IGNORE_UNSPECIFIED     = -1,
   309  
   310  	GIT_SUBMODULE_IGNORE_NONE      = 1,
   311  	GIT_SUBMODULE_IGNORE_UNTRACKED = 2,
   312  	GIT_SUBMODULE_IGNORE_DIRTY     = 3,
   313  	GIT_SUBMODULE_IGNORE_ALL       = 4,
   314  } git_submodule_ignore_t;
   315  
   316  typedef enum {
   317  	GIT_DELTA_UNMODIFIED = 0,
   318  	GIT_DELTA_ADDED = 1,
   319  	GIT_DELTA_DELETED = 2,
   320  	GIT_DELTA_MODIFIED = 3,
   321  	GIT_DELTA_RENAMED = 4,
   322  	GIT_DELTA_COPIED = 5,
   323  	GIT_DELTA_IGNORED = 6,
   324  	GIT_DELTA_UNTRACKED = 7,
   325  	GIT_DELTA_TYPECHANGE = 8,
   326  } git_delta_t;
   327  
   328  typedef struct {
   329  	git_oid     id;
   330  	const char *path;
   331  	git_off_t   size;
   332  	uint32_t    flags;
   333  	uint16_t    mode;
   334  } git_diff_file;
   335  
   336  typedef struct {
   337  	git_delta_t   status;
   338  	uint32_t      flags;
   339  	uint16_t      similarity;
   340  	uint16_t      nfiles;
   341  	git_diff_file old_file;
   342  	git_diff_file new_file;
   343  } git_diff_delta;
   344  
   345  typedef int (*git_diff_notify_cb)(
   346  	const git_diff *diff_so_far,
   347  	const git_diff_delta *delta_to_add,
   348  	const char *matched_pathspec,
   349  	void *payload);
   350  
   351  typedef int (*git_diff_progress_cb)(
   352  	const git_diff *diff_so_far,
   353  	const char *old_path,
   354  	const char *new_path,
   355  	void *payload);
   356  
   357  typedef struct {
   358  	unsigned int version;
   359  	uint32_t flags;
   360  	git_submodule_ignore_t ignore_submodules;
   361  	git_strarray       pathspec;
   362  	git_diff_notify_cb   notify_cb;
   363  	git_diff_progress_cb progress_cb;
   364  	void                *payload;
   365  	uint32_t    context_lines;
   366  	uint32_t    interhunk_lines;
   367  	uint16_t    id_abbrev;
   368  	git_off_t   max_size;
   369  	const char *old_prefix;
   370  	const char *new_prefix;
   371  } git_diff_options;
   372  
   373  typedef struct {
   374  	int (*file_signature)(
   375  		void **out, const git_diff_file *file,
   376  		const char *fullpath, void *payload);
   377  	int (*buffer_signature)(
   378  		void **out, const git_diff_file *file,
   379  		const char *buf, size_t buflen, void *payload);
   380  	void (*free_signature)(void *sig, void *payload);
   381  	int (*similarity)(int *score, void *siga, void *sigb, void *payload);
   382  	void *payload;
   383  } git_diff_similarity_metric;
   384  
   385  int git_diff_init_options(git_diff_options *opts, unsigned int version);
   386  int git_diff_index_to_workdir(git_diff **diff, git_repository *repo, git_index *index, const git_diff_options *opts);
   387  int git_diff_tree_to_index(git_diff **diff, git_repository *repo, git_tree *old_tree, git_index *index, const git_diff_options *opts);
   388  
   389  /*
   390   * git_checkout
   391   */
   392  
   393  typedef enum { ... } git_checkout_notify_t;
   394  
   395  typedef int (*git_checkout_notify_cb)(
   396  	git_checkout_notify_t why,
   397  	const char *path,
   398  	const git_diff_file *baseline,
   399  	const git_diff_file *target,
   400  	const git_diff_file *workdir,
   401  	void *payload);
   402  
   403  typedef void (*git_checkout_progress_cb)(
   404  	const char *path,
   405  	size_t completed_steps,
   406  	size_t total_steps,
   407  	void *payload);
   408  
   409  typedef struct {
   410  	size_t mkdir_calls;
   411  	size_t stat_calls;
   412  	size_t chmod_calls;
   413  } git_checkout_perfdata;
   414  
   415  typedef void (*git_checkout_perfdata_cb)(
   416  	const git_checkout_perfdata *perfdata,
   417  	void *payload);
   418  
   419  typedef struct git_checkout_options {
   420  	unsigned int version;
   421  	unsigned int checkout_strategy;
   422  	int disable_filters;
   423  	unsigned int dir_mode;
   424  	unsigned int file_mode;
   425  	int file_open_flags;
   426  	unsigned int notify_flags;
   427  	git_checkout_notify_cb notify_cb;
   428  	void *notify_payload;
   429  	git_checkout_progress_cb progress_cb;
   430  	void *progress_payload;
   431  	git_strarray paths;
   432  	git_tree *baseline;
   433  	git_index *baseline_index;
   434  	const char *target_directory;
   435  	const char *ancestor_label;
   436  	const char *our_label;
   437  	const char *their_label;
   438  	git_checkout_perfdata_cb perfdata_cb;
   439  	void *perfdata_payload;
   440  } git_checkout_options;
   441  
   442  int git_checkout_init_options(git_checkout_options *opts, unsigned int version);
   443  int git_checkout_tree(git_repository *repo, const git_object *treeish, const git_checkout_options *opts);
   444  int git_checkout_head(git_repository *repo, const git_checkout_options *opts);
   445  int git_checkout_index(git_repository *repo, git_index *index, const git_checkout_options *opts);
   446  
   447  /*
   448   * git_clone
   449   */
   450  
   451  typedef int (*git_remote_create_cb)(
   452  	git_remote **out,
   453  	git_repository *repo,
   454  	const char *name,
   455  	const char *url,
   456  	void *payload);
   457  
   458  typedef int (*git_repository_create_cb)(
   459  	git_repository **out,
   460  	const char *path,
   461  	int bare,
   462  	void *payload);
   463  
   464  typedef enum {
   465  	GIT_CLONE_LOCAL_AUTO,
   466  	GIT_CLONE_LOCAL,
   467  	GIT_CLONE_NO_LOCAL,
   468  	GIT_CLONE_LOCAL_NO_LINKS,
   469  } git_clone_local_t;
   470  
   471  typedef struct git_clone_options {
   472  	unsigned int version;
   473  	git_checkout_options checkout_opts;
   474  	git_fetch_options fetch_opts;
   475  	int bare;
   476  	git_clone_local_t local;
   477  	const char* checkout_branch;
   478  	git_repository_create_cb repository_cb;
   479  	void *repository_cb_payload;
   480  	git_remote_create_cb remote_cb;
   481  	void *remote_cb_payload;
   482  } git_clone_options;
   483  
   484  #define GIT_CLONE_OPTIONS_VERSION ...
   485  int git_clone_init_options(git_clone_options *opts, unsigned int version);
   486  
   487  int git_clone(git_repository **out,
   488  	const char *url,
   489  	const char *local_path,
   490  	const git_clone_options *options);
   491  
   492  /*
   493   * git_config
   494   */
   495  
   496  typedef ... git_config;
   497  typedef ... git_config_iterator;
   498  
   499  typedef enum {
   500      GIT_CONFIG_LEVEL_PROGRAMDATA = 1,
   501  	GIT_CONFIG_LEVEL_SYSTEM = 2,
   502  	GIT_CONFIG_LEVEL_XDG = 3,
   503  	GIT_CONFIG_LEVEL_GLOBAL = 4,
   504  	GIT_CONFIG_LEVEL_LOCAL = 5,
   505  	GIT_CONFIG_LEVEL_APP = 6,
   506  	GIT_CONFIG_HIGHEST_LEVEL = -1,
   507  } git_config_level_t;
   508  
   509  typedef struct git_config_entry {
   510  	const char *name;
   511  	const char *value;
   512  	git_config_level_t level;
   513  	void (*free)(struct git_config_entry *entry);
   514  	void *payload;
   515  } git_config_entry;
   516  
   517  void git_config_entry_free(git_config_entry *);
   518  
   519  int git_repository_config(git_config **out, git_repository *repo);
   520  int git_repository_config_snapshot(git_config **out, git_repository *repo);
   521  void git_config_free(git_config *cfg);
   522  
   523  int git_config_get_entry(git_config_entry **out, const git_config *cfg, const char *name);
   524  int git_config_get_string(const char **out, const git_config *cfg, const char *name);
   525  int git_config_set_string(git_config *cfg, const char *name, const char *value);
   526  int git_config_set_bool(git_config *cfg, const char *name, int value);
   527  int git_config_set_int64(git_config *cfg, const char *name, int64_t value);
   528  
   529  int git_config_parse_bool(int *out, const char *value);
   530  int git_config_parse_int64(int64_t *out, const char *value);
   531  
   532  int git_config_delete_entry(git_config *cfg, const char *name);
   533  int git_config_add_file_ondisk(git_config *cfg,
   534  	const char *path,
   535  	git_config_level_t level,
   536  	int force);
   537  
   538  int git_config_iterator_new(git_config_iterator **out, const git_config *cfg);
   539  int git_config_next(git_config_entry **entry, git_config_iterator *iter);
   540  void git_config_iterator_free(git_config_iterator *iter);
   541  
   542  int git_config_multivar_iterator_new(
   543  	git_config_iterator **out,
   544  	const git_config *cfg,
   545  	const char *name,
   546  	const char *regexp);
   547  
   548  int git_config_set_multivar(
   549  	git_config *cfg,
   550  	const char *name,
   551  	const char *regexp,
   552  	const char *value);
   553  
   554  int git_config_new(git_config **out);
   555  int git_config_snapshot(git_config **out, git_config *config);
   556  int git_config_open_ondisk(git_config **out, const char *path);
   557  int git_config_find_system(git_buf *out);
   558  int git_config_find_global(git_buf *out);
   559  int git_config_find_xdg(git_buf *out);
   560  
   561  /*
   562   * git_repository_init
   563   */
   564  typedef enum {
   565  	GIT_REPOSITORY_INIT_BARE,
   566  	GIT_REPOSITORY_INIT_NO_REINIT,
   567  	GIT_REPOSITORY_INIT_NO_DOTGIT_DIR,
   568  	GIT_REPOSITORY_INIT_MKDIR,
   569  	GIT_REPOSITORY_INIT_MKPATH,
   570  	GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE,
   571  	GIT_REPOSITORY_INIT_RELATIVE_GITLINK,
   572  	...
   573  } git_repository_init_flag_t;
   574  
   575  typedef enum {
   576  	GIT_REPOSITORY_INIT_SHARED_UMASK,
   577  	GIT_REPOSITORY_INIT_SHARED_GROUP,
   578  	GIT_REPOSITORY_INIT_SHARED_ALL,
   579  	...
   580  } git_repository_init_mode_t;
   581  
   582  typedef struct {
   583  	unsigned int version;
   584  	uint32_t    flags;
   585  	uint32_t    mode;
   586  	const char *workdir_path;
   587  	const char *description;
   588  	const char *template_path;
   589  	const char *initial_head;
   590  	const char *origin_url;
   591  } git_repository_init_options;
   592  
   593  #define GIT_REPOSITORY_INIT_OPTIONS_VERSION ...
   594  int git_repository_init_init_options(git_repository_init_options *opts, int version);
   595  
   596  int git_repository_init(
   597  	git_repository **out,
   598  	const char *path,
   599  	unsigned is_bare);
   600  
   601  int git_repository_init_ext(
   602  	git_repository **out,
   603  	const char *repo_path,
   604  	git_repository_init_options *opts);
   605  
   606  int git_repository_set_head(git_repository *repo, const char *refname);
   607  int git_repository_set_head_detached(git_repository *repo, const git_oid *commitish);
   608  int git_repository_ident(const char **name, const char **email, const git_repository *repo);
   609  int git_repository_set_ident(git_repository *repo, const char *name, const char *email);
   610  int git_graph_ahead_behind(size_t *ahead, size_t *behind, git_repository *repo, const git_oid *local, const git_oid *upstream);
   611  
   612  /*
   613   * git_submodule
   614   */
   615  
   616  int git_submodule_lookup(git_submodule **out, git_repository *repo, char *path);
   617  void git_submodule_free(git_submodule *subm);
   618  int git_submodule_open(git_repository **out, git_submodule *subm);
   619  const char *git_submodule_name(git_submodule *subm);
   620  const char *git_submodule_path(git_submodule *subm);
   621  const char *git_submodule_url(git_submodule *subm);
   622  const char *git_submodule_branch(git_submodule *subm);
   623  
   624  /*
   625   * git_index
   626   */
   627  typedef int64_t git_time_t;
   628  
   629  typedef struct {
   630  	int32_t seconds;
   631  	uint32_t nanoseconds;
   632  } git_index_time;
   633  
   634  typedef struct git_index_entry {
   635  	git_index_time ctime;
   636  	git_index_time mtime;
   637  
   638  	uint32_t dev;
   639  	uint32_t ino;
   640  	uint32_t mode;
   641  	uint32_t uid;
   642  	uint32_t gid;
   643  	uint32_t file_size;
   644  
   645  	git_oid id;
   646  
   647  	uint16_t flags;
   648  	uint16_t flags_extended;
   649  
   650  	const char *path;
   651  } git_index_entry;
   652  
   653  typedef int (*git_index_matched_path_cb)(
   654  	const char *path, const char *matched_pathspec, void *payload);
   655  
   656  void git_index_free(git_index *index);
   657  int git_repository_index(git_index **out, git_repository *repo);
   658  int git_index_open(git_index **out, const char *index_path);
   659  int git_index_read(git_index *index, int force);
   660  int git_index_write(git_index *index);
   661  size_t git_index_entrycount(const git_index *index);
   662  int git_index_find(size_t *at_pos, git_index *index, const char *path);
   663  int git_index_add_bypath(git_index *index, const char *path);
   664  int git_index_add(git_index *index, const git_index_entry *source_entry);
   665  int git_index_remove(git_index *index, const char *path, int stage);
   666  int git_index_read_tree(git_index *index, const git_tree *tree);
   667  int git_index_clear(git_index *index);
   668  int git_index_write_tree(git_oid *out, git_index *index);
   669  int git_index_write_tree_to(git_oid *out, git_index *index, git_repository *repo);
   670  const git_index_entry *git_index_get_bypath(git_index *index, const char *path, int stage);
   671  const git_index_entry *git_index_get_byindex(git_index *index, size_t n);
   672  int git_index_add_all(git_index *index,	const git_strarray *pathspec, unsigned int flags,
   673  	git_index_matched_path_cb callback,	void *payload);
   674  int git_index_has_conflicts(const git_index *index);
   675  void git_index_conflict_iterator_free(git_index_conflict_iterator *iterator);
   676  int git_index_conflict_iterator_new(git_index_conflict_iterator **iterator_out, git_index *index);
   677  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);
   678  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);
   679  int git_index_conflict_remove(git_index *index, const char *path);
   680  
   681  /*
   682   * git_blame
   683   */
   684  
   685  typedef ... git_blame;
   686  
   687  typedef struct git_blame_options {
   688  	unsigned int version;
   689  
   690  	uint32_t flags;
   691  	uint16_t min_match_characters;
   692  	git_oid newest_commit;
   693  	git_oid oldest_commit;
   694  	size_t min_line;
   695  	size_t max_line;
   696  } git_blame_options;
   697  
   698  #define GIT_BLAME_OPTIONS_VERSION ...
   699  
   700  typedef struct git_blame_hunk {
   701  	size_t lines_in_hunk;
   702  
   703  	git_oid final_commit_id;
   704  	size_t final_start_line_number;
   705  	git_signature *final_signature;
   706  
   707  	git_oid orig_commit_id;
   708  	const char *orig_path;
   709  	size_t orig_start_line_number;
   710  	git_signature *orig_signature;
   711  
   712  	char boundary;
   713  } git_blame_hunk;
   714  
   715  int git_blame_init_options(git_blame_options *opts, unsigned int version);
   716  uint32_t git_blame_get_hunk_count(git_blame *blame);
   717  const git_blame_hunk *git_blame_get_hunk_byindex(git_blame *blame, uint32_t index);
   718  const git_blame_hunk *git_blame_get_hunk_byline(git_blame *blame, size_t lineno);
   719  int git_blame_file(git_blame **out, git_repository *repo, const char *path, git_blame_options *options);
   720  void git_blame_free(git_blame *blame);
   721  
   722  /*
   723   * Merging
   724   */
   725  
   726  typedef enum { ... } git_merge_flag_t;
   727  
   728  typedef enum {
   729  	GIT_MERGE_FILE_FAVOR_NORMAL = 0,
   730  	GIT_MERGE_FILE_FAVOR_OURS = 1,
   731  	GIT_MERGE_FILE_FAVOR_THEIRS = 2,
   732  	GIT_MERGE_FILE_FAVOR_UNION = 3,
   733  } git_merge_file_favor_t;
   734  
   735  typedef struct {
   736  	unsigned int version;
   737  	git_merge_flag_t flags;
   738  	unsigned int rename_threshold;
   739  	unsigned int target_limit;
   740  	git_diff_similarity_metric *metric;
   741      unsigned int recursion_limit;
   742  	git_merge_file_favor_t file_favor;
   743  	unsigned int file_flags;
   744  } git_merge_options;
   745  
   746  #define GIT_MERGE_OPTIONS_VERSION 1
   747  
   748  typedef struct {
   749  	unsigned int automergeable;
   750  	const char *path;
   751  	unsigned int mode;
   752  	const char *ptr;
   753  	size_t len;
   754  } git_merge_file_result;
   755  
   756  typedef enum {
   757  	GIT_MERGE_FILE_DEFAULT = 0,
   758  	GIT_MERGE_FILE_STYLE_MERGE = 1,
   759  	GIT_MERGE_FILE_STYLE_DIFF3 = 2,
   760  	GIT_MERGE_FILE_SIMPLIFY_ALNUM = 4,
   761  	GIT_MERGE_FILE_IGNORE_WHITESPACE = 8,
   762  	GIT_MERGE_FILE_IGNORE_WHITESPACE_CHANGE = 16,
   763  	GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL = 32,
   764  	GIT_MERGE_FILE_DIFF_PATIENCE = 64,
   765  	GIT_MERGE_FILE_DIFF_MINIMAL = 128,
   766  } git_merge_file_flag_t;
   767  
   768  typedef struct {
   769  	unsigned int version;
   770  	const char *ancestor_label;
   771  	const char *our_label;
   772  	const char *their_label;
   773  	git_merge_file_favor_t favor;
   774  	git_merge_file_flag_t flags;
   775  } git_merge_file_options;
   776  
   777  #define GIT_MERGE_OPTIONS_VERSION ...
   778  
   779  int git_merge_init_options(git_merge_options *opts,	unsigned int version);
   780  int git_merge_commits(git_index **out, git_repository *repo, const git_commit *our_commit, const git_commit *their_commit, const git_merge_options *opts);
   781  int git_merge_trees(git_index **out, git_repository *repo, const git_tree *ancestor_tree, const git_tree *our_tree, const git_tree *their_tree, const git_merge_options *opts);
   782  int git_merge_file_from_index(git_merge_file_result *out, git_repository *repo, const git_index_entry *ancestor, const git_index_entry *ours, const git_index_entry *theirs, const git_merge_file_options *opts);
   783  void git_merge_file_result_free(git_merge_file_result *result);
   784  
   785  /*
   786   * Describe
   787   */
   788  
   789  typedef enum {
   790  	GIT_DESCRIBE_DEFAULT,
   791  	GIT_DESCRIBE_TAGS,
   792  	GIT_DESCRIBE_ALL,
   793  } git_describe_strategy_t;
   794  
   795  typedef struct git_describe_options {
   796  	unsigned int version;
   797  	unsigned int max_candidates_tags;
   798  	unsigned int describe_strategy;
   799  	const char *pattern;
   800  	int only_follow_first_parent;
   801  	int show_commit_oid_as_fallback;
   802  } git_describe_options;
   803  
   804  #define GIT_DESCRIBE_OPTIONS_VERSION ...
   805  
   806  int git_describe_init_options(git_describe_options *opts, unsigned int version);
   807  
   808  typedef struct {
   809  	unsigned int version;
   810  	unsigned int abbreviated_size;
   811  	int always_use_long_format;
   812  	const char *dirty_suffix;
   813  } git_describe_format_options;
   814  
   815  #define GIT_DESCRIBE_FORMAT_OPTIONS_VERSION ...
   816  
   817  int git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
   818  
   819  typedef ... git_describe_result;
   820  
   821  int git_describe_commit(git_describe_result **result, git_object *committish, git_describe_options *opts);
   822  int git_describe_workdir(git_describe_result **out, git_repository *repo, git_describe_options *opts);
   823  int git_describe_format(git_buf *out, const git_describe_result *result, const git_describe_format_options *opts);
   824  void git_describe_result_free(git_describe_result *result);
   825  
   826  #define GIT_ATTR_CHECK_FILE_THEN_INDEX ...
   827  #define GIT_ATTR_CHECK_INDEX_THEN_FILE ...
   828  #define GIT_ATTR_CHECK_INDEX_ONLY      ...
   829  #define GIT_ATTR_CHECK_NO_SYSTEM       ...
   830  
   831  typedef enum {
   832  	GIT_ATTR_UNSPECIFIED_T = 0,
   833  	GIT_ATTR_TRUE_T,
   834  	GIT_ATTR_FALSE_T,
   835  	GIT_ATTR_VALUE_T,
   836  } git_attr_t;
   837  
   838  int git_attr_get(const char **value_out, git_repository *repo, uint32_t flags, const char *path, const char *name);
   839  git_attr_t git_attr_value(const char *attr);