From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.0.0.0/16 X-Spam-Status: No, score=-3.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 57D831F4B4 for ; Wed, 7 Apr 2021 23:05:35 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1617836731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=Ln7Gsp5oC3Nuh98WuIEV2/RFtsXwFg7DA2QjOZ56P/U=; b=FF0pH7DaqqcHgHFqd+V82PHRx37gqdzsG79LUBNTcW2iol/J2+ffygJ6plSezmn8uH5GFU ulZ00ilLAS6vjeI56Kl/tsBG4P23UtPYtAMs26wZkvMvR40+O8Uw/w/ZavnrgjIJxtW2g2 ryoQz3Ge47FtVax4mmymRyW8acknJHHDhHEmuiT6eFlUfONw1yW+DFEWjojxj9wRMQYwIV k/KbUZ2Jp9a9WHk+f6Dp/Mp059rfh8dZq8IWrM7wwX5alGGqUiW1Cr1yTKXByPos2UN30N oRACiBHV5ZNXZOtSXunKhuPYCgE8ugA21AxSZyvTN1NVhQEfkrYelRqu97nMAQ== From: Kyle Meyer To: meta@public-inbox.org Subject: [PATCH] import: convert init.defaultBranch to fully qualified ref Date: Wed, 07 Apr 2021 19:05:24 -0400 Message-ID: <87ft01puff.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com List-Id: 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