summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2023-01-23 15:46:14 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2023-02-09 12:10:40 +0000
commit894543827d7ad62c7b70901e949305beea34cdbd (patch)
tree27223b2282ac15992c3fbf213cde55802da89df8 /include/git2
parentcdf5ae9ff6aab6655a1cc361e998462f260bcf0b (diff)
downloadlibgit2-894543827d7ad62c7b70901e949305beea34cdbd.tar.gz
core: allow users to configure home directory
Some callers -- like our test suite and the test suites of our language bindings -- want to isolate the home directory to avoid accidentally including the executing user's actual home directory data. Previously, we combined the notion of a home directory and global configuration -- now that this is separated, we provide users the ability to configure both.
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/common.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/git2/common.h b/include/git2/common.h
index ccf66334a..f968deb23 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -222,7 +222,9 @@ typedef enum {
GIT_OPT_GET_EXTENSIONS,
GIT_OPT_SET_EXTENSIONS,
GIT_OPT_GET_OWNER_VALIDATION,
- GIT_OPT_SET_OWNER_VALIDATION
+ GIT_OPT_SET_OWNER_VALIDATION,
+ GIT_OPT_GET_HOMEDIR,
+ GIT_OPT_SET_HOMEDIR
} git_libgit2_opt_t;
/**
@@ -468,6 +470,16 @@ typedef enum {
* > Set that repository directories should be owned by the current
* > user. The default is to validate ownership.
*
+ * opts(GIT_OPT_GET_HOMEDIR, git_buf *out)
+ * > Gets the current user's home directory, as it will be used
+ * > for file lookups. The path is written to the `out` buffer.
+ *
+ * opts(GIT_OPT_SET_HOMEDIR, const char *path)
+ * > Sets the directory used as the current user's home directory,
+ * > for file lookups.
+ * >
+ * > - `path` directory of home directory.
+ *
* @param option Option key
* @param ... value to set the option
* @return 0 on success, <0 on failure