read_packed_refs(): ensure that references are ordered when read
[gitweb.git] / config.h
index f7f8b66c5944b3a36b9753a7f094398ec793624f..97471b887320b48f1b4c2d5a2023f6ffd1acf94e 100644 (file)
--- a/config.h
+++ b/config.h
@@ -30,6 +30,7 @@ enum config_origin_type {
 
 struct config_options {
        unsigned int respect_includes : 1;
+       const char *commondir;
        const char *git_dir;
 };
 
@@ -38,15 +39,15 @@ extern int git_default_config(const char *, const char *, void *);
 extern int git_config_from_file(config_fn_t fn, const char *, void *);
 extern int git_config_from_mem(config_fn_t fn, const enum config_origin_type,
                                        const char *name, const char *buf, size_t len, void *data);
-extern int git_config_from_blob_sha1(config_fn_t fn, const char *name,
-                                    const unsigned char *sha1, void *data);
+extern int git_config_from_blob_oid(config_fn_t fn, const char *name,
+                                   const struct object_id *oid, void *data);
 extern void git_config_push_parameter(const char *text);
 extern int git_config_from_parameters(config_fn_t fn, void *data);
 extern void read_early_config(config_fn_t cb, void *data);
 extern void git_config(config_fn_t fn, void *);
-extern int git_config_with_options(config_fn_t fn, void *,
-                                  struct git_config_source *config_source,
-                                  const struct config_options *opts);
+extern int config_with_options(config_fn_t fn, void *,
+                              struct git_config_source *config_source,
+                              const struct config_options *opts);
 extern int git_parse_ulong(const char *, unsigned long *);
 extern int git_parse_maybe_bool(const char *);
 extern int git_config_int(const char *, const char *);
@@ -162,10 +163,43 @@ extern int git_configset_get_bool_or_int(struct config_set *cs, const char *key,
 extern int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *dest);
 extern int git_configset_get_pathname(struct config_set *cs, const char *key, const char **dest);
 
+/* Functions for reading a repository's config */
+struct repository;
+extern void repo_config(struct repository *repo, config_fn_t fn, void *data);
+extern int repo_config_get_value(struct repository *repo,
+                                const char *key, const char **value);
+extern const struct string_list *repo_config_get_value_multi(struct repository *repo,
+                                                            const char *key);
+extern int repo_config_get_string_const(struct repository *repo,
+                                       const char *key, const char **dest);
+extern int repo_config_get_string(struct repository *repo,
+                                 const char *key, char **dest);
+extern int repo_config_get_int(struct repository *repo,
+                              const char *key, int *dest);
+extern int repo_config_get_ulong(struct repository *repo,
+                                const char *key, unsigned long *dest);
+extern int repo_config_get_bool(struct repository *repo,
+                               const char *key, int *dest);
+extern int repo_config_get_bool_or_int(struct repository *repo,
+                                      const char *key, int *is_bool, int *dest);
+extern int repo_config_get_maybe_bool(struct repository *repo,
+                                     const char *key, int *dest);
+extern int repo_config_get_pathname(struct repository *repo,
+                                   const char *key, const char **dest);
+
+/*
+ * Note: This function exists solely to maintain backward compatibility with
+ * 'fetch' and 'update_clone' storing configuration in '.gitmodules' and should
+ * NOT be used anywhere else.
+ *
+ * Runs the provided config function on the '.gitmodules' file found in the
+ * working directory.
+ */
+extern void config_from_gitmodules(config_fn_t fn, void *data);
+
 extern int git_config_get_value(const char *key, const char **value);
 extern const struct string_list *git_config_get_value_multi(const char *key);
 extern void git_config_clear(void);
-extern void git_config_iter(config_fn_t fn, void *data);
 extern int git_config_get_string_const(const char *key, const char **dest);
 extern int git_config_get_string(const char *key, char **dest);
 extern int git_config_get_int(const char *key, int *dest);
@@ -181,6 +215,9 @@ extern int git_config_get_max_percent_split_change(void);
 /* This dies if the configured or default date is in the future */
 extern int git_config_get_expiry(const char *key, const char **output);
 
+/* parse either "this many days" integer, or "5.days.ago" approxidate */
+extern int git_config_get_expiry_in_days(const char *key, timestamp_t *, timestamp_t now);
+
 struct key_value_info {
        const char *filename;
        int linenr;