diff options
-rw-r--r-- | cgit.c | 42 | ||||
-rw-r--r-- | cgit.css | 27 | ||||
-rw-r--r-- | cgit.h | 8 | ||||
-rw-r--r-- | cgitrc.5.txt | 67 | ||||
-rw-r--r-- | cmd.c | 44 | ||||
-rw-r--r-- | cmd.h | 3 | ||||
-rwxr-xr-x | filters/commit-links.sh | 11 | ||||
-rwxr-xr-x | filters/syntax-highlighting.sh | 11 | ||||
-rw-r--r-- | html.c | 8 | ||||
-rw-r--r-- | html.h | 1 | ||||
-rw-r--r-- | shared.c | 30 | ||||
-rwxr-xr-x | tests/setup.sh | 1 | ||||
-rwxr-xr-x | tests/t0102-summary.sh | 6 | ||||
-rw-r--r-- | ui-commit.c | 10 | ||||
-rw-r--r-- | ui-diff.c | 83 | ||||
-rw-r--r-- | ui-diff.h | 4 | ||||
-rw-r--r-- | ui-log.c | 29 | ||||
-rw-r--r-- | ui-repolist.c | 15 | ||||
-rw-r--r-- | ui-stats.c | 51 | ||||
-rw-r--r-- | ui-summary.c | 2 |
20 files changed, 334 insertions, 119 deletions
@@ -26,14 +26,27 @@ void add_mimetype(const char *name, const char *value) | |||
26 | item->util = xstrdup(value); | 26 | item->util = xstrdup(value); |
27 | } | 27 | } |
28 | 28 | ||
29 | struct cgit_filter *new_filter(const char *cmd, int extra_args) | 29 | struct cgit_filter *new_filter(const char *cmd, filter_type filtertype) |
30 | { | 30 | { |
31 | struct cgit_filter *f; | 31 | struct cgit_filter *f; |
32 | int args_size = 0; | 32 | int args_size = 0; |
33 | int extra_args; | ||
33 | 34 | ||
34 | if (!cmd || !cmd[0]) | 35 | if (!cmd || !cmd[0]) |
35 | return NULL; | 36 | return NULL; |
36 | 37 | ||
38 | switch (filtertype) { | ||
39 | case SOURCE: | ||
40 | extra_args = 1; | ||
41 | break; | ||
42 | |||
43 | case ABOUT: | ||
44 | case COMMIT: | ||
45 | default: | ||
46 | extra_args = 0; | ||
47 | break; | ||
48 | } | ||
49 | |||
37 | f = xmalloc(sizeof(struct cgit_filter)); | 50 | f = xmalloc(sizeof(struct cgit_filter)); |
38 | f->cmd = xstrdup(cmd); | 51 | f->cmd = xstrdup(cmd); |
39 | args_size = (2 + extra_args) * sizeof(char *); | 52 | args_size = (2 + extra_args) * sizeof(char *); |
@@ -83,11 +96,11 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) | |||
83 | repo->logo_link = xstrdup(value); | 96 | repo->logo_link = xstrdup(value); |
84 | else if (ctx.cfg.enable_filter_overrides) { | 97 | else if (ctx.cfg.enable_filter_overrides) { |
85 | if (!strcmp(name, "about-filter")) | 98 | if (!strcmp(name, "about-filter")) |
86 | repo->about_filter = new_filter(value, 0); | 99 | repo->about_filter = new_filter(value, ABOUT); |
87 | else if (!strcmp(name, "commit-filter")) | 100 | else if (!strcmp(name, "commit-filter")) |
88 | repo->commit_filter = new_filter(value, 0); | 101 | repo->commit_filter = new_filter(value, COMMIT); |
89 | else if (!strcmp(name, "source-filter")) | 102 | else if (!strcmp(name, "source-filter")) |
90 | repo->source_filter = new_filter(value, 1); | 103 | repo->source_filter = new_filter(value, SOURCE); |
91 | } | 104 | } |
92 | } | 105 | } |
93 | 106 | ||
@@ -147,6 +160,8 @@ void config_cb(const char *name, const char *value) | |||
147 | ctx.cfg.enable_filter_overrides = atoi(value); | 160 | ctx.cfg.enable_filter_overrides = atoi(value); |
148 | else if (!strcmp(name, "enable-gitweb-owner")) | 161 | else if (!strcmp(name, "enable-gitweb-owner")) |
149 | ctx.cfg.enable_gitweb_owner = atoi(value); | 162 | ctx.cfg.enable_gitweb_owner = atoi(value); |
163 | else if (!strcmp(name, "enable-http-clone")) | ||
164 | ctx.cfg.enable_http_clone = atoi(value); | ||
150 | else if (!strcmp(name, "enable-index-links")) | 165 | else if (!strcmp(name, "enable-index-links")) |
151 | ctx.cfg.enable_index_links = atoi(value); | 166 | ctx.cfg.enable_index_links = atoi(value); |
152 | else if (!strcmp(name, "enable-commit-graph")) | 167 | else if (!strcmp(name, "enable-commit-graph")) |
@@ -178,9 +193,9 @@ void config_cb(const char *name, const char *value) | |||
178 | else if (!strcmp(name, "cache-dynamic-ttl")) | 193 | else if (!strcmp(name, "cache-dynamic-ttl")) |
179 | ctx.cfg.cache_dynamic_ttl = atoi(value); | 194 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
180 | else if (!strcmp(name, "about-filter")) | 195 | else if (!strcmp(name, "about-filter")) |
181 | ctx.cfg.about_filter = new_filter(value, 0); | 196 | ctx.cfg.about_filter = new_filter(value, ABOUT); |
182 | else if (!strcmp(name, "commit-filter")) | 197 | else if (!strcmp(name, "commit-filter")) |
183 | ctx.cfg.commit_filter = new_filter(value, 0); | 198 | ctx.cfg.commit_filter = new_filter(value, COMMIT); |
184 | else if (!strcmp(name, "embedded")) | 199 | else if (!strcmp(name, "embedded")) |
185 | ctx.cfg.embedded = atoi(value); | 200 | ctx.cfg.embedded = atoi(value); |
186 | else if (!strcmp(name, "max-atom-items")) | 201 | else if (!strcmp(name, "max-atom-items")) |
@@ -210,7 +225,7 @@ void config_cb(const char *name, const char *value) | |||
210 | else if (!strcmp(name, "section-from-path")) | 225 | else if (!strcmp(name, "section-from-path")) |
211 | ctx.cfg.section_from_path = atoi(value); | 226 | ctx.cfg.section_from_path = atoi(value); |
212 | else if (!strcmp(name, "source-filter")) | 227 | else if (!strcmp(name, "source-filter")) |
213 | ctx.cfg.source_filter = new_filter(value, 1); | 228 | ctx.cfg.source_filter = new_filter(value, SOURCE); |
214 | else if (!strcmp(name, "summary-log")) | 229 | else if (!strcmp(name, "summary-log")) |
215 | ctx.cfg.summary_log = atoi(value); | 230 | ctx.cfg.summary_log = atoi(value); |
216 | else if (!strcmp(name, "summary-branches")) | 231 | else if (!strcmp(name, "summary-branches")) |
@@ -229,6 +244,8 @@ void config_cb(const char *name, const char *value) | |||
229 | ctx.cfg.robots = xstrdup(value); | 244 | ctx.cfg.robots = xstrdup(value); |
230 | else if (!strcmp(name, "clone-prefix")) | 245 | else if (!strcmp(name, "clone-prefix")) |
231 | ctx.cfg.clone_prefix = xstrdup(value); | 246 | ctx.cfg.clone_prefix = xstrdup(value); |
247 | else if (!strcmp(name, "clone-url")) | ||
248 | ctx.cfg.clone_url = xstrdup(value); | ||
232 | else if (!strcmp(name, "local-time")) | 249 | else if (!strcmp(name, "local-time")) |
233 | ctx.cfg.local_time = atoi(value); | 250 | ctx.cfg.local_time = atoi(value); |
234 | else if (!prefixcmp(name, "mimetype.")) | 251 | else if (!prefixcmp(name, "mimetype.")) |
@@ -312,6 +329,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
312 | ctx->cfg.logo = "/cgit.png"; | 329 | ctx->cfg.logo = "/cgit.png"; |
313 | ctx->cfg.local_time = 0; | 330 | ctx->cfg.local_time = 0; |
314 | ctx->cfg.enable_gitweb_owner = 1; | 331 | ctx->cfg.enable_gitweb_owner = 1; |
332 | ctx->cfg.enable_http_clone = 1; | ||
315 | ctx->cfg.enable_tree_linenumbers = 1; | 333 | ctx->cfg.enable_tree_linenumbers = 1; |
316 | ctx->cfg.max_repo_count = 50; | 334 | ctx->cfg.max_repo_count = 50; |
317 | ctx->cfg.max_commit_count = 50; | 335 | ctx->cfg.max_commit_count = 50; |
@@ -439,7 +457,7 @@ static int prepare_repo_cmd(struct cgit_context *ctx) | |||
439 | tmp = xstrdup(ctx->qry.head); | 457 | tmp = xstrdup(ctx->qry.head); |
440 | ctx->qry.head = ctx->repo->defbranch; | 458 | ctx->qry.head = ctx->repo->defbranch; |
441 | ctx->page.status = 404; | 459 | ctx->page.status = 404; |
442 | ctx->page.statusmsg = "not found"; | 460 | ctx->page.statusmsg = "Not found"; |
443 | cgit_print_http_headers(ctx); | 461 | cgit_print_http_headers(ctx); |
444 | cgit_print_docstart(ctx); | 462 | cgit_print_docstart(ctx); |
445 | cgit_print_pageheader(ctx); | 463 | cgit_print_pageheader(ctx); |
@@ -447,6 +465,7 @@ static int prepare_repo_cmd(struct cgit_context *ctx) | |||
447 | cgit_print_docend(); | 465 | cgit_print_docend(); |
448 | return 1; | 466 | return 1; |
449 | } | 467 | } |
468 | cgit_prepare_repo_env(ctx->repo); | ||
450 | return 0; | 469 | return 0; |
451 | } | 470 | } |
452 | 471 | ||
@@ -458,6 +477,8 @@ static void process_request(void *cbdata) | |||
458 | cmd = cgit_get_cmd(ctx); | 477 | cmd = cgit_get_cmd(ctx); |
459 | if (!cmd) { | 478 | if (!cmd) { |
460 | ctx->page.title = "cgit error"; | 479 | ctx->page.title = "cgit error"; |
480 | ctx->page.status = 404; | ||
481 | ctx->page.statusmsg = "Not found"; | ||
461 | cgit_print_http_headers(ctx); | 482 | cgit_print_http_headers(ctx); |
462 | cgit_print_docstart(ctx); | 483 | cgit_print_docstart(ctx); |
463 | cgit_print_pageheader(ctx); | 484 | cgit_print_pageheader(ctx); |
@@ -466,6 +487,11 @@ static void process_request(void *cbdata) | |||
466 | return; | 487 | return; |
467 | } | 488 | } |
468 | 489 | ||
490 | if (!ctx->cfg.enable_http_clone && cmd->is_clone) { | ||
491 | html_status(404, "Not found", 0); | ||
492 | return; | ||
493 | } | ||
494 | |||
469 | /* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual" | 495 | /* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual" |
470 | * in-project path limit to be made available at ctx->qry.vpath. | 496 | * in-project path limit to be made available at ctx->qry.vpath. |
471 | * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL). | 497 | * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL). |
@@ -331,6 +331,33 @@ table.commit-info { | |||
331 | margin-top: 1.5em; | 331 | margin-top: 1.5em; |
332 | } | 332 | } |
333 | 333 | ||
334 | div.cgit-panel { | ||
335 | float: right; | ||
336 | margin-top: 1.5em; | ||
337 | } | ||
338 | |||
339 | div.cgit-panel table { | ||
340 | border-collapse: collapse; | ||
341 | border: solid 1px #aaa; | ||
342 | background-color: #eee; | ||
343 | } | ||
344 | |||
345 | div.cgit-panel th { | ||
346 | text-align: center; | ||
347 | } | ||
348 | |||
349 | div.cgit-panel td { | ||
350 | padding: 0.25em 0.5em; | ||
351 | } | ||
352 | |||
353 | div.cgit-panel td.label { | ||
354 | padding-right: 0.5em; | ||
355 | } | ||
356 | |||
357 | div.cgit-panel td.ctrl { | ||
358 | padding-left: 0.5em; | ||
359 | } | ||
360 | |||
334 | table.commit-info th { | 361 | table.commit-info th { |
335 | text-align: left; | 362 | text-align: left; |
336 | font-weight: normal; | 363 | font-weight: normal; |
@@ -51,6 +51,10 @@ typedef void (*configfn)(const char *name, const char *value); | |||
51 | typedef void (*filepair_fn)(struct diff_filepair *pair); | 51 | typedef void (*filepair_fn)(struct diff_filepair *pair); |
52 | typedef void (*linediff_fn)(char *line, int len); | 52 | typedef void (*linediff_fn)(char *line, int len); |
53 | 53 | ||
54 | typedef enum { | ||
55 | ABOUT, COMMIT, SOURCE | ||
56 | } filter_type; | ||
57 | |||
54 | struct cgit_filter { | 58 | struct cgit_filter { |
55 | char *cmd; | 59 | char *cmd; |
56 | char **argv; | 60 | char **argv; |
@@ -161,6 +165,7 @@ struct cgit_config { | |||
161 | char *agefile; | 165 | char *agefile; |
162 | char *cache_root; | 166 | char *cache_root; |
163 | char *clone_prefix; | 167 | char *clone_prefix; |
168 | char *clone_url; | ||
164 | char *css; | 169 | char *css; |
165 | char *favicon; | 170 | char *favicon; |
166 | char *footer; | 171 | char *footer; |
@@ -191,6 +196,7 @@ struct cgit_config { | |||
191 | int embedded; | 196 | int embedded; |
192 | int enable_filter_overrides; | 197 | int enable_filter_overrides; |
193 | int enable_gitweb_owner; | 198 | int enable_gitweb_owner; |
199 | int enable_http_clone; | ||
194 | int enable_index_links; | 200 | int enable_index_links; |
195 | int enable_commit_graph; | 201 | int enable_commit_graph; |
196 | int enable_log_filecount; | 202 | int enable_log_filecount; |
@@ -317,6 +323,8 @@ extern int cgit_parse_snapshots_mask(const char *str); | |||
317 | extern int cgit_open_filter(struct cgit_filter *filter); | 323 | extern int cgit_open_filter(struct cgit_filter *filter); |
318 | extern int cgit_close_filter(struct cgit_filter *filter); | 324 | extern int cgit_close_filter(struct cgit_filter *filter); |
319 | 325 | ||
326 | extern void cgit_prepare_repo_env(struct cgit_repo * repo); | ||
327 | |||
320 | extern int readfile(const char *path, char **buf, size_t *size); | 328 | extern int readfile(const char *path, char **buf, size_t *size); |
321 | 329 | ||
322 | extern char *expand_macros(const char *txt); | 330 | extern char *expand_macros(const char *txt); |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 26c4bfc..4721c1e 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -31,7 +31,7 @@ about-filter:: | |||
31 | about pages (both top-level and for each repository). The command will | 31 | about pages (both top-level and for each repository). The command will |
32 | get the content of the about-file on its STDIN, and the STDOUT from the | 32 | get the content of the about-file on its STDIN, and the STDOUT from the |
33 | command will be included verbatim on the about page. Default value: | 33 | command will be included verbatim on the about page. Default value: |
34 | none. | 34 | none. See also: "FILTER API". |
35 | 35 | ||
36 | agefile:: | 36 | agefile:: |
37 | Specifies a path, relative to each repository path, which can be used | 37 | Specifies a path, relative to each repository path, which can be used |
@@ -76,11 +76,17 @@ clone-prefix:: | |||
76 | setting is only used if `repo.clone-url` is unspecified. Default value: | 76 | setting is only used if `repo.clone-url` is unspecified. Default value: |
77 | none. | 77 | none. |
78 | 78 | ||
79 | clone-url:: | ||
80 | Space-separated list of clone-url templates. This setting is only | ||
81 | used if `repo.clone-url` is unspecified. Default value: none. See | ||
82 | also: "MACRO EXPANSION", "FILTER API". | ||
83 | |||
79 | commit-filter:: | 84 | commit-filter:: |
80 | Specifies a command which will be invoked to format commit messages. | 85 | Specifies a command which will be invoked to format commit messages. |
81 | The command will get the message on its STDIN, and the STDOUT from the | 86 | The command will get the message on its STDIN, and the STDOUT from the |
82 | command will be included verbatim as the commit message, i.e. this can | 87 | command will be included verbatim as the commit message, i.e. this can |
83 | be used to implement bugtracker integration. Default value: none. | 88 | be used to implement bugtracker integration. Default value: none. |
89 | See also: "FILTER API". | ||
84 | 90 | ||
85 | css:: | 91 | css:: |
86 | Url which specifies the css document to include in all cgit pages. | 92 | Url which specifies the css document to include in all cgit pages. |
@@ -105,6 +111,11 @@ enable-gitweb-owner:: | |||
105 | for the git config value "gitweb.owner" to determine the owner. | 111 | for the git config value "gitweb.owner" to determine the owner. |
106 | Default value: "1". See also: scan-path. | 112 | Default value: "1". See also: scan-path. |
107 | 113 | ||
114 | enable-http-clone:: | ||
115 | If set to "1", cgit will act as an dumb HTTP endpoint for git clones. | ||
116 | If you use an alternate way of serving git repositories, you may wish | ||
117 | to disable this. Default value: "1". | ||
118 | |||
108 | enable-index-links:: | 119 | enable-index-links:: |
109 | Flag which, when set to "1", will make cgit generate extra links for | 120 | Flag which, when set to "1", will make cgit generate extra links for |
110 | each repo in the repository index (specifically, to the "summary", | 121 | each repo in the repository index (specifically, to the "summary", |
@@ -320,7 +331,7 @@ source-filter:: | |||
320 | and the name of the blob as its only command line argument. The STDOUT | 331 | and the name of the blob as its only command line argument. The STDOUT |
321 | from the command will be included verbatim as the blob contents, i.e. | 332 | from the command will be included verbatim as the blob contents, i.e. |
322 | this can be used to implement e.g. syntax highlighting. Default value: | 333 | this can be used to implement e.g. syntax highlighting. Default value: |
323 | none. | 334 | none. See also: "FILTER API". |
324 | 335 | ||
325 | summary-branches:: | 336 | summary-branches:: |
326 | Specifies the number of branches to display in the repository "summary" | 337 | Specifies the number of branches to display in the repository "summary" |
@@ -353,15 +364,15 @@ REPOSITORY SETTINGS | |||
353 | ------------------- | 364 | ------------------- |
354 | repo.about-filter:: | 365 | repo.about-filter:: |
355 | Override the default about-filter. Default value: none. See also: | 366 | Override the default about-filter. Default value: none. See also: |
356 | "enable-filter-overrides". | 367 | "enable-filter-overrides". See also: "FILTER API". |
357 | 368 | ||
358 | repo.clone-url:: | 369 | repo.clone-url:: |
359 | A list of space-separated urls which can be used to clone this repo. | 370 | A list of space-separated urls which can be used to clone this repo. |
360 | Default value: none. | 371 | Default value: none. See also: "MACRO EXPANSION". |
361 | 372 | ||
362 | repo.commit-filter:: | 373 | repo.commit-filter:: |
363 | Override the default commit-filter. Default value: none. See also: | 374 | Override the default commit-filter. Default value: none. See also: |
364 | "enable-filter-overrides". | 375 | "enable-filter-overrides". See also: "FILTER API". |
365 | 376 | ||
366 | repo.defbranch:: | 377 | repo.defbranch:: |
367 | The name of the default branch for this repository. If no such branch | 378 | The name of the default branch for this repository. If no such branch |
@@ -438,7 +449,7 @@ repo.section:: | |||
438 | 449 | ||
439 | repo.source-filter:: | 450 | repo.source-filter:: |
440 | Override the default source-filter. Default value: none. See also: | 451 | Override the default source-filter. Default value: none. See also: |
441 | "enable-filter-overrides". | 452 | "enable-filter-overrides". See also: "FILTER API". |
442 | 453 | ||
443 | repo.url:: | 454 | repo.url:: |
444 | The relative url used to access the repository. This must be the first | 455 | The relative url used to access the repository. This must be the first |
@@ -458,6 +469,40 @@ Note: the "repo." prefix is dropped from the option names in repo-specific | |||
458 | config files, e.g. "repo.desc" becomes "desc". | 469 | config files, e.g. "repo.desc" becomes "desc". |
459 | 470 | ||
460 | 471 | ||
472 | FILTER API | ||
473 | ---------- | ||
474 | about filter:: | ||
475 | This filter is given no arguments. The about text that is to be | ||
476 | filtered is available on standard input and the filtered text is | ||
477 | expected on standard output. | ||
478 | |||
479 | commit filter:: | ||
480 | This filter is given no arguments. The commit message text that is to | ||
481 | be filtered is available on standard input and the filtered text is | ||
482 | expected on standard output. | ||
483 | |||
484 | source filter:: | ||
485 | This filter is given a single parameter: the filename of the source | ||
486 | file to filter. The filter can use the filename to determine (for | ||
487 | example) the syntax highlighting mode. The contents of the source | ||
488 | file that is to be filtered is available on standard input and the | ||
489 | filtered contents is expected on standard output. | ||
490 | |||
491 | Also, all filters are handed the following environment variables: | ||
492 | |||
493 | - CGIT_REPO_URL (from repo.url) | ||
494 | - CGIT_REPO_NAME (from repo.name) | ||
495 | - CGIT_REPO_PATH (from repo.path) | ||
496 | - CGIT_REPO_OWNER (from repo.owner) | ||
497 | - CGIT_REPO_DEFBRANCH (from repo.defbranch) | ||
498 | - CGIT_REPO_SECTION (from repo.section) | ||
499 | - CGIT_REPO_CLONE_URL (from repo.clone-url) | ||
500 | |||
501 | If a setting is not defined for a repository and the corresponding global | ||
502 | setting is also not defined (if applicable), then the corresponding | ||
503 | environment variable will be an empty string. | ||
504 | |||
505 | |||
461 | MACRO EXPANSION | 506 | MACRO EXPANSION |
462 | --------------- | 507 | --------------- |
463 | The following cgitrc options supports a simple macro expansion feature, | 508 | The following cgitrc options supports a simple macro expansion feature, |
@@ -477,6 +522,12 @@ can be accomplished by adding the following line to /etc/cgitrc: | |||
477 | 522 | ||
478 | include=/etc/cgitrc.d/$HTTP_HOST | 523 | include=/etc/cgitrc.d/$HTTP_HOST |
479 | 524 | ||
525 | The following options are expanded during request processing, and support | ||
526 | the environment variables defined in "FILTER API": | ||
527 | |||
528 | - clone-url | ||
529 | - repo.clone-url | ||
530 | |||
480 | 531 | ||
481 | EXAMPLE CGITRC FILE | 532 | EXAMPLE CGITRC FILE |
482 | ------------------- | 533 | ------------------- |
@@ -486,8 +537,8 @@ EXAMPLE CGITRC FILE | |||
486 | cache-size=1000 | 537 | cache-size=1000 |
487 | 538 | ||
488 | 539 | ||
489 | # Specify some default clone prefixes | 540 | # Specify some default clone urls using macro expansion |
490 | clone-prefix=git://example.com ssh://example.com/pub/git http://example.com/git | 541 | clone-url=git://foo.org/$CGIT_REPO_URL git@foo.org:$CGIT_REPO_URL |
491 | 542 | ||
492 | # Specify the css url | 543 | # Specify the css url |
493 | css=/css/cgit.css | 544 | css=/css/cgit.css |
@@ -56,7 +56,7 @@ static void commit_fn(struct cgit_context *ctx) | |||
56 | 56 | ||
57 | static void diff_fn(struct cgit_context *ctx) | 57 | static void diff_fn(struct cgit_context *ctx) |
58 | { | 58 | { |
59 | cgit_print_diff(ctx->qry.sha1, ctx->qry.sha2, ctx->qry.path); | 59 | cgit_print_diff(ctx->qry.sha1, ctx->qry.sha2, ctx->qry.path, 1); |
60 | } | 60 | } |
61 | 61 | ||
62 | static void info_fn(struct cgit_context *ctx) | 62 | static void info_fn(struct cgit_context *ctx) |
@@ -130,31 +130,31 @@ static void tree_fn(struct cgit_context *ctx) | |||
130 | cgit_print_tree(ctx->qry.sha1, ctx->qry.path); | 130 | cgit_print_tree(ctx->qry.sha1, ctx->qry.path); |
131 | } | 131 | } |
132 | 132 | ||
133 | #define def_cmd(name, want_repo, want_layout, want_vpath) \ | 133 | #define def_cmd(name, want_repo, want_layout, want_vpath, is_clone) \ |
134 | {#name, name##_fn, want_repo, want_layout, want_vpath} | 134 | {#name, name##_fn, want_repo, want_layout, want_vpath, is_clone} |
135 | 135 | ||
136 | struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx) | 136 | struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx) |
137 | { | 137 | { |
138 | static struct cgit_cmd cmds[] = { | 138 | static struct cgit_cmd cmds[] = { |
139 | def_cmd(HEAD, 1, 0, 0), | 139 | def_cmd(HEAD, 1, 0, 0, 1), |
140 | def_cmd(atom, 1, 0, 0), | 140 | def_cmd(atom, 1, 0, 0, 0), |
141 | def_cmd(about, 0, 1, 0), | 141 | def_cmd(about, 0, 1, 0, 0), |
142 | def_cmd(blob, 1, 0, 0), | 142 | def_cmd(blob, 1, 0, 0, 0), |
143 | def_cmd(commit, 1, 1, 1), | 143 | def_cmd(commit, 1, 1, 1, 0), |
144 | def_cmd(diff, 1, 1, 1), | 144 | def_cmd(diff, 1, 1, 1, 0), |
145 | def_cmd(info, 1, 0, 0), | 145 | def_cmd(info, 1, 0, 0, 1), |
146 | def_cmd(log, 1, 1, 1), | 146 | def_cmd(log, 1, 1, 1, 0), |
147 | def_cmd(ls_cache, 0, 0, 0), | 147 | def_cmd(ls_cache, 0, 0, 0, 0), |
148 | def_cmd(objects, 1, 0, 0), | 148 | def_cmd(objects, 1, 0, 0, 1), |
149 | def_cmd(patch, 1, 0, 1), | 149 | def_cmd(patch, 1, 0, 1, 0), |
150 | def_cmd(plain, 1, 0, 0), | 150 | def_cmd(plain, 1, 0, 0, 0), |
151 | def_cmd(refs, 1, 1, 0), | 151 | def_cmd(refs, 1, 1, 0, 0), |
152 | def_cmd(repolist, 0, 0, 0), | 152 | def_cmd(repolist, 0, 0, 0, 0), |
153 | def_cmd(snapshot, 1, 0, 0), | 153 | def_cmd(snapshot, 1, 0, 0, 0), |
154 | def_cmd(stats, 1, 1, 1), | 154 | def_cmd(stats, 1, 1, 1, 0), |
155 | def_cmd(summary, 1, 1, 0), | 155 | def_cmd(summary, 1, 1, 0, 0), |
156 | def_cmd(tag, 1, 1, 0), | 156 | def_cmd(tag, 1, 1, 0, 0), |
157 | def_cmd(tree, 1, 1, 1), | 157 | def_cmd(tree, 1, 1, 1, 0), |
158 | }; | 158 | }; |
159 | int i; | 159 | int i; |
160 | 160 | ||
@@ -8,7 +8,8 @@ struct cgit_cmd { | |||
8 | cgit_cmd_fn fn; | 8 | cgit_cmd_fn fn; |
9 | unsigned int want_repo:1, | 9 | unsigned int want_repo:1, |
10 | want_layout:1, | 10 | want_layout:1, |
11 | want_vpath:1; | 11 | want_vpath:1, |
12 | is_clone:1; | ||
12 | }; | 13 | }; |
13 | 14 | ||
14 | extern struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx); | 15 | extern struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx); |
diff --git a/filters/commit-links.sh b/filters/commit-links.sh index 110c609..d2cd2b3 100755 --- a/filters/commit-links.sh +++ b/filters/commit-links.sh | |||
@@ -3,6 +3,17 @@ | |||
3 | # | 3 | # |
4 | # To use this script, refer to this file with either the commit-filter or the | 4 | # To use this script, refer to this file with either the commit-filter or the |
5 | # repo.commit-filter options in cgitrc. | 5 | # repo.commit-filter options in cgitrc. |
6 | # | ||
7 | # The following environment variables can be used to retrieve the configuration | ||
8 | # of the repository for which this script is called: | ||
9 | # CGIT_REPO_URL ( = repo.url setting ) | ||
10 | # CGIT_REPO_NAME ( = repo.name setting ) | ||
11 | # CGIT_REPO_PATH ( = repo.path setting ) | ||