summaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
Commit message (Expand)AuthorAge
* tests: use Git's test frameworkJohn Keeping2013-04-08
* Update git to v1.8.2.1John Keeping2013-04-08
* Makefile: remove CGIT-CFLAGS files in clean stageJason A. Donenfeld2013-03-20
* Makefile: re-use Git's Makefile where possibleJohn Keeping2013-03-20
* Makefile: Disable gettext in the Git submoduleLukas Fleischer2013-03-04
* Makefile: improve dependency generationJamie Couture2013-03-04
* CGIT-0.9.1v0.9.1Jason A. Donenfeld2012-11-15
* Makefile: get snapshots from githubFerry Huberts2012-11-04
* Makefile: remove tags fileJamie Couture2012-10-31
* Makefile: Support OpenBSD just like FreeBSDJason A. Donenfeld2012-10-17
* Makefile: support FreeBSD libiconv pathsJason A. Donenfeld2012-10-17
* Makefile: add tag target to generate ctagsJamie Couture2012-10-08
* Merge branch 'stable'Lars Hjemli2012-03-18
|\
| * CGIT-0.9.0.3v0.9.0.3Lars Hjemli2012-03-18
* | Merge branch 'stable'Lars Hjemli2012-01-03
|\|
| * Makefile: fetch git tarballs from http://hjemli.net/git/git/Lars Hjemli2012-01-03
* | Merge branch 'stable'Lars Hjemli2011-07-21
|\|
| * CGIT 0.9.0.2v0.9.0.2Lars Hjemli2011-07-21
* | Makefile: fix oversight of not using $(DESTDIR) in uninstallFerry Huberts2011-07-19
|/
* CGIT 0.9.0.1v0.9.0.1Lars Hjemli2011-06-13
* CGIT 0.9v0.9Lars Hjemli2011-03-05
* Merge branch 'stable'Lars Hjemli2011-03-05
|\
| * CGIT 0.8.3.5v0.8.3.5Lars Hjemli2011-03-05
| * Makefile: Make `make get-git` work under OpenBSD.Lukas Fleischer2011-02-19
* | Merge branch 'lh/improve-range-search'Lars Hjemli2011-02-19
|\ \
| * | Add vector utility functionsLars Hjemli2010-11-10
* | | Use GIT-1.7.4Lars Hjemli2011-02-19
* | | Merge branch 'tz/make-improvements'Lars Hjemli2010-11-10
|\ \ \ | |/ / |/| |
| * | Install filter scriptsTodd Zullinger2010-09-19
| * | Add Makefile targets to install/uninstall docsTodd Zullinger2010-09-19
| * | Generalize doc generationTodd Zullinger2010-09-19
* | | Makefile: avoid spurious rebuilds of git sources due to `sudo make`Lars Hjemli2010-11-10
* | | Makefile: add -MP optionLars Hjemli2010-11-07
* | | Merge branch 'stable'Lars Hjemli2010-09-27
|\ \ \ | |/ / |/| / | |/
| * CGIT 0.8.3.4v0.8.3.4Lars Hjemli2010-09-27
| * Use GIT-1.7.3Lars Hjemli2010-09-27
* | Merge branch 'ml/bugfix'Lars Hjemli2010-09-19
|\ \
| * | fix errors in printf-style format stringsMark Lodato2010-09-04
* | | Use GIT-1.7.3Lars Hjemli2010-09-19
|/ /
* | Use GIT-1.7.2.2Lars Hjemli2010-08-22
* | Merge branch 'stable'Lars Hjemli2010-08-03
|\|
| * CGIT 0.8.3.3v0.8.3.3Lars Hjemli2010-08-03
* | Makefile: do not include dependency-file on `make clean`Lynn Lin2010-07-22
* | Merge branch 'stable'Lars Hjemli2010-06-19
|\|
| * CGIT 0.8.3.2v0.8.3.2Lars Hjemli2010-06-19
* | Use GIT-1.7.0Lars Hjemli2010-02-27
* | Merge branch 'stable'Lars Hjemli2009-12-12
|\|
| * CGIT 0.8.3.1v0.8.3.1Lars Hjemli2009-12-12
* | Merge branch 'ro/ssdiff'Lars Hjemli2009-12-08
|\ \
| * | First version of side-by-side diff.Ragnar Ouchterlony2009-09-16
| |/
pan>= path, .matched_oid = &oid, .found_path = 0, .file_only = file_only }; if (get_oid(ref, &oid)) goto done; if (oid_object_info(the_repository, &oid, &size) != OBJ_COMMIT) goto done; read_tree_recursive(lookup_commit_reference(&oid)->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); done: free(path_items.match); return walk_tree_ctx.found_path; } int cgit_print_file(char *path, const char *head, int file_only) { struct object_id oid; enum object_type type; char *buf; unsigned long size; struct commit *commit; struct pathspec_item path_items = { .match = path, .len = strlen(path) }; struct pathspec paths = { .nr = 1, .items = &path_items }; struct walk_tree_context walk_tree_ctx = { .match_path = path, .matched_oid = &oid, .found_path = 0, .file_only = file_only }; if (get_oid(head, &oid)) return -1; type = oid_object_info(the_repository, &oid, &size); if (type == OBJ_COMMIT) { commit = lookup_commit_reference(&oid); read_tree_recursive(commit->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); if (!walk_tree_ctx.found_path) return -1; type = oid_object_info(the_repository, &oid, &size); } if (type == OBJ_BAD) return -1; buf = read_object_file(&oid, &type, &size); if (!buf) return -1; buf[size] = '\0'; html_raw(buf, size); free(buf); return 0; } void cgit_print_blob(const char *hex, char *path, const char *head, int file_only) { struct object_id oid; enum object_type type; char *buf; unsigned long size; struct commit *commit; struct pathspec_item path_items = { .match = path, .len = path ? strlen(path) : 0 }; struct pathspec paths = { .nr = 1, .items = &path_items }; struct walk_tree_context walk_tree_ctx = { .match_path = path, .matched_oid = &oid, .found_path = 0, .file_only = file_only }; if (hex) { if (get_oid_hex(hex, &oid)) { cgit_print_error_page(400, "Bad request", "Bad hex value: %s", hex); return; } } else { if (get_oid(head, &oid)) { cgit_print_error_page(404, "Not found", "Bad ref: %s", head); return; } } type = oid_object_info(the_repository, &oid, &size); if ((!hex) && type == OBJ_COMMIT && path) { commit = lookup_commit_reference(&oid); read_tree_recursive(commit->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); type = oid_object_info(the_repository, &oid, &size); } if (type == OBJ_BAD) { cgit_print_error_page(404, "Not found", "Bad object name: %s", hex); return; } buf = read_object_file(&oid, &type, &size); if (!buf) { cgit_print_error_page(500, "Internal server error", "Error reading object %s", hex); return; } buf[size] = '\0'; if (buffer_is_binary(buf, size)) ctx.page.mimetype = "application/octet-stream"; else ctx.page.mimetype = "text/plain"; ctx.page.filename = path; html("X-Content-Type-Options: nosniff\n"); html("Content-Security-Policy: default-src 'none'\n"); cgit_print_http_headers(); html_raw(buf, size); free(buf); }