List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH] use main as default branch instead of master
@ 2022-01-09  1:45 Derek Stevens
  2022-01-09  3:04 ` Reto
  0 siblings, 1 reply; 4+ messages in thread
From: Derek Stevens @ 2022-01-09  1:45 UTC (permalink / raw)
  To: cgit; +Cc: Derek Stevens

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


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

* Re: [PATCH] use main as default branch instead of master
  2022-01-09  1:45 [PATCH] use main as default branch instead of master Derek Stevens
@ 2022-01-09  3:04 ` Reto
  2022-01-09 12:53   ` Jan Drögehoff
  0 siblings, 1 reply; 4+ messages in thread
From: Reto @ 2022-01-09  3:04 UTC (permalink / raw)
  To: Derek Stevens; +Cc: cgit

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.

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

* Re: [PATCH] use main as default branch instead of master
  2022-01-09  3:04 ` Reto
@ 2022-01-09 12:53   ` Jan Drögehoff
  2022-01-09 17:22     ` Derek Stevens
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Drögehoff @ 2022-01-09 12:53 UTC (permalink / raw)
  To: cgit

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

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

* Re: [PATCH] use main as default branch instead of master
  2022-01-09 12:53   ` Jan Drögehoff
@ 2022-01-09 17:22     ` Derek Stevens
  0 siblings, 0 replies; 4+ messages in thread
From: Derek Stevens @ 2022-01-09 17:22 UTC (permalink / raw)
  To: Jan Drögehoff; +Cc: cgit

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

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-09  1:45 [PATCH] use main as default branch instead of master Derek Stevens
2022-01-09  3:04 ` Reto
2022-01-09 12:53   ` Jan Drögehoff
2022-01-09 17:22     ` Derek Stevens

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