summaryrefslogtreecommitdiffstats
path: root/include/git2/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/git2/config.h')
-rw-r--r--include/git2/config.h56
1 files changed, 48 insertions, 8 deletions
diff --git a/include/git2/config.h b/include/git2/config.h
index cfab0c7..3236143 100644
--- a/include/git2/config.h
+++ b/include/git2/config.h
@@ -22,8 +22,19 @@ GIT_BEGIN_DECL
/**
* Priority level of a config file.
+ *
* These priority levels correspond to the natural escalation logic
- * (from higher to lower) when searching for config entries in git.git.
+ * (from higher to lower) when reading or searching for config entries
+ * in git.git. Meaning that for the same key, the configuration in
+ * the local configuration is preferred over the configuration in
+ * the system configuration file.
+ *
+ * Callers can add their own custom configuration, beginning at the
+ * `GIT_CONFIG_LEVEL_APP` level.
+ *
+ * Writes, by default, occur in the highest priority level backend
+ * that is writable. This ordering can be overridden with
+ * `git_config_set_writeorder`.
*
* git_config_open_default() and git_repository_config() honor those
* priority levels as well.
@@ -48,9 +59,13 @@ typedef enum {
*/
GIT_CONFIG_LEVEL_LOCAL = 5,
+ /** Worktree specific configuration file; $GIT_DIR/config.worktree
+ */
+ GIT_CONFIG_LEVEL_WORKTREE = 6,
+
/** Application specific configuration file; freely defined by applications
*/
- GIT_CONFIG_LEVEL_APP = 6,
+ GIT_CONFIG_LEVEL_APP = 7,
/** Represents the highest level available config file (i.e. the most
* specific config file available that actually is loaded)
@@ -62,12 +77,32 @@ typedef enum {
* An entry in a configuration file
*/
typedef struct git_config_entry {
- const char *name; /**< Name of the entry (normalised) */
- const char *value; /**< String value of the entry */
- unsigned int include_depth; /**< Depth of includes where this variable was found */
- git_config_level_t level; /**< Which config file this was found in */
- void GIT_CALLBACK(free)(struct git_config_entry *entry); /**< Free function for this entry */
- void *payload; /**< Opaque value for the free function. Do not read or write */
+ /** Name of the configuration entry (normalized) */
+ const char *name;
+
+ /** Literal (string) value of the entry */
+ const char *value;
+
+ /** The type of backend that this entry exists in (eg, "file") */
+ const char *backend_type;
+
+ /**
+ * The path to the origin of this entry. For config files, this is
+ * the path to the file.
+ */
+ const char *origin_path;
+
+ /** Depth of includes where this variable was found */
+ unsigned int include_depth;
+
+ /** Configuration level for the file this was found in */
+ git_config_level_t level;
+
+ /**
+ * Free function for this entry; for internal purposes. Callers
+ * should call `git_config_entry_free` to free data.
+ */
+ void GIT_CALLBACK(free)(struct git_config_entry *entry);
} git_config_entry;
/**
@@ -276,6 +311,11 @@ GIT_EXTERN(int) git_config_open_level(
*/
GIT_EXTERN(int) git_config_open_global(git_config **out, git_config *config);
+GIT_EXTERN(int) git_config_set_writeorder(
+ git_config *cfg,
+ git_config_level_t *levels,
+ size_t len);
+
/**
* Create a snapshot of the configuration
*