all repos — cgit @ ee554849ac7209fa8f7486327ec9f3b370e4c876

a hyperfast web frontend for git written in c

cgit.c: respect repo-local 'snapshots' option for --scan-path

The repo-specific 'snapshots' option is bitwise AND'ed with the global
'snapshots' option during parsing, and since the global cgitrc hasn't
been parsed when --scan-path is processed the global 'snapshots' will
always be 0 (i.e. no repo-specific 'snapshots' setting will have any
effect).

This patch fixes the issue by setting the global 'snapshots' mask to
0xFF (hence relying on later parsing of the generated cgitrc repolist
to do the right thing).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli hjemli@gmail.com
Mon, 24 Aug 2009 13:31:49 +0200
commit

ee554849ac7209fa8f7486327ec9f3b370e4c876

parent

588fb8efc69778b85062e8fc2f482a8de43bad75

1 files changed, 10 insertions(+), 0 deletions(-)

jump to
M cgit.ccgit.c

@@ -620,6 +620,16 @@ ctx.qry.ofs = atoi(argv[i]+6);

} if (!strncmp(argv[i], "--scan-tree=", 12) || !strncmp(argv[i], "--scan-path=", 12)) { + /* HACK: the global snapshot bitmask defines the + * set of allowed snapshot formats, but the config + * file hasn't been parsed yet so the mask is + * currently 0. By setting all bits high before + * scanning we make sure that any in-repo cgitrc + * snapshot setting is respected by scan_tree(). + * BTW: we assume that there'll never be more than + * 255 different snapshot formats supported by cgit... + */ + ctx.cfg.snapshots = 0xFF; scan++; scan_tree(argv[i] + 12, repo_config); }