diff options
| author | Vicent Martà <vicent@github.com> | 2012-07-12 09:32:44 -0700 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2012-07-12 09:32:44 -0700 |
| commit | 48bcf81dd2584d91e5922dd1458dab6c4173bdcf (patch) | |
| tree | c834ff548520151966e6b04ef2ec19d475ff18e6 /include/git2 | |
| parent | 111ee3fe2d4c6de6729b94235c709986b4079c4b (diff) | |
| parent | 54e29b9380f1cd0fa596d71c317de907da19b13d (diff) | |
| download | libgit2-48bcf81dd2584d91e5922dd1458dab6c4173bdcf.tar.gz | |
Merge pull request #812 from arrbee/assorted-tweaks
Assorted goodies
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/config.h | 20 | ||||
| -rw-r--r-- | include/git2/repository.h | 5 |
2 files changed, 23 insertions, 2 deletions
diff --git a/include/git2/config.h b/include/git2/config.h index 36946c4a..c46e7fc9 100644 --- a/include/git2/config.h +++ b/include/git2/config.h @@ -33,7 +33,7 @@ struct git_config_file { int (*set)(struct git_config_file *, const char *key, const char *value); int (*set_multivar)(git_config_file *cfg, const char *name, const char *regexp, const char *value); int (*del)(struct git_config_file *, const char *key); - int (*foreach)(struct git_config_file *, int (*fn)(const char *, const char *, void *), void *data); + int (*foreach)(struct git_config_file *, const char *, int (*fn)(const char *, const char *, void *), void *data); void (*free)(struct git_config_file *); }; @@ -314,6 +314,24 @@ GIT_EXTERN(int) git_config_foreach( int (*callback)(const char *var_name, const char *value, void *payload), void *payload); +/** + * Perform an operation on each config variable matching a regular expression. + * + * This behaviors like `git_config_foreach` with an additional filter of a + * regular expression that filters which config keys are passed to the + * callback. + * + * @param cfg where to get the variables from + * @param regexp regular expression to match against config names + * @param callback the function to call on each variable + * @param payload the data to pass to the callback + * @return 0 or the return value of the callback which didn't return 0 + */ +GIT_EXTERN(int) git_config_foreach_match( + git_config *cfg, + const char *regexp, + int (*callback)(const char *var_name, const char *value, void *payload), + void *payload); /** * Query the value of a config variable and return it mapped to diff --git a/include/git2/repository.h b/include/git2/repository.h index 0b56a087..ff81b75e 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -194,9 +194,12 @@ GIT_EXTERN(const char *) git_repository_workdir(git_repository *repo); * * @param repo A repository object * @param workdir The path to a working directory + * @param update_gitlink Create/update gitlink in workdir and set config + * "core.worktree" (if workdir is not the parent of the .git directory) * @return 0, or an error code */ -GIT_EXTERN(int) git_repository_set_workdir(git_repository *repo, const char *workdir); +GIT_EXTERN(int) git_repository_set_workdir( + git_repository *repo, const char *workdir, int update_gitlink); /** * Check if a repository is bare |
