List for cgit developers and users
 help / color / mirror / Atom feed
* patches: main as default branch, go gettable
@ 2022-01-08 22:28 Derek Stevens
       [not found] ` <CAH-DoZ74FOrn=H0A1EtoEj+f_z7UoRXL2Rq4+GcvEosPoQXrBQ@mail.gmail.com>
  2022-01-09 16:13 ` Reto
  0 siblings, 2 replies; 3+ messages in thread
From: Derek Stevens @ 2022-01-08 22:28 UTC (permalink / raw)
  To: cgit


[-- Attachment #1.1: Type: text/plain, Size: 402 bytes --]

Hello CGit folk!

I use cgit for my own git server and have made some minor modifications that might be of interest.

The first is the trivial change to assume main as the default branch name, as this is the new standard in git.

The second and more interesting is to add a <meta> attribute to make a repository go-gettable.

Both patches are attached; Happy new year and happy hacking!

Cheers,
Derek

[-- Attachment #1.2: go_gettable.diff --]
[-- Type: text/plain, Size: 620 bytes --]

diff --git a/ui-shared.c b/ui-shared.c
index acd8ab5..49a9407 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -785,6 +785,10 @@ void cgit_print_docstart(void)
 	html_txt(ctx.page.title);
 	html("</title>\n");
 	htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version);
+	if (ctx.repo){
+	  htmlf("<meta name='go-import' content='%s%s%s git https://%s%s%s'/>\n",
+	    host, cgit_rooturl(), ctx.repo->url, host, cgit_rooturl(), ctx.repo->url);
+	}
 	if (ctx.cfg.robots && *ctx.cfg.robots)
 		htmlf("<meta name='robots' content='%s'/>\n", ctx.cfg.robots);
 	html("<link rel='stylesheet' type='text/css' href='");

[-- Attachment #1.3: main_branch.diff --]
[-- Type: text/plain, Size: 480 bytes --]

diff --git a/ui-repolist.c b/ui-repolist.c
index 529a203..c162290 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -53,7 +53,7 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime)
 
 	strbuf_reset(&path);
 	strbuf_addf(&path, "%s/refs/heads/%s", repo->path,
-		    repo->defbranch ? repo->defbranch : "master");
+		    repo->defbranch ? repo->defbranch : "main");
 	if (stat(path.buf, &s) == 0) {
 		*mtime = s.st_mtime;
 		r->mtime = *mtime;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-09 16:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-08 22:28 patches: main as default branch, go gettable Derek Stevens
     [not found] ` <CAH-DoZ74FOrn=H0A1EtoEj+f_z7UoRXL2Rq4+GcvEosPoQXrBQ@mail.gmail.com>
2022-01-09  0:00   ` Derek Stevens
2022-01-09 16:13 ` Reto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).