List for cgit developers and users
 help / color / mirror / Atom feed
From: Derek Stevens <nilix@nilfm.cc>
To: cgit@lists.zx2c4.com
Subject: patches: main as default branch, go gettable
Date: Sat, 8 Jan 2022 15:28:00 -0700	[thread overview]
Message-ID: <20220108222800.gesev62brvbbd3wi@ksatrya.siroonian.local> (raw)


[-- 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 --]

             reply	other threads:[~2022-01-08 22:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-08 22:28 Derek Stevens [this message]
     [not found] ` <CAH-DoZ74FOrn=H0A1EtoEj+f_z7UoRXL2Rq4+GcvEosPoQXrBQ@mail.gmail.com>
2022-01-09  0:00   ` Derek Stevens
2022-01-09 16:13 ` Reto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220108222800.gesev62brvbbd3wi@ksatrya.siroonian.local \
    --to=nilix@nilfm.cc \
    --cc=cgit@lists.zx2c4.com \
    --subject='Re: patches: main as default branch, go gettable' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).