diff options
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | cgit.c | 3 | ||||
-rw-r--r-- | cgit.css | 12 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 4 | ||||
-rw-r--r-- | ui-repolist.c | 9 | ||||
-rw-r--r-- | ui-shared.c | 7 | ||||
-rw-r--r-- | ui-snapshot.c | 17 | ||||
-rw-r--r-- | ui-tree.c | 5 |
9 files changed, 46 insertions, 17 deletions
@@ -49,6 +49,11 @@ ifeq ($(uname_O),Cygwin) NEEDS_LIBICONV = YesPlease endif +ifeq ($(uname_S),Darwin) + NEEDS_LIBICONV = YesPlease + CGIT_SCRIPT_PATH = /usr/local/apache2/htdocs/cgit +endif + # # Let the user override the above settings. # @@ -169,6 +169,8 @@ void config_cb(const char *name, const char *value) ctx.cfg.enable_http_clone = atoi(value); else if (!strcmp(name, "enable-index-links")) ctx.cfg.enable_index_links = atoi(value); + else if (!strcmp(name, "enable-index-owner")) + ctx.cfg.enable_index_owner = atoi(value); else if (!strcmp(name, "enable-commit-graph")) ctx.cfg.enable_commit_graph = atoi(value); else if (!strcmp(name, "enable-log-filecount")) @@ -338,6 +340,7 @@ static void prepare_context(struct cgit_context *ctx) ctx->cfg.local_time = 0; ctx->cfg.enable_gitweb_owner = 1; ctx->cfg.enable_http_clone = 1; + ctx->cfg.enable_index_owner = 1; ctx->cfg.enable_tree_linenumbers = 1; ctx->cfg.max_repo_count = 50; ctx->cfg.max_commit_count = 50; @@ -270,8 +270,7 @@ div#cgit td.ls-mode { } div#cgit table.blob { - margin-top: 0.5em; - border-top: solid 1px black; + margin-top: 0px; } div#cgit table.blob td.lines { @@ -284,7 +283,7 @@ div#cgit table.blob td.linenumbers { margin: 0; padding: 0 0.5em 0 0.5em; vertical-align: top; text-align: right; - border-right: 1px solid gray; + color: #eee; } div#cgit table.blob pre { @@ -302,21 +301,20 @@ div#cgit table.blob a.no a:hover { } div#cgit table.bin-blob { - margin-top: 0.5em; - border: solid 1px black; + border: solid 1px #ccc; } div#cgit table.bin-blob th { font-family: monospace; white-space: pre; - border: solid 1px #777; + border: solid 1px #ccc; padding: 0.5em 1em; } div#cgit table.bin-blob td { font-family: monospace; white-space: pre; - border-left: solid 1px #777; + border-left: solid 1px #ccc; padding: 0em 1em; } @@ -201,6 +201,7 @@ struct cgit_config { int enable_gitweb_owner; int enable_http_clone; int enable_index_links; + int enable_index_owner; int enable_commit_graph; int enable_log_filecount; int enable_log_linecount; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index a72241f..adbafbc 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -121,6 +121,10 @@ enable-index-links:: each repo in the repository index (specifically, to the "summary", "commit" and "tree" pages). Default value: "0". +enable-index-owner:: + Flag which, when set to "1", will make cgit display the owner of + each repo in the repository index. Default value: "1". + enable-log-filecount:: Flag which, when set to "1", will make cgit print the number of modified files for each commit on the repository log page. Default diff --git a/ui-repolist.c b/ui-repolist.c index d946f32..45192d2 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -111,7 +111,8 @@ void print_header(int columns) html("<tr class='nohover'>"); print_sort_header("Name", "name"); print_sort_header("Description", "desc"); - print_sort_header("Owner", "owner"); + if (ctx.cfg.enable_index_owner) + print_sort_header("Owner", "owner"); print_sort_header("Idle", "idle"); if (ctx.cfg.enable_index_links) html("<th class='left'>Links</th>"); @@ -274,8 +275,10 @@ void cgit_print_repolist() html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); html_link_close(); html("</td><td>"); - html_txt(ctx.repo->owner); - html("</td><td>"); + if (ctx.cfg.enable_index_owner) { + html_txt(ctx.repo->owner); + html("</td><td>"); + } print_modtime(ctx.repo); html("</td>"); if (ctx.cfg.enable_index_links) { diff --git a/ui-shared.c b/ui-shared.c index 026c2cb..5170b4c 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -1028,6 +1028,13 @@ void cgit_print_pageheader(struct cgit_context *ctx) html("<div class='path'>"); html("path: "); cgit_print_path_crumbs(ctx, ctx->qry.vpath); + if (!strcmp(ctx->qry.page, "tree")) { + html(" ("); + cgit_plain_link("plain", NULL, NULL, ctx->qry.head, + ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, + ctx->qry.vpath); + html(")"); + } html("</div>"); } html("<div class='content'>"); diff --git a/ui-snapshot.c b/ui-snapshot.c index 07cc944..3e75289 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c @@ -70,6 +70,9 @@ static int make_snapshot(const struct cgit_snapshot_format *format, const char *filename) { struct archiver_args args; + const unsigned char *commit_sha1; + time_t archive_time; + struct tree *tree; struct commit *commit; unsigned char sha1[20]; @@ -82,6 +85,14 @@ static int make_snapshot(const struct cgit_snapshot_format *format, cgit_print_error(fmt("Not a commit reference: %s", hex)); return 1; } + + commit_sha1 = commit->object.sha1; + archive_time = commit->date; + + tree = parse_tree_indirect(sha1); + if (tree == NULL) + cgit_print_error(fmt("Not a tree object: %s", sha1)); + memset(&args, 0, sizeof(args)); if (prefix) { args.base = fmt("%s/", prefix); @@ -90,8 +101,10 @@ static int make_snapshot(const struct cgit_snapshot_format *format, args.base = ""; args.baselen = 0; } - args.tree = commit->tree; - args.time = commit->date; + args.tree = tree; + args.commit_sha1 = commit_sha1; + args.commit = commit; + args.time = archive_time; args.compression_level = Z_DEFAULT_COMPRESSION; ctx.page.mimetype = xstrdup(format->mimetype); ctx.page.filename = xstrdup(filename); @@ -104,11 +104,6 @@ static void print_object(const unsigned char *sha1, char *path, const char *base return; } - htmlf("blob: %s (", sha1_to_hex(sha1)); - cgit_plain_link("plain", NULL, NULL, ctx.qry.head, - curr_rev, path); - html(")\n"); - if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) { htmlf("<div class='error'>blob size (%ldKB) exceeds display size limit (%dKB).</div>", size / 1024, ctx.cfg.max_blob_size); |