|
||||
File indexing completed on 2025-01-18 09:59:39
0001 /* 0002 * Copyright (C) the libgit2 contributors. All rights reserved. 0003 * 0004 * This file is part of libgit2, distributed under the GNU GPL v2 with 0005 * a Linking Exception. For full terms see the included COPYING file. 0006 */ 0007 #ifndef INCLUDE_git_types_h__ 0008 #define INCLUDE_git_types_h__ 0009 0010 #include "common.h" 0011 0012 /** 0013 * @file git2/types.h 0014 * @brief libgit2 base & compatibility types 0015 * @ingroup Git 0016 * @{ 0017 */ 0018 GIT_BEGIN_DECL 0019 0020 /** 0021 * Cross-platform compatibility types for off_t / time_t 0022 * 0023 * NOTE: This needs to be in a public header so that both the library 0024 * implementation and client applications both agree on the same types. 0025 * Otherwise we get undefined behavior. 0026 * 0027 * Use the "best" types that each platform provides. Currently we truncate 0028 * these intermediate representations for compatibility with the git ABI, but 0029 * if and when it changes to support 64 bit types, our code will naturally 0030 * adapt. 0031 * NOTE: These types should match those that are returned by our internal 0032 * stat() functions, for all platforms. 0033 */ 0034 #include <sys/types.h> 0035 #ifdef __amigaos4__ 0036 #include <stdint.h> 0037 #endif 0038 0039 #if defined(_MSC_VER) 0040 0041 typedef __int64 git_off_t; 0042 typedef __time64_t git_time_t; 0043 0044 #elif defined(__MINGW32__) 0045 0046 typedef off64_t git_off_t; 0047 typedef __time64_t git_time_t; 0048 0049 #elif defined(__HAIKU__) 0050 0051 typedef __haiku_std_int64 git_off_t; 0052 typedef __haiku_std_int64 git_time_t; 0053 0054 #else /* POSIX */ 0055 0056 /* 0057 * Note: Can't use off_t since if a client program includes <sys/types.h> 0058 * before us (directly or indirectly), they'll get 32 bit off_t in their client 0059 * app, even though /we/ define _FILE_OFFSET_BITS=64. 0060 */ 0061 typedef int64_t git_off_t; 0062 typedef int64_t git_time_t; /**< time in seconds from epoch */ 0063 0064 #endif 0065 0066 /** The maximum size of an object */ 0067 typedef uint64_t git_object_size_t; 0068 0069 #include "buffer.h" 0070 #include "oid.h" 0071 0072 /** Basic type (loose or packed) of any Git object. */ 0073 typedef enum { 0074 GIT_OBJECT_ANY = -2, /**< Object can be any of the following */ 0075 GIT_OBJECT_INVALID = -1, /**< Object is invalid. */ 0076 GIT_OBJECT_COMMIT = 1, /**< A commit object. */ 0077 GIT_OBJECT_TREE = 2, /**< A tree (directory listing) object. */ 0078 GIT_OBJECT_BLOB = 3, /**< A file revision object. */ 0079 GIT_OBJECT_TAG = 4, /**< An annotated tag object. */ 0080 GIT_OBJECT_OFS_DELTA = 6, /**< A delta, base is given by an offset. */ 0081 GIT_OBJECT_REF_DELTA = 7 /**< A delta, base is given by object id. */ 0082 } git_object_t; 0083 0084 /** An open object database handle. */ 0085 typedef struct git_odb git_odb; 0086 0087 /** A custom backend in an ODB */ 0088 typedef struct git_odb_backend git_odb_backend; 0089 0090 /** An object read from the ODB */ 0091 typedef struct git_odb_object git_odb_object; 0092 0093 /** A stream to read/write from the ODB */ 0094 typedef struct git_odb_stream git_odb_stream; 0095 0096 /** A stream to write a packfile to the ODB */ 0097 typedef struct git_odb_writepack git_odb_writepack; 0098 0099 /** a writer for multi-pack-index files. */ 0100 typedef struct git_midx_writer git_midx_writer; 0101 0102 /** An open refs database handle. */ 0103 typedef struct git_refdb git_refdb; 0104 0105 /** A custom backend for refs */ 0106 typedef struct git_refdb_backend git_refdb_backend; 0107 0108 /** A git commit-graph */ 0109 typedef struct git_commit_graph git_commit_graph; 0110 0111 /** a writer for commit-graph files. */ 0112 typedef struct git_commit_graph_writer git_commit_graph_writer; 0113 0114 /** 0115 * Representation of an existing git repository, 0116 * including all its object contents 0117 */ 0118 typedef struct git_repository git_repository; 0119 0120 /** Representation of a working tree */ 0121 typedef struct git_worktree git_worktree; 0122 0123 /** Representation of a generic object in a repository */ 0124 typedef struct git_object git_object; 0125 0126 /** Representation of an in-progress walk through the commits in a repo */ 0127 typedef struct git_revwalk git_revwalk; 0128 0129 /** Parsed representation of a tag object. */ 0130 typedef struct git_tag git_tag; 0131 0132 /** In-memory representation of a blob object. */ 0133 typedef struct git_blob git_blob; 0134 0135 /** Parsed representation of a commit object. */ 0136 typedef struct git_commit git_commit; 0137 0138 /** Representation of each one of the entries in a tree object. */ 0139 typedef struct git_tree_entry git_tree_entry; 0140 0141 /** Representation of a tree object. */ 0142 typedef struct git_tree git_tree; 0143 0144 /** Constructor for in-memory trees */ 0145 typedef struct git_treebuilder git_treebuilder; 0146 0147 /** Memory representation of an index file. */ 0148 typedef struct git_index git_index; 0149 0150 /** An iterator for entries in the index. */ 0151 typedef struct git_index_iterator git_index_iterator; 0152 0153 /** An iterator for conflicts in the index. */ 0154 typedef struct git_index_conflict_iterator git_index_conflict_iterator; 0155 0156 /** Memory representation of a set of config files */ 0157 typedef struct git_config git_config; 0158 0159 /** Interface to access a configuration file */ 0160 typedef struct git_config_backend git_config_backend; 0161 0162 /** Representation of a reference log entry */ 0163 typedef struct git_reflog_entry git_reflog_entry; 0164 0165 /** Representation of a reference log */ 0166 typedef struct git_reflog git_reflog; 0167 0168 /** Representation of a git note */ 0169 typedef struct git_note git_note; 0170 0171 /** Representation of a git packbuilder */ 0172 typedef struct git_packbuilder git_packbuilder; 0173 0174 /** Time in a signature */ 0175 typedef struct git_time { 0176 git_time_t time; /**< time in seconds from epoch */ 0177 int offset; /**< timezone offset, in minutes */ 0178 char sign; /**< indicator for questionable '-0000' offsets in signature */ 0179 } git_time; 0180 0181 /** An action signature (e.g. for committers, taggers, etc) */ 0182 typedef struct git_signature { 0183 char *name; /**< full name of the author */ 0184 char *email; /**< email of the author */ 0185 git_time when; /**< time when the action happened */ 0186 } git_signature; 0187 0188 /** In-memory representation of a reference. */ 0189 typedef struct git_reference git_reference; 0190 0191 /** Iterator for references */ 0192 typedef struct git_reference_iterator git_reference_iterator; 0193 0194 /** Transactional interface to references */ 0195 typedef struct git_transaction git_transaction; 0196 0197 /** Annotated commits, the input to merge and rebase. */ 0198 typedef struct git_annotated_commit git_annotated_commit; 0199 0200 /** Representation of a status collection */ 0201 typedef struct git_status_list git_status_list; 0202 0203 /** Representation of a rebase */ 0204 typedef struct git_rebase git_rebase; 0205 0206 /** Basic type of any Git reference. */ 0207 typedef enum { 0208 GIT_REFERENCE_INVALID = 0, /**< Invalid reference */ 0209 GIT_REFERENCE_DIRECT = 1, /**< A reference that points at an object id */ 0210 GIT_REFERENCE_SYMBOLIC = 2, /**< A reference that points at another reference */ 0211 GIT_REFERENCE_ALL = GIT_REFERENCE_DIRECT | GIT_REFERENCE_SYMBOLIC 0212 } git_reference_t; 0213 0214 /** Basic type of any Git branch. */ 0215 typedef enum { 0216 GIT_BRANCH_LOCAL = 1, 0217 GIT_BRANCH_REMOTE = 2, 0218 GIT_BRANCH_ALL = GIT_BRANCH_LOCAL|GIT_BRANCH_REMOTE 0219 } git_branch_t; 0220 0221 /** Valid modes for index and tree entries. */ 0222 typedef enum { 0223 GIT_FILEMODE_UNREADABLE = 0000000, 0224 GIT_FILEMODE_TREE = 0040000, 0225 GIT_FILEMODE_BLOB = 0100644, 0226 GIT_FILEMODE_BLOB_EXECUTABLE = 0100755, 0227 GIT_FILEMODE_LINK = 0120000, 0228 GIT_FILEMODE_COMMIT = 0160000 0229 } git_filemode_t; 0230 0231 /** 0232 * A refspec specifies the mapping between remote and local reference 0233 * names when fetch or pushing. 0234 */ 0235 typedef struct git_refspec git_refspec; 0236 0237 /** 0238 * Git's idea of a remote repository. A remote can be anonymous (in 0239 * which case it does not have backing configuration entries). 0240 */ 0241 typedef struct git_remote git_remote; 0242 0243 /** 0244 * Interface which represents a transport to communicate with a 0245 * remote. 0246 */ 0247 typedef struct git_transport git_transport; 0248 0249 /** 0250 * Preparation for a push operation. Can be used to configure what to 0251 * push and the level of parallelism of the packfile builder. 0252 */ 0253 typedef struct git_push git_push; 0254 0255 /* documentation in the definition */ 0256 typedef struct git_remote_head git_remote_head; 0257 typedef struct git_remote_callbacks git_remote_callbacks; 0258 0259 /** 0260 * Parent type for `git_cert_hostkey` and `git_cert_x509`. 0261 */ 0262 typedef struct git_cert git_cert; 0263 0264 /** 0265 * Opaque structure representing a submodule. 0266 */ 0267 typedef struct git_submodule git_submodule; 0268 0269 /** 0270 * Submodule update values 0271 * 0272 * These values represent settings for the `submodule.$name.update` 0273 * configuration value which says how to handle `git submodule update` for 0274 * this submodule. The value is usually set in the ".gitmodules" file and 0275 * copied to ".git/config" when the submodule is initialized. 0276 * 0277 * You can override this setting on a per-submodule basis with 0278 * `git_submodule_set_update()` and write the changed value to disk using 0279 * `git_submodule_save()`. If you have overwritten the value, you can 0280 * revert it by passing `GIT_SUBMODULE_UPDATE_RESET` to the set function. 0281 * 0282 * The values are: 0283 * 0284 * - GIT_SUBMODULE_UPDATE_CHECKOUT: the default; when a submodule is 0285 * updated, checkout the new detached HEAD to the submodule directory. 0286 * - GIT_SUBMODULE_UPDATE_REBASE: update by rebasing the current checked 0287 * out branch onto the commit from the superproject. 0288 * - GIT_SUBMODULE_UPDATE_MERGE: update by merging the commit in the 0289 * superproject into the current checkout out branch of the submodule. 0290 * - GIT_SUBMODULE_UPDATE_NONE: do not update this submodule even when 0291 * the commit in the superproject is updated. 0292 * - GIT_SUBMODULE_UPDATE_DEFAULT: not used except as static initializer 0293 * when we don't want any particular update rule to be specified. 0294 */ 0295 typedef enum { 0296 GIT_SUBMODULE_UPDATE_CHECKOUT = 1, 0297 GIT_SUBMODULE_UPDATE_REBASE = 2, 0298 GIT_SUBMODULE_UPDATE_MERGE = 3, 0299 GIT_SUBMODULE_UPDATE_NONE = 4, 0300 0301 GIT_SUBMODULE_UPDATE_DEFAULT = 0 0302 } git_submodule_update_t; 0303 0304 /** 0305 * Submodule ignore values 0306 * 0307 * These values represent settings for the `submodule.$name.ignore` 0308 * configuration value which says how deeply to look at the working 0309 * directory when getting submodule status. 0310 * 0311 * You can override this value in memory on a per-submodule basis with 0312 * `git_submodule_set_ignore()` and can write the changed value to disk 0313 * with `git_submodule_save()`. If you have overwritten the value, you 0314 * can revert to the on disk value by using `GIT_SUBMODULE_IGNORE_RESET`. 0315 * 0316 * The values are: 0317 * 0318 * - GIT_SUBMODULE_IGNORE_UNSPECIFIED: use the submodule's configuration 0319 * - GIT_SUBMODULE_IGNORE_NONE: don't ignore any change - i.e. even an 0320 * untracked file, will mark the submodule as dirty. Ignored files are 0321 * still ignored, of course. 0322 * - GIT_SUBMODULE_IGNORE_UNTRACKED: ignore untracked files; only changes 0323 * to tracked files, or the index or the HEAD commit will matter. 0324 * - GIT_SUBMODULE_IGNORE_DIRTY: ignore changes in the working directory, 0325 * only considering changes if the HEAD of submodule has moved from the 0326 * value in the superproject. 0327 * - GIT_SUBMODULE_IGNORE_ALL: never check if the submodule is dirty 0328 * - GIT_SUBMODULE_IGNORE_DEFAULT: not used except as static initializer 0329 * when we don't want any particular ignore rule to be specified. 0330 */ 0331 typedef enum { 0332 GIT_SUBMODULE_IGNORE_UNSPECIFIED = -1, /**< use the submodule's configuration */ 0333 0334 GIT_SUBMODULE_IGNORE_NONE = 1, /**< any change or untracked == dirty */ 0335 GIT_SUBMODULE_IGNORE_UNTRACKED = 2, /**< dirty if tracked files change */ 0336 GIT_SUBMODULE_IGNORE_DIRTY = 3, /**< only dirty if HEAD moved */ 0337 GIT_SUBMODULE_IGNORE_ALL = 4 /**< never dirty */ 0338 } git_submodule_ignore_t; 0339 0340 /** 0341 * Options for submodule recurse. 0342 * 0343 * Represent the value of `submodule.$name.fetchRecurseSubmodules` 0344 * 0345 * * GIT_SUBMODULE_RECURSE_NO - do no recurse into submodules 0346 * * GIT_SUBMODULE_RECURSE_YES - recurse into submodules 0347 * * GIT_SUBMODULE_RECURSE_ONDEMAND - recurse into submodules only when 0348 * commit not already in local clone 0349 */ 0350 typedef enum { 0351 GIT_SUBMODULE_RECURSE_NO = 0, 0352 GIT_SUBMODULE_RECURSE_YES = 1, 0353 GIT_SUBMODULE_RECURSE_ONDEMAND = 2 0354 } git_submodule_recurse_t; 0355 0356 typedef struct git_writestream git_writestream; 0357 0358 /** A type to write in a streaming fashion, for example, for filters. */ 0359 struct git_writestream { 0360 int GIT_CALLBACK(write)(git_writestream *stream, const char *buffer, size_t len); 0361 int GIT_CALLBACK(close)(git_writestream *stream); 0362 void GIT_CALLBACK(free)(git_writestream *stream); 0363 }; 0364 0365 /** Representation of .mailmap file state. */ 0366 typedef struct git_mailmap git_mailmap; 0367 0368 /** @} */ 0369 GIT_END_DECL 0370 0371 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |