about summary refs log tree commit diff
path: root/cgit.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cgit.c43
-rw-r--r--cgit.css119
2 files changed, 154 insertions, 8 deletions
diff --git a/cgit.c b/cgit.c
index 6c7e811..c263872 100644
--- a/cgit.c
+++ b/cgit.c
@@ -60,6 +60,10 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value)
 		repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value);
 	else if (!strcmp(name, "enable-log-linecount"))
 		repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value);
+	else if (!strcmp(name, "enable-remote-branches"))
+		repo->enable_remote_branches = atoi(value);
+	else if (!strcmp(name, "enable-subject-links"))
+		repo->enable_subject_links = atoi(value);
 	else if (!strcmp(name, "max-stats"))
 		repo->max_stats = cgit_find_stats_period(value, NULL);
 	else if (!strcmp(name, "module-link"))
@@ -137,6 +141,10 @@ void config_cb(const char *name, const char *value)
 		ctx.cfg.enable_log_filecount = atoi(value);
 	else if (!strcmp(name, "enable-log-linecount"))
 		ctx.cfg.enable_log_linecount = atoi(value);
+	else if (!strcmp(name, "enable-remote-branches"))
+		ctx.cfg.enable_remote_branches = atoi(value);
+	else if (!strcmp(name, "enable-subject-links"))
+		ctx.cfg.enable_subject_links = atoi(value);
 	else if (!strcmp(name, "enable-tree-linenumbers"))
 		ctx.cfg.enable_tree_linenumbers = atoi(value);
 	else if (!strcmp(name, "max-stats"))
@@ -144,7 +152,7 @@ void config_cb(const char *name, const char *value)
 	else if (!strcmp(name, "cache-size"))
 		ctx.cfg.cache_size = atoi(value);
 	else if (!strcmp(name, "cache-root"))
-		ctx.cfg.cache_root = xstrdup(value);
+		ctx.cfg.cache_root = xstrdup(expand_macros(value));
 	else if (!strcmp(name, "cache-root-ttl"))
 		ctx.cfg.cache_root_ttl = atoi(value);
 	else if (!strcmp(name, "cache-repo-ttl"))
@@ -161,19 +169,23 @@ void config_cb(const char *name, const char *value)
 		ctx.cfg.commit_filter = new_filter(value, 0);
 	else if (!strcmp(name, "embedded"))
 		ctx.cfg.embedded = atoi(value);
+	else if (!strcmp(name, "max-atom-items"))
+		ctx.cfg.max_atom_items = atoi(value);
 	else if (!strcmp(name, "max-message-length"))
 		ctx.cfg.max_msg_len = atoi(value);
 	else if (!strcmp(name, "max-repodesc-length"))
 		ctx.cfg.max_repodesc_len = atoi(value);
+	else if (!strcmp(name, "max-blob-size"))
+		ctx.cfg.max_blob_size = atoi(value);
 	else if (!strcmp(name, "max-repo-count"))
 		ctx.cfg.max_repo_count = atoi(value);
 	else if (!strcmp(name, "max-commit-count"))
 		ctx.cfg.max_commit_count = atoi(value);
 	else if (!strcmp(name, "scan-path"))
 		if (!ctx.cfg.nocache && ctx.cfg.cache_size)
-			process_cached_repolist(value);
+			process_cached_repolist(expand_macros(value));
 		else
-			scan_tree(value, repo_config);
+			scan_tree(expand_macros(value), repo_config);
 	else if (!strcmp(name, "source-filter"))
 		ctx.cfg.source_filter = new_filter(value, 1);
 	else if (!strcmp(name, "summary-log"))
@@ -182,6 +194,8 @@ void config_cb(const char *name, const char *value)
 		ctx.cfg.summary_branches = atoi(value);
 	else if (!strcmp(name, "summary-tags"))
 		ctx.cfg.summary_tags = atoi(value);
+	else if (!strcmp(name, "side-by-side-diffs"))
+		ctx.cfg.ssdiff = atoi(value);
 	else if (!strcmp(name, "agefile"))
 		ctx.cfg.agefile = xstrdup(value);
 	else if (!strcmp(name, "renamelimit"))
@@ -195,7 +209,7 @@ void config_cb(const char *name, const char *value)
 	else if (!prefixcmp(name, "mimetype."))
 		add_mimetype(name + 9, value);
 	else if (!strcmp(name, "include"))
-		parse_configfile(value, config_cb);
+		parse_configfile(expand_macros(value), config_cb);
 }
 
 static void querystring_cb(const char *name, const char *value)
@@ -209,6 +223,8 @@ static void querystring_cb(const char *name, const char *value)
 	} else if (!strcmp(name, "p")) {
 		ctx.qry.page = xstrdup(value);
 	} else if (!strcmp(name, "url")) {
+		if (*value == '/')
+			value++;
 		ctx.qry.url = xstrdup(value);
 		cgit_parse_url(value);
 	} else if (!strcmp(name, "qt")) {
@@ -238,6 +254,14 @@ static void querystring_cb(const char *name, const char *value)
 		ctx.qry.showmsg = atoi(value);
 	} else if (!strcmp(name, "period")) {
 		ctx.qry.period = xstrdup(value);
+	} else if (!strcmp(name, "ss")) {
+		ctx.qry.ssdiff = atoi(value);
+	} else if (!strcmp(name, "all")) {
+		ctx.qry.show_all = atoi(value);
+	} else if (!strcmp(name, "context")) {
+		ctx.qry.context = atoi(value);
+	} else if (!strcmp(name, "ignorews")) {
+		ctx.qry.ignorews = atoi(value);
 	}
 }
 
@@ -268,6 +292,7 @@ static void prepare_context(struct cgit_context *ctx)
 	ctx->cfg.max_lock_attempts = 5;
 	ctx->cfg.max_msg_len = 80;
 	ctx->cfg.max_repodesc_len = 80;
+	ctx->cfg.max_blob_size = 0;
 	ctx->cfg.max_stats = 0;
 	ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
 	ctx->cfg.renamelimit = -1;
@@ -279,6 +304,8 @@ static void prepare_context(struct cgit_context *ctx)
 	ctx->cfg.summary_branches = 10;
 	ctx->cfg.summary_log = 10;
 	ctx->cfg.summary_tags = 10;
+	ctx->cfg.max_atom_items = 10;
+	ctx->cfg.ssdiff = 0;
 	ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG"));
 	ctx->env.http_host = xstrdupn(getenv("HTTP_HOST"));
 	ctx->env.https = xstrdupn(getenv("HTTPS"));
@@ -410,6 +437,12 @@ static void process_request(void *cbdata)
 		return;
 	}
 
+	/* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual"
+	 * in-project path limit to be made available at ctx->qry.vpath.
+	 * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL).
+	 */
+	ctx->qry.vpath = cmd->want_vpath ? ctx->qry.path : NULL;
+
 	if (cmd->want_repo && !ctx->repo) {
 		cgit_print_http_headers(ctx);
 		cgit_print_docstart(ctx);
@@ -674,7 +707,7 @@ int main(int argc, const char **argv)
 	cgit_repolist.repos = NULL;
 
 	cgit_parse_args(argc, argv);
-	parse_configfile(ctx.env.cgit_config, config_cb);
+	parse_configfile(expand_macros(ctx.env.cgit_config), config_cb);
 	ctx.repo = NULL;
 	http_parse_querystring(ctx.qry.raw, querystring_cb);
 
diff --git a/cgit.css b/cgit.css
index c47ebc9..6e47eb3 100644
--- a/cgit.css
+++ b/cgit.css
@@ -64,7 +64,7 @@ table#header td.sub {
 }
 
 table.tabs {
-	/* border-bottom: solid 2px #ccc; */
+	border-bottom: solid 3px #ccc;
 	border-collapse: collapse;
 	margin-top: 2em;
 	margin-bottom: 0px;
@@ -102,10 +102,16 @@ table.tabs td.form select {
 	font-size: 90%;
 }
 
+div.path {
+	margin: 0px;
+	padding: 5px 2em 2px 2em;
+	color: #000;
+	background-color: #eee;
+}
+
 div.content {
 	margin: 0px;
 	padding: 2em;
-	border-top: solid 3px #ccc;
 	border-bottom: solid 3px #ccc;
 }
 
@@ -162,6 +168,11 @@ table.list td a {
 	color: black;
 }
 
+table.list td a.ls-dir {
+	font-weight: bold;
+	color: #00f;
+}
+
 table.list td a:hover {
 	color: #00f;
 }
@@ -520,7 +531,10 @@ a.deco {
 	border: solid 1px #770000;
 }
 
-div.commit-subject a {
+div.commit-subject a.branch-deco,
+div.commit-subject a.tag-deco,
+div.commit-subject a.remote-deco,
+div.commit-subject a.deco {
 	margin-left: 1em;
 	font-size: 75%;
 }
@@ -601,3 +615,102 @@ table.hgraph div.bar {
 	background-color: #eee;
 	height: 1em;
 }
+
+table.ssdiff {
+	width: 100%;
+}
+
+table.ssdiff td {
+	font-size: 75%;
+	font-family: monospace;
+	white-space: pre;
+	padding: 1px 4px 1px 4px;
+	border-left: solid 1px #aaa;
+	border-right: solid 1px #aaa;
+}
+
+table.ssdiff td.add {
+	color: black;
+	background: #cfc;
+	min-width: 50%;
+}
+
+table.ssdiff td.add_dark {
+	color: black;
+	background: #aca;
+	min-width: 50%;
+}
+
+table.ssdiff span.add {
+	background: #cfc;
+	font-weight: bold;
+}
+
+table.ssdiff td.del {
+	color: black;
+	background: #fcc;
+	min-width: 50%;
+}
+
+table.ssdiff td.del_dark {
+	color: black;
+	background: #caa;
+	min-width: 50%;
+}
+
+table.ssdiff span.del {
+	background: #fcc;
+	font-weight: bold;
+}
+
+table.ssdiff td.changed {
+	color: black;
+	background: #ffc;
+	min-width: 50%;
+}
+
+table.ssdiff td.changed_dark {
+	color: black;
+	background: #cca;
+	min-width: 50%;
+}
+
+table.ssdiff td.lineno {
+	color: black;
+	background: #eee;
+	text-align: right;
+	width: 3em;
+	min-width: 3em;
+}
+
+table.ssdiff td.hunk {
+	color: #black;
+	background: #ccf;
+	border-top: solid 1px #aaa;
+	border-bottom: solid 1px #aaa;
+}
+
+table.ssdiff td.head {
+	border-top: solid 1px #aaa;
+	border-bottom: solid 1px #aaa;
+}
+
+table.ssdiff td.head div.head {
+	font-weight: bold;
+	color: black;
+}
+
+table.ssdiff td.foot {
+	border-top: solid 1px #aaa;
+        border-left: none;
+        border-right: none;
+        border-bottom: none;
+}
+
+table.ssdiff td.space {
+	border: none;
+}
+
+table.ssdiff td.space div {
+	min-height: 3em;
+}
\ No newline at end of file