summaryrefslogtreecommitdiffabout
path: root/shared.c
authorLars Hjemli <hjemli@gmail.com>2007-02-08 13:47:56 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-02-08 13:47:56 (UTC)
commitac70cb4795c90db02917db63d169b0fadfe9fb99 (patch) (unidiff)
treebf7a5c4c8c2789cda2dd511f0a180df279a0b389 /shared.c
parentab2ab95f09994560f62fd631f07d3b6e3577aa6e (diff)
downloadcgit-ac70cb4795c90db02917db63d169b0fadfe9fb99.zip
cgit-ac70cb4795c90db02917db63d169b0fadfe9fb99.tar.gz
cgit-ac70cb4795c90db02917db63d169b0fadfe9fb99.tar.bz2
Make snapshot feature configurable
Snapshots can now be enabled/disabled by default for all repositories in cgitrc with param "snapshots". Additionally, any repo can override the default setting with param "repo.snapshots". By default, no snapshotting is enabled. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--shared.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/shared.c b/shared.c
index 5757d0c..531d8c0 100644
--- a/shared.c
+++ b/shared.c
@@ -20,6 +20,7 @@ char *cgit_virtual_root = NULL;
20char *cgit_cache_root = "/var/cache/cgit"; 20char *cgit_cache_root = "/var/cache/cgit";
21 21
22int cgit_nocache = 0; 22int cgit_nocache = 0;
23int cgit_snapshots = 0;
23int cgit_max_lock_attempts = 5; 24int cgit_max_lock_attempts = 5;
24int cgit_cache_root_ttl = 5; 25int cgit_cache_root_ttl = 5;
25int cgit_cache_repo_ttl = 5; 26int cgit_cache_repo_ttl = 5;
@@ -83,6 +84,7 @@ struct repoinfo *add_repo(const char *url)
83 ret->path = NULL; 84 ret->path = NULL;
84 ret->desc = NULL; 85 ret->desc = NULL;
85 ret->owner = NULL; 86 ret->owner = NULL;
87 ret->snapshots = cgit_snapshots;
86 return ret; 88 return ret;
87} 89}
88 90
@@ -100,6 +102,8 @@ void cgit_global_config_cb(const char *name, const char *value)
100 cgit_virtual_root = xstrdup(value); 102 cgit_virtual_root = xstrdup(value);
101 else if (!strcmp(name, "nocache")) 103 else if (!strcmp(name, "nocache"))
102 cgit_nocache = atoi(value); 104 cgit_nocache = atoi(value);
105 else if (!strcmp(name, "snapshots"))
106 cgit_snapshots = atoi(value);
103 else if (!strcmp(name, "cache-root")) 107 else if (!strcmp(name, "cache-root"))
104 cgit_cache_root = xstrdup(value); 108 cgit_cache_root = xstrdup(value);
105 else if (!strcmp(name, "cache-root-ttl")) 109 else if (!strcmp(name, "cache-root-ttl"))
@@ -122,6 +126,8 @@ void cgit_global_config_cb(const char *name, const char *value)
122 cgit_repo->desc = xstrdup(value); 126 cgit_repo->desc = xstrdup(value);
123 else if (cgit_repo && !strcmp(name, "repo.owner")) 127 else if (cgit_repo && !strcmp(name, "repo.owner"))
124 cgit_repo->owner = xstrdup(value); 128 cgit_repo->owner = xstrdup(value);
129 else if (cgit_repo && !strcmp(name, "repo.snapshots"))
130 cgit_repo->snapshots = atoi(value);
125} 131}
126 132
127void cgit_repo_config_cb(const char *name, const char *value) 133void cgit_repo_config_cb(const char *name, const char *value)