user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] solver_git: support non-master git default branch
@ 2021-10-26 22:13 Thomas Weißschuh
  2021-10-27  4:20 ` Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Weißschuh @ 2021-10-26 22:13 UTC (permalink / raw)
  To: meta; +Cc: Thomas Weißschuh

---
 lib/PublicInbox/SolverGit.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index 5d5060f4..f9ce3793 100644
--- a/lib/PublicInbox/SolverGit.pm
+++ b/lib/PublicInbox/SolverGit.pm
@@ -18,6 +18,7 @@ use PublicInbox::Qspawn;
 use PublicInbox::Tmpfile;
 use PublicInbox::GitAsyncCat;
 use PublicInbox::Eml;
+use PublicInbox::Import;
 use URI::Escape qw(uri_escape_utf8);
 
 # POSIX requires _POSIX_ARG_MAX >= 4096, and xargs is required to
@@ -26,6 +27,7 @@ use URI::Escape qw(uri_escape_utf8);
 use POSIX qw(sysconf _SC_ARG_MAX);
 my $ARG_SIZE_MAX = (sysconf(_SC_ARG_MAX) || 4096) - 2048;
 my $OID_MIN = 7;
+my $default_branch = PublicInbox::Import::default_branch;
 
 # By default, "git format-patch" generates filenames with a four-digit
 # prefix, so that means 9999 patch series are OK, right? :>
@@ -304,7 +306,7 @@ EOF
 	close $fh or die "close git/config: $!";
 
 	open $fh, '>', "$git_dir/HEAD" or die "open git/HEAD: $!";
-	print $fh "ref: refs/heads/master\n" or die "print git/HEAD: $!";
+	print $fh "ref: $default_branch\n" or die "print git/HEAD: $!";
 	close $fh or die "close git/HEAD: $!";
 
 	my $f = 'objects/info/alternates';

base-commit: e7d9df936d071b4a9b72d2e6096ddf1e90c1bc05
-- 
2.33.1


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

* Re: [PATCH] solver_git: support non-master git default branch
  2021-10-26 22:13 [PATCH] solver_git: support non-master git default branch Thomas Weißschuh
@ 2021-10-27  4:20 ` Eric Wong
  2021-10-27  4:59   ` Thomas Weißschuh
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Wong @ 2021-10-27  4:20 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: meta

Thomas Weißschuh <thomas@t-8ch.de> wrote:
> diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
> index 5d5060f4..f9ce3793 100644
> --- a/lib/PublicInbox/SolverGit.pm
> +++ b/lib/PublicInbox/SolverGit.pm
> @@ -18,6 +18,7 @@ use PublicInbox::Qspawn;
>  use PublicInbox::Tmpfile;
>  use PublicInbox::GitAsyncCat;
>  use PublicInbox::Eml;
> +use PublicInbox::Import;

I'm hesitant to add PublicInbox::Import to code used in
read-only daemons.

> @@ -304,7 +306,7 @@ EOF
>  	close $fh or die "close git/config: $!";
>  
>  	open $fh, '>', "$git_dir/HEAD" or die "open git/HEAD: $!";
> -	print $fh "ref: refs/heads/master\n" or die "print git/HEAD: $!";
> +	print $fh "ref: $default_branch\n" or die "print git/HEAD: $!";

Having a global init.defaultBranch set doesn't seem to affect
SolverGit at all, and everything in solver repos is short-lived.

Replacing "master" with "s" might be an option for saving a
teeny bit of memory traffic, here. *shrug*

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

* Re: [PATCH] solver_git: support non-master git default branch
  2021-10-27  4:20 ` Eric Wong
@ 2021-10-27  4:59   ` Thomas Weißschuh
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2021-10-27  4:59 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

On 2021-10-27 04:20+0000, Eric Wong wrote:
> Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
> > index 5d5060f4..f9ce3793 100644
> > --- a/lib/PublicInbox/SolverGit.pm
> > +++ b/lib/PublicInbox/SolverGit.pm
> > @@ -18,6 +18,7 @@ use PublicInbox::Qspawn;
> >  use PublicInbox::Tmpfile;
> >  use PublicInbox::GitAsyncCat;
> >  use PublicInbox::Eml;
> > +use PublicInbox::Import;
> 
> I'm hesitant to add PublicInbox::Import to code used in
> read-only daemons.
> 
> > @@ -304,7 +306,7 @@ EOF
> >  	close $fh or die "close git/config: $!";
> >  
> >  	open $fh, '>', "$git_dir/HEAD" or die "open git/HEAD: $!";
> > -	print $fh "ref: refs/heads/master\n" or die "print git/HEAD: $!";
> > +	print $fh "ref: $default_branch\n" or die "print git/HEAD: $!";
> 
> Having a global init.defaultBranch set doesn't seem to affect
> SolverGit at all, and everything in solver repos is short-lived.

Yesterday I thought this was necessary to get one of the unittests to pass.
As you can not confirm it and I can't neither today it seems to have been an
error on my part.

Let's drop this patch.

> Replacing "master" with "s" might be an option for saving a
> teeny bit of memory traffic, here. *shrug*

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

end of thread, other threads:[~2021-10-27  4:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 22:13 [PATCH] solver_git: support non-master git default branch Thomas Weißschuh
2021-10-27  4:20 ` Eric Wong
2021-10-27  4:59   ` Thomas Weißschuh

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).