aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile4
-rw-r--r--cgit.c41
-rw-r--r--cgit.css24
-rwxr-xr-xtests/t0104-tree.sh2
-rwxr-xr-xtests/t0107-snapshot.sh2
-rw-r--r--ui-log.c35
-rw-r--r--ui-patch.c4
-rw-r--r--ui-refs.c2
-rw-r--r--ui-snapshot.c4
-rw-r--r--ui-tree.c6
10 files changed, 93 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index 3c7ec07..036fcd7 100644
--- a/Makefile
+++ b/Makefile
@@ -128,8 +128,8 @@ cgit.o: VERSION
-include $(OBJECTS:.o=.d)
libgit:
- $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) libgit.a
- $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) xdiff/lib.a
+ $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a
+ $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a
test: all
$(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
diff --git a/cgit.c b/cgit.c
index 166fbc6..d1cee58 100644
--- a/cgit.c
+++ b/cgit.c
@@ -439,28 +439,29 @@ int main(int argc, const char **argv)
ctx.repo = NULL;
http_parse_querystring(ctx.qry.raw, querystring_cb);
- /* If virtual-root isn't specified in cgitrc and no url
- * parameter is specified on the querystring, lets pretend
- * that virtualroot equals SCRIPT_NAME and use PATH_INFO as
- * url. This allows cgit to work with virtual urls without
- * the need for rewriterules in the webserver (as long as
- * PATH_INFO is included in the cache lookup key).
+ /* If virtual-root isn't specified in cgitrc, lets pretend
+ * that virtual-root equals SCRIPT_NAME.
*/
- if (!ctx.cfg.virtual_root && !ctx.qry.url) {
+ if (!ctx.cfg.virtual_root)
ctx.cfg.virtual_root = ctx.cfg.script_name;
- path = getenv("PATH_INFO");
- if (path) {
- if (path[0] == '/')
- path++;
- ctx.qry.url = xstrdup(path);
- if (ctx.qry.raw) {
- qry = ctx.qry.raw;
- ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry));
- free(qry);
- } else
- ctx.qry.raw = ctx.qry.url;
- cgit_parse_url(ctx.qry.url);
- }
+
+ /* If no url parameter is specified on the querystring, lets
+ * use PATH_INFO as url. This allows cgit to work with virtual
+ * urls without the need for rewriterules in the webserver (as
+ * long as PATH_INFO is included in the cache lookup key).
+ */
+ path = getenv("PATH_INFO");
+ if (!ctx.qry.url && path) {
+ if (path[0] == '/')
+ path++;
+ ctx.qry.url = xstrdup(path);
+ if (ctx.qry.raw) {
+ qry = ctx.qry.raw;
+ ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry));
+ free(qry);
+ } else
+ ctx.qry.raw = ctx.qry.url;
+ cgit_parse_url(ctx.qry.url);
}
ttl = calc_ttl();
diff --git a/cgit.css b/cgit.css
index 7928c2f..f19446d 100644
--- a/cgit.css
+++ b/cgit.css
@@ -471,3 +471,27 @@ div.footer {
font-size: 80%;
color: #ccc;
}
+a.branch-deco {
+ margin: 0px 0.5em;
+ padding: 0px 0.25em;
+ background-color: #88ff88;
+ border: solid 1px #007700;
+}
+a.tag-deco {
+ margin: 0px 0.5em;
+ padding: 0px 0.25em;
+ background-color: #ffff88;
+ border: solid 1px #777700;
+}
+a.remote-deco {
+ margin: 0px 0.5em;
+ padding: 0px 0.25em;
+ background-color: #ccccff;
+ border: solid 1px #000077;
+}
+a.deco {
+ margin: 0px 0.5em;
+ padding: 0px 0.25em;
+ background-color: #ff8888;
+ border: solid 1px #770000;
+}
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh
index 0d62cc8..33f4eb0 100755
--- a/tests/t0104-tree.sh
+++ b/tests/t0104-tree.sh
@@ -15,7 +15,7 @@ run_test 'find line 1' '
'
run_test 'no line 2' '
- grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp
+ ! grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp
'
run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >trash/tmp'
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh
index 5f1b862..8ab4912 100755
--- a/tests/t0107-snapshot.sh
+++ b/tests/t0107-snapshot.sh
@@ -10,7 +10,7 @@ run_test 'get foo/snapshot/master.tar.gz' '
run_test 'check html headers' '
head -n 1 trash/tmp |
- grep -e "Content-Type: application/x-tar" &&
+ grep -e "Content-Type: application/x-gzip" &&
head -n 2 trash/tmp |
grep -e "Content-Disposition: inline; filename=.master.tar.gz."
diff --git a/ui-log.c b/ui-log.c
index 2f90778..c3757dd 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -31,6 +31,38 @@ void inspect_files(struct diff_filepair *pair)
cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines);
}
+void show_commit_decorations(struct commit *commit)
+{
+ struct name_decoration *deco;
+ static char buf[1024];
+
+ buf[sizeof(buf) - 1] = 0;
+ deco = lookup_decoration(&name_decoration, &commit->object);
+ while (deco) {
+ if (!prefixcmp(deco->name, "refs/heads/")) {
+ strncpy(buf, deco->name + 11, sizeof(buf) - 1);
+ cgit_log_link(buf, NULL, "branch-deco", buf, NULL, NULL,
+ 0, NULL, NULL, ctx.qry.showmsg);
+ }
+ else if (!prefixcmp(deco->name, "tag: refs/tags/")) {
+ strncpy(buf, deco->name + 15, sizeof(buf) - 1);
+ cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf);
+ }
+ else if (!prefixcmp(deco->name, "refs/remotes/")) {
+ strncpy(buf, deco->name + 13, sizeof(buf) - 1);
+ cgit_log_link(buf, NULL, "remote-deco", NULL,
+ sha1_to_hex(commit->object.sha1), NULL,
+ 0, NULL, NULL, ctx.qry.showmsg);
+ }
+ else {
+ strncpy(buf, deco->name, sizeof(buf) - 1);
+ cgit_commit_link(buf, NULL, "deco", ctx.qry.head,
+ sha1_to_hex(commit->object.sha1));
+ }
+ deco = deco->next;
+ }
+}
+
void print_commit(struct commit *commit)
{
struct commitinfo *info;
@@ -49,6 +81,7 @@ void print_commit(struct commit *commit)
ctx.qry.showmsg ? " class='logsubject'" : "");
cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
sha1_to_hex(commit->object.sha1));
+ show_commit_decorations(commit);
html("</td><td>");
html_txt(info->author);
if (ctx.repo->enable_log_filecount) {
@@ -119,6 +152,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
rev.verbose_header = 1;
rev.show_root_diff = 0;
setup_revisions(argc, argv, &rev, NULL);
+ load_ref_decorations();
+ rev.show_decorations = 1;
rev.grep_filter.regflags |= REG_ICASE;
compile_grep_patterns(&rev.grep_filter);
prepare_revision_walk(&rev);
diff --git a/ui-patch.c b/ui-patch.c
index e60877d..1d77336 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -101,9 +101,9 @@ void cgit_print_patch(char *hex)
ctx.page.filename = patchname;
cgit_print_http_headers(&ctx);
htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1));
- htmlf("From: %s%s\n", info->author, info->author_email);
+ htmlf("From: %s %s\n", info->author, info->author_email);
html("Date: ");
- cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time);
+ cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time);
htmlf("Subject: %s\n\n", info->subject);
if (info->msg && *info->msg) {
htmlf("%s", info->msg);
diff --git a/ui-refs.c b/ui-refs.c
index d61ee7c..c35e694 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -141,7 +141,7 @@ static int print_tag(struct refinfo *ref)
html("<tr><td>");
html_txt(name);
html("</td><td>");
- if (ctx.repo->snapshots && (tag->tagged->type == OBJ_COMMIT))
+ if (ctx.repo->snapshots && (ref->object->type == OBJ_COMMIT))
print_tag_downloads(ctx.repo, name);
else
cgit_object_link(ref->object);
diff --git a/ui-snapshot.c b/ui-snapshot.c
index f98f5d7..f25613e 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -58,8 +58,8 @@ static int write_tar_bzip2_archive(struct archiver_args *args)
const struct cgit_snapshot_format cgit_snapshot_formats[] = {
{ ".zip", "application/x-zip", write_zip_archive, 0x1 },
- { ".tar.gz", "application/x-tar", write_tar_gzip_archive, 0x2 },
- { ".tar.bz2", "application/x-tar", write_tar_bzip2_archive, 0x4 },
+ { ".tar.gz", "application/x-gzip", write_tar_gzip_archive, 0x2 },
+ { ".tar.bz2", "application/x-bzip2", write_tar_bzip2_archive, 0x4 },
{ ".tar", "application/x-tar", write_tar_archive, 0x8 },
{}
};
diff --git a/ui-tree.c b/ui-tree.c
index 051db7c..9876c99 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -54,8 +54,10 @@ static void print_object(const unsigned char *sha1, char *path)
}
idx++;
}
- htmlf(linefmt, ++lineno);
- html_txt(buf + start);
+ if (start < idx) {
+ htmlf(linefmt, ++lineno);
+ html_txt(buf + start);
+ }
html("</td></tr>\n");
html("</table>\n");
}