Diff options
Diffstat (limited to 'source')
-rw-r--r--source/cgit.c2
-rw-r--r--source/cgit.h1
-rw-r--r--source/ui-patch.c8
-rw-r--r--source/ui-shared.c10
4 files changed, 18 insertions, 3 deletions
diff --git a/source/cgit.c b/source/cgit.c
index efcb703..eaf1d19 100644
--- a/source/cgit.c
+++ b/source/cgit.c
@@ -586,6 +586,8 @@ static void apply_config(const char *name, const char *value)
ctx.cfg.enable_html_serving = atoi(value);
else if (!strcmp(name, "enable-tree-linenumbers"))
ctx.cfg.enable_tree_linenumbers = atoi(value);
+ else if (!strcmp(name, "enable-version-info"))
+ ctx.cfg.enable_version_info = atoi(value);
else if (!strcmp(name, "enable-tree-group-dirs"))
ctx.cfg.enable_tree_group_dirs = atoi(value);
else if (!strcmp(name, "enable-git-config"))
diff --git a/source/cgit.h b/source/cgit.h
index c04193f..5e17a3e 100644
--- a/source/cgit.h
+++ b/source/cgit.h
@@ -227,6 +227,7 @@ struct cgit_config {
int embedded;
int trust_scan_config;
int enable_follow_links;
+ int enable_version_info;
int enable_gitmodules_links;
int enable_header;
int enable_http_clone;
diff --git a/source/ui-patch.c b/source/ui-patch.c
index 78c850c..04083fe 100644
--- a/source/ui-patch.c
+++ b/source/ui-patch.c
@@ -132,7 +132,8 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, const char *pref
cgit_print_http_headers();
// git format-patch signs with its bare version number, so the v that
- // cgit's tags carry is left off to read the same way.
+ // cgit's tags carry is left off to read the same way. Without
+ // enable-version-info the signature names cgit alone.
if (!skip_prefix(cgit_version, "v", &version))
version = cgit_version;
@@ -141,6 +142,9 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, const char *pref
// Two dashes and a space is the mail signature separator, so
// git am and mail readers drop the version note below rather
// than carrying it into the commit message.
- printf("-- \ncgit %s\n\n", version);
+ if (ctx.cfg.enable_version_info)
+ printf("-- \ncgit %s\n\n", version);
+ else
+ printf("-- \ncgit\n\n");
}
}
diff --git a/source/ui-shared.c b/source/ui-shared.c
index 8da9878..936a6a4 100644
--- a/source/ui-shared.c
+++ b/source/ui-shared.c
@@ -1558,7 +1558,10 @@ void cgit_print_docstart(void)
html_attr(ctx.cfg.root_desc);
html("'>\n");
}
- html("<meta name='generator' content='cgit'>\n");
+ if (ctx.cfg.enable_version_info)
+ htmlf("<meta name='generator' content='cgit %s'>\n", cgit_version);
+ else
+ html("<meta name='generator' content='cgit'>\n");
if (ctx.cfg.robots && *ctx.cfg.robots) {
html("<meta name='robots' content='");
html_attr(ctx.cfg.robots);
@@ -1615,6 +1618,11 @@ void cgit_print_docend(void)
}
if (ctx.cfg.footer)
html_include(ctx.cfg.footer);
+ else if (ctx.cfg.enable_version_info)
+ htmlf("<footer class='footer'>generated by "
+ "<a href='https://github.com/brycekwon/cgit'>cgit %s</a> "
+ "(<a href='https://git-scm.com/'>git %s</a>)</footer>\n",
+ cgit_version, git_version_string);
else
html("<footer class='footer'>generated by <a href='https://github.com/brycekwon/cgit'>cgit</a></footer>\n");
html("</div>\n");