Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-03-16 03:39:00 +0400
committerRussell Belfer <rb@github.com>2013-03-16 03:39:00 +0400
commit5540d9477ed143707435324e785336d254b12e47 (patch)
tree4ffaba1990a82cc51ee5169d7d2913ecceef4df2 /src/common.h
parenta5f6138407efb6d8866fe8de5aac13454aefcd82 (diff)
Implement global/system file search paths
The goal of this work is to expose the search logic for "global", "system", and "xdg" files through the git_libgit2_opts() interface. Behind the scenes, I changed the logic for finding files to have a notion of a git_strarray that represents a search path and to store a separate search path for each of the three tiers of config file. For each tier, I implemented a function to initialize it to default values (generally based on environment variables), and then general interfaces to get it, set it, reset it, and prepend new directories to it. Next, I exposed these interfaces through the git_libgit2_opts interface, reusing the GIT_CONFIG_LEVEL_SYSTEM, etc., constants for the user to control which search path they were modifying. There are alternative designs for the opts interface / argument ordering, so I'm putting this phase out for discussion. Additionally, I ended up doing a little bit of clean up regarding attr.h and attr_file.h, adding a new attrcache.h so the other two files wouldn't have to be included in so many places.
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index e3a9e1984..235da0412 100644
--- a/src/common.h
+++ b/src/common.h
@@ -56,6 +56,12 @@
#define GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
/**
+ * Check a return value and propogate result if non-zero.
+ */
+#define GITERR_CHECK_ERROR(code) \
+ do { int _err = (code); if (_err < 0) return _err; } while (0)
+
+/**
* Set the error message for this thread, formatting as needed.
*/
void giterr_set(int error_class, const char *string, ...);