diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/git2/common.h | 46 | ||||
| -rw-r--r-- | include/git2/config.h | 37 | ||||
| -rw-r--r-- | include/git2/diff.h | 15 | ||||
| -rw-r--r-- | include/git2/errors.h | 4 | ||||
| -rw-r--r-- | include/git2/odb_backend.h | 4 | ||||
| -rw-r--r-- | include/git2/sys/config.h | 4 |
6 files changed, 80 insertions, 30 deletions
diff --git a/include/git2/common.h b/include/git2/common.h index f9e9929ea..b52e13918 100644 --- a/include/git2/common.h +++ b/include/git2/common.h @@ -103,10 +103,10 @@ GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev); /** * Combinations of these values describe the capabilities of libgit2. */ -enum { +typedef enum { GIT_CAP_THREADS = ( 1 << 0 ), GIT_CAP_HTTPS = ( 1 << 1 ) -}; +} git_cap_t; /** * Query compile time options for libgit2. @@ -114,17 +114,18 @@ enum { * @return A combination of GIT_CAP_* values. * * - GIT_CAP_THREADS - * Libgit2 was compiled with thread support. Note that thread support is still to be seen as a - * 'work in progress'. + * Libgit2 was compiled with thread support. Note that thread support is + * still to be seen as a 'work in progress' - basic object lookups are + * believed to be threadsafe, but other operations may not be. * * - GIT_CAP_HTTPS - * Libgit2 supports the https:// protocol. This requires the open ssl library to be - * found when compiling libgit2. + * Libgit2 supports the https:// protocol. This requires the openssl + * library to be found when compiling libgit2. */ GIT_EXTERN(int) git_libgit2_capabilities(void); -enum { +typedef enum { GIT_OPT_GET_MWINDOW_SIZE, GIT_OPT_SET_MWINDOW_SIZE, GIT_OPT_GET_MWINDOW_MAPPED_LIMIT, @@ -135,7 +136,7 @@ enum { GIT_OPT_SET_CACHE_MAX_SIZE, GIT_OPT_ENABLE_CACHING, GIT_OPT_GET_CACHED_MEMORY -}; +} git_libgit2_opt_t; /** * Set or query a library global option @@ -179,6 +180,35 @@ enum { * > - `level` must be GIT_CONFIG_LEVEL_SYSTEM, GIT_CONFIG_LEVEL_GLOBAL, * > or GIT_CONFIG_LEVEL_XDG. * + * * opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, git_otype type, size_t size) + * + * > Set the maximum data size for the given type of object to be + * > considered eligible for caching in memory. Setting to value to + * > zero means that that type of object will not be cached. + * > Defaults to 0 for GIT_OBJ_BLOB (i.e. won't cache blobs) and 4k + * > for GIT_OBJ_COMMIT, GIT_OBJ_TREE, and GIT_OBJ_TAG. + * + * * opts(GIT_OPT_SET_CACHE_MAX_SIZE, ssize_t max_storage_bytes) + * + * > Set the maximum total data size that will be cached in memory + * > across all repositories before libgit2 starts evicting objects + * > from the cache. This is a soft limit, in that the library might + * > briefly exceed it, but will start aggressively evicting objects + * > from cache when that happens. The default cache size is 256Mb. + * + * * opts(GIT_OPT_ENABLE_CACHING, int enabled) + * + * > Enable or disable caching completely. + * > + * > Because caches are repository-specific, disabling the cache + * > cannot immediately clear all cached objects, but each cache will + * > be cleared on the next attempt to update anything in it. + * + * * opts(GIT_OPT_GET_CACHED_MEMORY, ssize_t *current, ssize_t *allowed) + * + * > Get the current bytes in cache and the maximum that would be + * > allowed in the cache. + * * @param option Option key * @param ... value to set the option * @return 0 on success, <0 on failure diff --git a/include/git2/config.h b/include/git2/config.h index 8d1a1a5a6..518dcaf16 100644 --- a/include/git2/config.h +++ b/include/git2/config.h @@ -27,18 +27,33 @@ GIT_BEGIN_DECL * git_config_open_default() and git_repository_config() honor those * priority levels as well. */ -enum { - GIT_CONFIG_LEVEL_SYSTEM = 1, /**< System-wide configuration file. */ - GIT_CONFIG_LEVEL_XDG = 2, /**< XDG compatible configuration file (.config/git/config). */ - GIT_CONFIG_LEVEL_GLOBAL = 3, /**< User-specific configuration file, also called Global configuration file. */ - GIT_CONFIG_LEVEL_LOCAL = 4, /**< Repository specific configuration file. */ - GIT_CONFIG_HIGHEST_LEVEL = -1, /**< Represents the highest level of a config file. */ -}; +typedef enum { + /** System-wide configuration file; /etc/gitconfig on Linux systems */ + GIT_CONFIG_LEVEL_SYSTEM = 1, + + /** XDG compatible configuration file; typically ~/.config/git/config */ + GIT_CONFIG_LEVEL_XDG = 2, + + /** User-specific configuration file (also called Global configuration + * file); typically ~/.gitconfig + */ + GIT_CONFIG_LEVEL_GLOBAL = 3, + + /** Repository specific configuration file; $WORK_DIR/.git/config on + * non-bare repos + */ + GIT_CONFIG_LEVEL_LOCAL = 4, + + /** Represents the highest level available config file (i.e. the most + * specific config file available that actually is loaded) + */ + GIT_CONFIG_HIGHEST_LEVEL = -1, +} git_config_level_t; typedef struct { const char *name; const char *value; - unsigned int level; + git_config_level_t level; } git_config_entry; typedef int (*git_config_foreach_cb)(const git_config_entry *, void *); @@ -155,7 +170,7 @@ GIT_EXTERN(int) git_config_new(git_config **out); GIT_EXTERN(int) git_config_add_file_ondisk( git_config *cfg, const char *path, - unsigned int level, + git_config_level_t level, int force); /** @@ -192,7 +207,7 @@ GIT_EXTERN(int) git_config_open_ondisk(git_config **out, const char *path); GIT_EXTERN(int) git_config_open_level( git_config **out, const git_config *parent, - unsigned int level); + git_config_level_t level); /** * Open the global/XDG configuration file according to git's rules @@ -241,7 +256,7 @@ GIT_EXTERN(void) git_config_free(git_config *cfg); * @return 0 or an error code */ GIT_EXTERN(int) git_config_get_entry( - const git_config_entry **out, + const git_config_entry **out, const git_config *cfg, const char *name); diff --git a/include/git2/diff.h b/include/git2/diff.h index 0d4875b43..d26456cb0 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -89,9 +89,10 @@ typedef enum { /** Include unmodified files in the diff list */ GIT_DIFF_INCLUDE_UNMODIFIED = (1 << 9), - /** Even with GIT_DIFF_INCLUDE_UNTRACKED, an entire untracked directory - * will be marked with only a single entry in the diff list; this flag - * adds all files under the directory as UNTRACKED entries, too. + /** Even with GIT_DIFF_INCLUDE_UNTRACKED, an entire untracked + * directory will be marked with only a single entry in the diff list + * (a la what core Git does in `git status`); this flag adds *all* + * files under untracked directories as UNTRACKED entries, too. */ GIT_DIFF_RECURSE_UNTRACKED_DIRS = (1 << 10), @@ -103,7 +104,11 @@ typedef enum { /** Use case insensitive filename comparisons */ GIT_DIFF_DELTAS_ARE_ICASE = (1 << 12), - /** When generating patch text, include the content of untracked files */ + /** When generating patch text, include the content of untracked + * files. This automatically turns on GIT_DIFF_INCLUDE_UNTRACKED but + * it does not turn on GIT_DIFF_RECURSE_UNTRACKED_DIRS. Add that + * flag if you want the content of every single UNTRACKED file. + */ GIT_DIFF_INCLUDE_UNTRACKED_CONTENT = (1 << 13), /** Disable updating of the `binary` flag in delta records. This is @@ -139,7 +144,7 @@ typedef enum { * consider UNTRACKED only if it has an actual untracked file in it. * This scan is extra work for a case you often don't care about. This * flag makes libgit2 immediately label an untracked directory as - * UNTRACKED without looking insde it (which differs from core Git). + * UNTRACKED without looking inside it (which differs from core Git). * Of course, ignore rules are still checked for the directory itself. */ GIT_DIFF_FAST_UNTRACKED_DIRS = (1 << 19), diff --git a/include/git2/errors.h b/include/git2/errors.h index 917f0699c..caf9e62b8 100644 --- a/include/git2/errors.h +++ b/include/git2/errors.h @@ -18,7 +18,7 @@ GIT_BEGIN_DECL /** Generic return codes */ -enum { +typedef enum { GIT_OK = 0, GIT_ERROR = -1, GIT_ENOTFOUND = -3, @@ -35,7 +35,7 @@ enum { GIT_PASSTHROUGH = -30, GIT_ITEROVER = -31, -}; +} git_error_code; typedef struct { char *message; diff --git a/include/git2/odb_backend.h b/include/git2/odb_backend.h index 4c2493a25..af1e3e5b9 100644 --- a/include/git2/odb_backend.h +++ b/include/git2/odb_backend.h @@ -59,11 +59,11 @@ GIT_EXTERN(int) git_odb_backend_loose(git_odb_backend **out, const char *objects GIT_EXTERN(int) git_odb_backend_one_pack(git_odb_backend **out, const char *index_file); /** Streaming mode */ -enum { +typedef enum { GIT_STREAM_RDONLY = (1 << 1), GIT_STREAM_WRONLY = (1 << 2), GIT_STREAM_RW = (GIT_STREAM_RDONLY | GIT_STREAM_WRONLY), -}; +} git_odb_stream_t; /** A stream to read/write from a backend */ struct git_odb_stream { diff --git a/include/git2/sys/config.h b/include/git2/sys/config.h index 1c9deba7c..11e59cf03 100644 --- a/include/git2/sys/config.h +++ b/include/git2/sys/config.h @@ -29,7 +29,7 @@ struct git_config_backend { struct git_config *cfg; /* Open means open the file/database and parse if necessary */ - int (*open)(struct git_config_backend *, unsigned int level); + int (*open)(struct git_config_backend *, git_config_level_t level); int (*get)(const struct git_config_backend *, const char *key, const git_config_entry **entry); int (*get_multivar)(struct git_config_backend *, const char *key, const char *regexp, git_config_foreach_cb callback, void *payload); int (*set)(struct git_config_backend *, const char *key, const char *value); @@ -63,7 +63,7 @@ struct git_config_backend { GIT_EXTERN(int) git_config_add_backend( git_config *cfg, git_config_backend *file, - unsigned int level, + git_config_level_t level, int force); /** @} */ |
