From owner-freebsd-git@freebsd.org Sat Apr 17 01:23:41 2021 Return-Path: Delivered-To: freebsd-git@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B7EE5E89A7 for ; Sat, 17 Apr 2021 01:23:41 +0000 (UTC) (envelope-from dan@langille.org) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FMb2426MPz3ML2; Sat, 17 Apr 2021 01:23:40 +0000 (UTC) (envelope-from dan@langille.org) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A798B5C0ECB; Fri, 16 Apr 2021 21:08:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 16 Apr 2021 21:08:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=langille.org; h= from:content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; s=fm1; bh=n0tvsXJgORj2QhYly3zbUd9tiHgfWh EafMZ/etkVBK8=; b=fGgLPQlfujyT1XVklRselpmgz2u/kftIVM+3P3ljouXehr zB6ZY09g4Sgw74ZJXNiZkQ0AR7XsqSMu46SOBoqTrdzHLhLVrzfl+uA5ZwrseWu1 nQls+gtSwhKkIwoUz5yPiJeQ7shsN0LGoLxXMM7I301icolX/jMQztRz3Je76aG6 LEMpQL80wCFRauRsLR30ofiPH4nuci/eryCfJBCQjiLiwfFLGOfXQHrDV6AuM8V6 HY0xIFxih0FJvZah4ddfZez1RqEcPbO0B+AA/8xbHSMk8Eso6D4wvzTeoUDJZROD hgOv0twHW8dZFvFtyGxTTf8mLEtqEfA4GThm2WJg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=n0tvsX JgORj2QhYly3zbUd9tiHgfWhEafMZ/etkVBK8=; b=QP6Ki9S3kSyPSDKpVLzmGn f2Q3qXrdV36f7ajTVbcQsO5tPA+3swPXdGGBF7TLVxAFATEvbXWt0ECq78CnU6o+ iUGv+fLU56zrjUwlS6PCNVn80pWdu98BWDQyxDaaCgIc9AdbGph4jD139DidylwV 9spCdpZyAA/XH1RNDq8aTPx2sAYMiZrTJzg24dcajnjnnNc2ZLXsvEvP0T0jO5ut kU0hWkOC0e1+S6SRPYl1v9CKP+hT32+BkPLMApchEmM54PwSVzuJNVGoUw3+w1Du yxpSbA48M9sGj3VnNcVbS7a9x5ItprWHytDIF7XwHerMdQPYy5wF+3XUYkzUS1qg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudeliedggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhtgfgggfukfffvffosehtqhhmtd hhtddvnecuhfhrohhmpeffrghnucfnrghnghhilhhlvgcuoegurghnsehlrghnghhilhhl vgdrohhrgheqnecuggftrfgrthhtvghrnhepgfehgfeuheehteefteeifeffjeduieeuue ejvedugfeuteejffdugfduhfekveevnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhg necukfhppeejvddrjeekrdduledtrdduledtnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepuggrnheslhgrnhhgihhllhgvrdhorhhg X-ME-Proxy: Received: from [10.222.78.31] (pool-72-78-190-190.phlapa.fios.verizon.net [72.78.190.190]) by mail.messagingengine.com (Postfix) with ESMTPA id 1C2DA1080064; Fri, 16 Apr 2021 21:08:27 -0400 (EDT) From: Dan Langille Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: FreshPorts - processing branches: help wanted Message-Id: <35888E09-CF1B-42AD-98B4-3792A0458912@langille.org> Date: Fri, 16 Apr 2021 21:08:23 -0400 To: freebsd-git@freebsd.org X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FMb2426MPz3ML2 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=langille.org header.s=fm1 header.b=fGgLPQlf; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=QP6Ki9S3; dmarc=pass (policy=none) header.from=langille.org; spf=pass (mx1.freebsd.org: domain of dan@langille.org designates 66.111.4.29 as permitted sender) smtp.mailfrom=dan@langille.org X-Spamd-Result: default: False [-1.60 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.29]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[langille.org:+,messagingengine.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[langille.org,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RECEIVED_SPAMHAUS_PBL(0.00)[72.78.190.190:received]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[66.111.4.29:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[langille.org:s=fm1,messagingengine.com:s=fm2]; FREEFALL_USER(0.00)[dan]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; SPAMHAUS_ZRD(0.00)[66.111.4.29:from:127.0.2.255]; RCVD_IN_DNSWL_LOW(-0.10)[66.111.4.29:from]; MAILMAN_DEST(0.00)[freebsd-git] X-BeenThere: freebsd-git@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussion of git use in the FreeBSD project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Apr 2021 01:23:41 -0000 Back in Nov mat wrote: re: = https://lists.freebsd.org/pipermail/freebsd-git/2020-November/000498.html > =46rom what I understood, freshports never needs to be able to access > files on the top of a branch, it only needs to access the files on > specific commits (the fact that a commit is at the top of the branch = is > only an artefact of the process). So, you never need to checkout any > branches, you only need to checkout commits. So you never have a HEAD > that points to a branch, HEAD is always in a detached state and points > to a commit. Yes. This is the current state on production: [dan@ingress01:/var/db/freshports/ports-jail/var/db/repos/ports] $ git = status HEAD detached at 9d5f4ef1a469 nothing to commit, working tree clean > So what you need to do is, git clone the repository, and then, each = time > the script runs, do (in somewhat shell script): >=20 > ############################# > NAME_OF_REMOTE=3Dorigin > NAME_OF_HEAD=3Dmain >=20 > cd /where/the/repo/is >=20 > git fetch >=20 > # get all references (so, branches, tags, and so one) and keep only > # branches (named commits here) that the remote repository has >=20 If I want to follow a new remote branch, I have to first do: git = checkout ? This makes some sense to me, but this late in the day, I can't follow = it. I'm hoping someone is willing to follow up on this suggestion and = proceed with coding. It doesn't depend upon having a FreshPorts environment at all. Thank you. > git for-each-ref --format '%(objecttype) %(refname)' \ > | sed -n 's/^commit refs\/remotes\///p' > | while read -r type refname > do >=20 > # If we don't have the tag, it means we have not encountered the > # branch yet. > if ! git tag -l freshports/$refname > then >=20 > # get the first commit of that branch and create a tag. > git tag -m "first known commit of $refname" -f freshports/$refname = $(git merge-base $NAME_OF_REMOTE/$NAME_OF_HEAD $refname) > fi >=20 > # Get the list of commits between the last known one and the tip of > # the branch, list may be empty. > git rev-list freshports/$refname..$refname | while read commithash > do > # checkout that commit (with -f so that if some file got changed, = we > # overwrite everything > git checkout -f $commithash >=20 > # process the commit > done >=20 > # Store the last known commit that we just processed. > git tag -m "last known commit of $refname" -f freshports/$refname = $refname > done > ############################# >=20 > That's all, you never need to merge or pull or whatever else. The current solution is doing a 'git fetch'. Now it's time to start doing branches. Thank you.=20 --=20 Dan Langille - BSDCan / PGCon dan@langille.org