user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] import: convert init.defaultBranch to fully qualified ref
@ 2021-04-07 23:05 Kyle Meyer
  2021-04-07 23:27 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Meyer @ 2021-04-07 23:05 UTC (permalink / raw)
  To: meta

Recently I've tried lei on another machine and scratched my head for a
bit about why the local storage seemed to be in a corrupt state.  With
`lei q', no mail was getting imported, and I saw a good number of
"fatal: not a git repository: ..." messages.

It turns out that HEAD's content is invalid, and that's happening
because PublicInbox::Import mishandles init.defaultBranch, which I've
configured on that machine to suppress the associated `git init' hint.

-- >8 --
Subject: [PATCH] import: convert init.defaultBranch to fully qualified ref

init.defaultBranch expects a branch name, not a fully qualified ref.
git-init prepends "refs/heads/" automatically and unconditionally.

PublicInbox::Import::default_branch, however, incorrectly passes on
the init.defaultBranch value as is, leading to it being used in spots
where a fully qualified ref is required.  For example, with an
init.defaultBranch value of "master", public-inbox-index for a v2
repository would lead to an all.git repository where HEAD's content is
"ref: master" instead of "ref: refs/heads/master".

Prepend "refs/heads/" to the incoming init.defaultBranch value.

Fixes: 7c2f36de2fb49dd7 (import: respect init.defaultBranch)
---
 lib/PublicInbox/Import.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 46f57e27..3adf9dec 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -25,7 +25,7 @@ sub default_branch () {
 				 { GIT_CONFIG => undef });
 		chomp(my $h = <$r> // '');
 		close $r;
-		$h eq '' ? 'refs/heads/master' : $h;
+		$h eq '' ? 'refs/heads/master' : "refs/heads/$h";
 	}
 }
 

base-commit: 86c2ebf085cc9897bafcb95b82890f2645f515e5
-- 
2.31.1


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

* Re: [PATCH] import: convert init.defaultBranch to fully qualified ref
  2021-04-07 23:05 [PATCH] import: convert init.defaultBranch to fully qualified ref Kyle Meyer
@ 2021-04-07 23:27 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2021-04-07 23:27 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: meta

Kyle Meyer <kyle@kyleam.com> wrote:
> Recently I've tried lei on another machine and scratched my head for a
> bit about why the local storage seemed to be in a corrupt state.  With
> `lei q', no mail was getting imported, and I saw a good number of
> "fatal: not a git repository: ..." messages.

Hmm.. I've been thinking about how to improve error reporting
with async stores, maybe commit 842e684f0a4154787274843eb3c9be2eef11b160
("lei/store: (more) synchronous non-fatal error output")
would do it...

> Fixes: 7c2f36de2fb49dd7 (import: respect init.defaultBranch)

Oops, thanks.  Pushed as commit ea4e9025dd14f251996baf724e04fc478375b6a2

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

end of thread, other threads:[~2021-04-07 23:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 23:05 [PATCH] import: convert init.defaultBranch to fully qualified ref Kyle Meyer
2021-04-07 23:27 ` Eric Wong

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ http://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git