Re: possible bug in config readme
As i have my cgit + uwsgi + nginx + gitolite setup in a LXD container, i can publish it. Would this be helpful? Am 18.02.2017 um 17:57 schrieb John Keeping: > On Tue, Jan 24, 2017 at 11:19:09PM +0100, MonkZ wrote: >> i'm using cgit 1.1 and trying to configure a global list of possible >> readme files (see attachment), but all i can get to work are >> "cgit.readme" entries in git-config files. >> >> I would expect, that this list would be active until a repo config or >> git-config comes around to overwrite it. > > I can't see anything wrong with your config, and I have just tried > something similar here and it seems to work. > > Having looked at the code, one small subtlety is that if there is a > repository-specific readme configuration it overrides the default list > rather than appending to it, but if you don't have any repository > configuration then the list in cgitrc should be used. > signature.asc Description: OpenPGP digital signature ___ CGit mailing list CGit@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/cgit
Re: patch links do not have stable checksums
Seems most reasonable to simply keep it something static and not add a nob. However, John - you raise a good point. Git's diff feature isn't exactly stable itself, with all sorts of interesting new diffing strategies being tried out in newer versions. So perhaps this isn't really an feasible goal in the first place... ___ CGit mailing list CGit@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/cgit
Re: [PULL] Fix escaping in atom output
Thanks. I'll review and merge. ___ CGit mailing list CGit@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/cgit
[PULL] Fix escaping in atom output
Hi Jason, [Apologies for sending this twice, I forgot to add the list on the first attempt.] The following changes since commit be39d22328f841536b8e44e8aaeed80a74ebb353: ui-patch: fix crash when using path limit (2017-01-23 18:36:04 +0100) are available in the git repository at: git://git.zx2c4.com/cgit jk/for-jason for you to fetch changes up to 8d03b82036d45cd6e378b3696c22d8e356f8bb88: ui-atom: properly escape delimiter in page link (2017-02-18 16:34:52 +) This patch was originally posted at [0] and hasn't had any comment for over a month, but our output is clearly wrong here. [0] https://lists.zx2c4.com/pipermail/cgit/2017-January/003454.html John Keeping (1): ui-atom: properly escape delimiter in page link ui-atom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ___ CGit mailing list CGit@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/cgit
Re: [PATCH v6 1/1] ui-shared: allow to split the repository link
On Tue, Dec 06, 2016 at 06:58:04PM +0100, Petr Vorel wrote: > Teach cgit split the repository link in the top of repository "summary" > view. This emulates the same behaviour as it's in gitweb. > > This behaviour is not implemented for repositories which have > "repo.name" set different than "repo.url". > > Signed-off-by: Petr Vorel > Cc: "Jason A. Donenfeld" > Cc: John Keeping With one minor nit below, Reviewed-by: John Keeping > --- > Explanation im man page might need to be improved. > > Changes v5->v6: > * Remove config variable, as requested by Jason. > > Changes v4->v5: > * Rename config variable to split-summary-repo-link > > Changes v3->v4: > Implement suggestions from John Keeping (thanks for them :-)): > * use strchr() instead of strtok_r() and variadic arrays, > * use cgit_repourl() and html_*() instead of cgit_summary_link(), > * add comment why we compare page.url and page.name. > > Changes v2->v3: > * New config variable "summary-enable-split-repo-link", minor cleanup. > > Changes v1->v2: > * Minor cleanup. > --- > cgitrc.5.txt | 4 +++- > ui-shared.c | 27 ++- > 2 files changed, 29 insertions(+), 2 deletions(-) > > diff --git a/cgitrc.5.txt b/cgitrc.5.txt > index 9fcf445..500b7ee 100644 > --- a/cgitrc.5.txt > +++ b/cgitrc.5.txt > @@ -604,7 +604,9 @@ repo.source-filter:: > > repo.url:: > The relative url used to access the repository. This must be the first > - setting specified for each repo. Default value: none. > + setting specified for each repo. Unless repo.url is different from > + repo.name, cgit splits the repository link in the top of repository > + "summary" view. Default value: none. > > > REPOSITORY-SPECIFIC CGITRC FILE > diff --git a/ui-shared.c b/ui-shared.c > index 2e4fcd9..b4cad55 100644 > --- a/ui-shared.c > +++ b/ui-shared.c > @@ -936,7 +936,32 @@ static void print_header(void) > if (ctx.repo) { > cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1); > html(" : "); > - cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); > + > + /* > + * NOTE: If repo.name and repo.url are different, we don't > split link as > + * it wouldn't make sense to split the path. > + * */ Extra "* " before the closing */ here. > + if (!strcmp(ctx.repo->name, ctx.repo->url)) { > + char *name = ctx.repo->name; > + char *start = name; > + for (;;) { > + char *delim = strchr(start, '/'); > + if (delim) > + *delim = '\0'; > + > + html_link_open(cgit_repourl(name), NULL, NULL); > + html_ntxt(strlen(start), start); > + html_link_close(); > + > + if (!delim) > + break; > + *delim = '/'; > + html("/"); > + start = delim + 1; > + } > + } else > + cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, > NULL); > + > if (ctx.env.authenticated) { > html(""); > html("\n"); > -- > 2.11.0 ___ CGit mailing list CGit@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/cgit
Re: patch links do not have stable checksums
On Sun, Dec 04, 2016 at 08:45:04AM +, ilove zfs wrote: > I'm reporting this as a result of this issue > https://github.com/Homebrew/homebrew-core/issues/5353 which was filed > with Homebrew regarding cgit. > > The cgit patch links do not have stable checksums because of the cgit > version signature at the bottom of each patch. > > For example, "cgit v1.1-3-g9641" > > So whenever a cgit server upgrades its version of cgit the checksums > of the contents of all patch links changes. > > This compromises the usefulness of cgit patch links for anything other > than casual, temporary use. Going back to the commit that added this feature, 620bb3e (Add plain patch view, 2007-12-10), it looks like the original intent was for this to be used for one-off patch application. The version string seems to be there because git-format-patch uses it, so I'm including a patch below which allows overriding the patch signature via the CGit configuration. I think there is an argument for changing the default to be fixed, but even if the signature is fixed I don't think we make any guarantee that the remainder of the output won't change across versions. For example, Git currently has experimental heuristics to improve readability of diffs and if these become the default then I expect CGit's patch output will change for some diffs. > As a result of this behavior, Homebrew cannot use cgit patches in our > patch blocks since each patch block has a url and a checksum, so every > time the checksum changes due to the signature change, the patch block > is invalidated, and someone must investigate why it changed and > whether the content changed in any way other than the signature, and > then update the checksum, and open a pull request, and go through CI, > and have someone approve and merge the PR. This is a very wasteful use > of the time of volunteers on an open source project. Is there a reason you can't strip the signature before computing the checksum? -- >8 -- Subject: [PATCH] patch: allow overriding signature Add a configuration option to allow specifying the signature displayed at the bottom of patch output, in a similar way to the "--signature" option to git-format-patch. Signed-off-by: John Keeping --- cgit.c | 2 ++ cgit.h | 1 + cgitrc.5.txt | 5 + ui-patch.c | 5 - 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c index 1075753..5d0655b 100644 --- a/cgit.c +++ b/cgit.c @@ -145,6 +145,8 @@ static void config_cb(const char *name, const char *value) ctx.cfg.logo_link = xstrdup(value); else if (!strcmp(name, "module-link")) ctx.cfg.module_link = xstrdup(value); + else if (!strcmp(name, "patch-signature")) + ctx.cfg.patch_signature = xstrdup(value); else if (!strcmp(name, "strict-export")) ctx.cfg.strict_export = xstrdup(value); else if (!strcmp(name, "virtual-root")) { diff --git a/cgit.h b/cgit.h index fbc6c6a..93d11e1 100644 --- a/cgit.h +++ b/cgit.h @@ -201,6 +201,7 @@ struct cgit_config { char *logo_link; char *mimetype_file; char *module_link; + char *patch_signature; char *project_list; struct string_list readme; char *robots; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 9fcf445..3d99e86 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -331,6 +331,11 @@ noheader:: Flag which, when set to "1", will make cgit omit the standard header on all pages. Default value: none. See also: "embedded". +patch-signature:: + Signature to add at the bottom of patches. Specify the empty string + to omit the signature block completely. + Default value: "cgit ". + project-list:: A list of subdirectories inside of scan-path, relative to it, that should loaded as git repositories. This must be defined prior to diff --git a/ui-patch.c b/ui-patch.c index 047e2f9..520e04b 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -90,7 +90,10 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, while ((commit = get_revision(&rev)) != NULL) { log_tree_commit(&rev, commit); - printf("-- \ncgit %s\n\n", cgit_version); + if (!ctx.cfg.patch_signature) + printf("-- \ncgit %s\n\n", cgit_version); + else if (*ctx.cfg.patch_signature) + printf("-- \n%s\n\n", ctx.cfg.patch_signature); } fflush(stdout); -- 2.12.0.rc2.230.ga28edc07cd ___ CGit mailing list CGit@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/cgit
Re: [PATCH] ui-log: add option to show all refs
On Fri, Feb 03, 2017 at 08:06:06PM -0800, Bertrand Roussel wrote: > Add option 'show-all-refs' and 'repo.show-all-refs' to display references > that are not tags or branches. Missing Signed-off-by tag (see [0]). Other than that, I wonder why this doesn't touch ui-refs.c or ui-summary.c. If this is only about using all refs for decoration, then "show-all-refs" seems like a misleading name. [0] https://developercertificate.org/ > --- > cgit.c | 5 + > cgit.css | 9 + > cgit.h | 2 ++ > cgitrc.5.txt | 8 > shared.c | 1 + > ui-log.c | 7 +-- > 6 files changed, 30 insertions(+), 2 deletions(-) > > diff --git a/cgit.c b/cgit.c > index 1075753..3303ea4 100644 > --- a/cgit.c > +++ b/cgit.c > @@ -79,6 +79,8 @@ static void repo_config(struct cgit_repo *repo, const char > *name, const char *va > item->util = xstrdup(value); > } else if (!strcmp(name, "section")) > repo->section = xstrdup(value); > + else if (!strcmp(name, "show-all-refs")) > + repo->show_all_refs = atoi(value); > else if (!strcmp(name, "readme") && value != NULL) { > if (repo->readme.items == ctx.cfg.readme.items) > memset(&repo->readme, 0, sizeof(repo->readme)); > @@ -239,6 +241,8 @@ static void config_cb(const char *name, const char *value) > ctx.cfg.project_list, repo_config); > else > scan_tree(expand_macros(value), repo_config); > + else if (!strcmp(name, "show-all-refs")) > + ctx.cfg.show_all_refs = atoi(value); > else if (!strcmp(name, "scan-hidden-path")) > ctx.cfg.scan_hidden_path = atoi(value); > else if (!strcmp(name, "section-from-path")) > @@ -834,6 +838,7 @@ static void print_repo(FILE *f, struct cgit_repo *repo) > fprintf(f, "repo.enable-remote-branches=%d\n", > repo->enable_remote_branches); > fprintf(f, "repo.enable-subject-links=%d\n", > repo->enable_subject_links); > fprintf(f, "repo.enable-html-serving=%d\n", repo->enable_html_serving); > + fprintf(f, "repo.show-all-refs=%d\n", repo->show_all_refs); > if (repo->branch_sort == 1) > fprintf(f, "repo.branch-sort=age\n"); > if (repo->commit_sort) { > diff --git a/cgit.css b/cgit.css > index 1dc2c11..e881bcd 100644 > --- a/cgit.css > +++ b/cgit.css > @@ -635,6 +635,14 @@ div#cgit div.footer a:hover { > text-decoration: underline; > } > > +div#cgit a.unknown-deco { > + color: #000; > + margin: 0px 0.5em; > + padding: 0px 0.25em; > + background-color: #88d3ff; > + border: solid 1px #005177; > +} > + > div#cgit a.branch-deco { > color: #000; > margin: 0px 0.5em; > @@ -667,6 +675,7 @@ div#cgit a.deco { > border: solid 1px #77; > } > > +div#cgit div.commit-subject a.unknown-deco, > div#cgit div.commit-subject a.branch-deco, > div#cgit div.commit-subject a.tag-deco, > div#cgit div.commit-subject a.remote-deco, > diff --git a/cgit.h b/cgit.h > index fbc6c6a..c2569a0 100644 > --- a/cgit.h > +++ b/cgit.h > @@ -96,6 +96,7 @@ struct cgit_repo { > int enable_remote_branches; > int enable_subject_links; > int enable_html_serving; > + int show_all_refs; > int max_stats; > int branch_sort; > int commit_sort; > @@ -252,6 +253,7 @@ struct cgit_config { > int remove_suffix; > int scan_hidden_path; > int section_from_path; > + int show_all_refs; > int snapshots; > int section_sort; > int summary_branches; > diff --git a/cgitrc.5.txt b/cgitrc.5.txt > index 9fcf445..27b38f2 100644 > --- a/cgitrc.5.txt > +++ b/cgitrc.5.txt > @@ -416,6 +416,10 @@ section-from-path:: > If negative, cgit will discard the specified number of path elements > above the repo directory. Default value: "0". > > +show-all-refs:: > + Show all types of refs in the log, such as refs/changes/. > + Default value: "0". > + > side-by-side-diffs:: > If set to "1" shows side-by-side diffs instead of unidiffs per > default. Default value: "0". > @@ -527,6 +531,10 @@ repo.enable-html-serving:: > A flag which can be used to override the global setting > `enable-html-serving`. Default value: none. > > +repo show-all-refs:: > + Show all types of refs in the log, such as refs/changes/. > + Default value: . > + > repo.hide:: > Flag which, when set to "1", hides the repository from the repository > index. The repository can still be accessed by providing a direct path. > diff --git a/shared.c b/shared.c > index c63f1e3..34a33d3 100644 > --- a/shared.c > +++ b/shared.c > @@ -63,6 +63,7 @@ struct cgit_repo *cgit_add_repo(const char *url) > ret->enable_remote_branches = ctx.cfg.enable_remote_branches; > ret->enable_subject_links = ctx.cfg.enable_subject_links; > ret->enable_html_serving = ctx.cfg.enable_html_serving; > +
Re: possible bug in config readme
On Tue, Jan 24, 2017 at 11:19:09PM +0100, MonkZ wrote: > i'm using cgit 1.1 and trying to configure a global list of possible > readme files (see attachment), but all i can get to work are > "cgit.readme" entries in git-config files. > > I would expect, that this list would be active until a repo config or > git-config comes around to overwrite it. I can't see anything wrong with your config, and I have just tried something similar here and it seems to work. Having looked at the code, one small subtlety is that if there is a repository-specific readme configuration it overrides the default list rather than appending to it, but if you don't have any repository configuration then the list in cgitrc should be used. ___ CGit mailing list CGit@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/cgit