Signed-off-by: Derek Stevens <nilix@nilfm.cc> --- cgit.c | 2 +- cgitrc.5.txt | 2 +- ui-repolist.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cgit.c b/cgit.c index 08d81a1..5b0a016 100644 --- a/cgit.c +++ b/cgit.c @@ -489,7 +489,7 @@ static char *guess_defbranch(void) ref = resolve_ref_unsafe("HEAD", 0, &oid, NULL); if (!ref || !skip_prefix(ref, "refs/heads/", &refname)) - return "master"; + return "main"; return xstrdup(refname); } diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 33a6a8c..9639156 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -479,7 +479,7 @@ repo.defbranch:: The name of the default branch for this repository. If no such branch exists in the repository, the first branch name (when sorted) is used as default instead. Default value: branch pointed to by HEAD, or - "master" if there is no suitable HEAD. + "main" if there is no suitable HEAD. repo.desc:: The value to show as repository description. Default value: none. 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; -- 2.34.1
Replacing one hard coded value with another is really not helpful.
Git itself solves this locally with init.defaultBranch in its config.
If the corresponding option is unset you are helpfully told to choose
one. That is however not simply a matter of s/master/main/ but the
following:
>Names commonly chosen instead of 'master' are 'main', 'trunk' and
>'development'.
As you can see, multiple "common" options.
There's work ongoing in git to make this more streamlined,
last example I know being
commit e06c9e1df28e04bbf013840c6c50ce1be41b9583
Author: Thomas Weißschuh <thomas@t-8ch.de>
Date: Wed Nov 3 21:17:02 2021 +0100
var: add GIT_DEFAULT_BRANCH variable.
There's also similar efforts that would allow querying a remote.
So I'd suggest you wait for upstream to figure it out first, rather than
blindly substituting the term which would break existing setup for no
real reason.
> Replacing one hard coded value with another is really not helpful. > Git itself solves this locally with init.defaultBranch in its config. > > If the corresponding option is unset you are helpfully told to choose > one. That is however not simply a matter of s/master/main/ but the > following: > >> Names commonly chosen instead of 'master' are 'main', 'trunk' and >> 'development'. > As you can see, multiple "common" options. At the moment I think its better to simply stay with 'master' since that is what Git uses as the default at the moment even if multiple git hosting sites have decided to adopt main > There's work ongoing in git to make this more streamlined, > last example I know being > > commit e06c9e1df28e04bbf013840c6c50ce1be41b9583 > Author: Thomas Weißschuh <thomas@t-8ch.de> > Date: Wed Nov 3 21:17:02 2021 +0100 > > var: add GIT_DEFAULT_BRANCH variable. > > There's also similar efforts that would allow querying a remote. > > So I'd suggest you wait for upstream to figure it out first, rather than > blindly substituting the term which would break existing setup for no > real reason.
[-- Attachment #1: Type: text/plain, Size: 1372 bytes --] OK, no worries there. I'm fine leaving it alone as well. Cheers, Derek ------original message------ From: Jan Drögehoff <sentrycraft123@gmail.com> Date: Sun, Jan 09, 2022 at 05:53:22AM MST >>Replacing one hard coded value with another is really not helpful. >>Git itself solves this locally with init.defaultBranch in its config. >> >>If the corresponding option is unset you are helpfully told to choose >>one. That is however not simply a matter of s/master/main/ but the >>following: >> >>>Names commonly chosen instead of 'master' are 'main', 'trunk' and >>>'development'. >>As you can see, multiple "common" options. > >At the moment I think its better to simply stay with 'master' since >that is what Git uses as the default at the moment > >even if multiple git hosting sites have decided to adopt main > >>There's work ongoing in git to make this more streamlined, >>last example I know being >> >> commit e06c9e1df28e04bbf013840c6c50ce1be41b9583 >> Author: Thomas Weißschuh <thomas@t-8ch.de> >> Date: Wed Nov 3 21:17:02 2021 +0100 >> >> var: add GIT_DEFAULT_BRANCH variable. >> >>There's also similar efforts that would allow querying a remote. >> >>So I'd suggest you wait for upstream to figure it out first, rather than >>blindly substituting the term which would break existing setup for no >>real reason. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --]