summaryrefslogtreecommitdiffstatshomepage
path: root/cgit.c
Commit message (Expand)AuthorAge
* cgit: use cgit_print_error_page() where appropriateJohn Keeping2015-08-14
* log: allow users to follow a fileJohn Keeping2015-08-12
* about: always ensure page has a trailing slashJason A. Donenfeld2015-08-12
* git: update to v2.5.0Christian Hesse2015-08-12
* Fix processing of repo.hide and repo.ignoreDaniel Reichelt2015-08-12
* cgit: remember to set up env vars before empty clone pathJason A. Donenfeld2015-03-09
* Avoid non-ANSI function declarationsJohn Keeping2015-03-09
* cgit: show clone URLs for empty repoJason A. Donenfeld2015-03-05
* git: update for v2.3.0Christian Hesse2015-02-08
* Add repo.hide and repo.ignoreLukas Fleischer2015-01-29
* repolist: add owner-filterChris Burroughs2014-12-23
* git: update to v2.2.1Christian Hesse2014-12-23
* Change "ss" diff flag to an enumJohn Keeping2014-12-13
* Always check if README exists in choose_readme()Lukas Fleischer2014-08-07
* git: update for git 2.0Christian Hesse2014-06-28
* Add a cache-snapshot-ttl configuration variableLukas Fleischer2014-02-20
* cgit: add --version argument for printing infoJason A. Donenfeld2014-01-20
* cgit.c: free tmp variableJason A. Donenfeld2014-01-17
* Switch to exclusively using global ctxLukas Fleischer2014-01-17
* auth: have cgit calculate login addressJason A. Donenfeld2014-01-16
* authentication: use hidden form instead of refererJason A. Donenfeld2014-01-16
* auth: add basic authentication filter frameworkJason A. Donenfeld2014-01-16
* filter: add support for email filterJason A. Donenfeld2014-01-14
* filter: basic write hooking infrastructureJason A. Donenfeld2014-01-14
* filter: allow for cleanup hook for filter typesJason A. Donenfeld2014-01-14
* filter: add fprintf_filter functionJohn Keeping2014-01-14
* filter: split filter functions into their own fileJason A. Donenfeld2014-01-10
* cgit.c: Fix comment on bit mask hackLukas Fleischer2014-01-10
* cgit.c: Use "else" for mutually exclusive branchesLukas Fleischer2014-01-10
* Replace most uses of strncmp() with prefixcmp()Lukas Fleischer2014-01-10
* Update copyright informationLukas Fleischer2014-01-08
* cache: id means static, even if head is specified tooJason A. Donenfeld2013-08-12
* cache: document negative ttls and add about ttlJason A. Donenfeld2013-08-12
* use favicon by defaultChristian Hesse2013-08-12
* readme: use string_list instead of space deliminationsJason A. Donenfeld2013-05-26
* readme: Accept multiple candidates and test them.Jason A. Donenfeld2013-05-25
* ui-summary: Pass filename to about-filterJason A. Donenfeld2013-05-25
* cgit.c: Do not reset HOME after unsetting it.Jason A. Donenfeld2013-05-25
* cgit.c: sync repo config printing with struct cgit_repoJason A. Donenfeld2013-05-25
* Add branch-sort and repo.branch-sort options.Jason A. Donenfeld2013-04-10
* cgit.c: Do not restore unset environment variablesLukas Fleischer2013-04-10
* Do not load user or system gitconfig and gitattributesJason A. Donenfeld2013-04-08
* use struct strbuf instead of static buffersJohn Keeping2013-04-08
* Convert cgit_print_error to a variadic functionJohn Keeping2013-04-08
* Fix out-of-bounds memory accesses with virtual_root=""John Keeping2013-04-08
* Do not unnecessarily strdup() environment variablesLukas Fleischer2013-04-08
* Maŕk cgit_environment members constLukas Fleischer2013-04-08
* find_default_branch(): Free refmatch after usageLukas Fleischer2013-03-04
* Mark several functions/variables staticLukas Fleischer2013-03-04
* cgit.c: Remove parameter from guess_defbranch()Lukas Fleischer2013-03-04
>name, &item->st)) { item->st.st_mtime = 0; return 0; } return 1; } int cache_create_dirs() { char *path; path = fmt("%s", cgit_cache_root); if (mkdir(path, S_IRWXU) && errno!=EEXIST) return 0; if (!cgit_repo) return 0; path = fmt("%s/%s", cgit_cache_root, cache_safe_filename(cgit_repo->url)); if (mkdir(path, S_IRWXU) && errno!=EEXIST) return 0; if (cgit_query_page) { path = fmt("%s/%s/%s", cgit_cache_root, cache_safe_filename(cgit_repo->url), cgit_query_page); if (mkdir(path, S_IRWXU) && errno!=EEXIST) return 0; } return 1; } int cache_refill_overdue(const char *lockfile) { struct stat st; if (stat(lockfile, &st)) return 0; else return (time(NULL) - st.st_mtime > cgit_cache_max_create_time); } int cache_lock(struct cacheitem *item) { int i = 0; char *lockfile = xstrdup(fmt("%s.lock", item->name)); top: if (++i > cgit_max_lock_attempts) die("cache_lock: unable to lock %s: %s", item->name, strerror(errno)); item->fd = open(lockfile, O_WRONLY|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); if (item->fd == NOLOCK && errno == ENOENT && cache_create_dirs()) goto top; if (item->fd == NOLOCK && errno == EEXIST && cache_refill_overdue(lockfile) && !unlink(lockfile)) goto top; free(lockfile); return (item->fd > 0); } int cache_unlock(struct cacheitem *item) { close(item->fd); return (rename(fmt("%s.lock", item->name), item->name) == 0); } int cache_cancel_lock(struct cacheitem *item) { return (unlink(fmt("%s.lock", item->name)) == 0); } int cache_expired(struct cacheitem *item) { if (item->ttl < 0) return 0; return item->st.st_mtime + item->ttl * 60 < time(NULL); }