From owner-freebsd-git@freebsd.org Mon Nov 23 00:59:01 2020 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 B8CE047AFBA for ; Mon, 23 Nov 2020 00:59:01 +0000 (UTC) (envelope-from dan@langille.org) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CfTLX5jNzz4gxH for ; Mon, 23 Nov 2020 00:59:00 +0000 (UTC) (envelope-from dan@langille.org) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 27D00580439; Sun, 22 Nov 2020 19:59:00 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sun, 22 Nov 2020 19:59:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=langille.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm2; bh=D DTH06UtiLx74SHG87u4tsMOWRoaBjUa5uOdHpXdLNE=; b=FPhjwylofBvHiRZ0Q CserpLKgAILgRQkHTbdGL6iSNdCZv4tGh5iO3nQWlwzBmjV6M2ovT21luON9H2K2 oD6XzEG3AATeM5hQDqeQSOfsN6ESHBcldnzyf51VJ9h6r9duJsW5qAI7UYLkPSAP 9SOlDE9MxR8LflRMKTBAHor5nGhsSswMHc8O8E8+X0y38ct6jKpGsTJ45ar9xafr XqT9L+O5nZZCnmTWNHe+yiAvTd1xuztNKO7hs/80lJWHsdlLhaRG5pciM7DVYSPA dvidHz5R01UcvA9eKMGNr/yiJlm7gVDWr/V1wIFVgH+kJkYUZuGqnaVe3MVgakG4 gR4Mw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=DDTH06UtiLx74SHG87u4tsMOWRoaBjUa5uOdHpXdL NE=; b=go20xya+d60owSLgUAGVAqALYzjCjkVgNamd5aNpzIYFFzvDHvO/Lk+kK EXnkubQbdDuILwRqNb+whkAb77F22W9XtX5pKbz7lcFwE2ISleZjKZmWWUu35fCA RwVIzsSwJcKE0nIIyzHlT1ba0dal2TKrDdD7M6FUfC9G9rM4afkgoQk6onnqrehb B0/sI07pLPHtm7X/8iXOcNGhfV8ZYaohbrncMGSSS3nYUv0v6qhkSWqVwER8NgZO Lx/BwN2kLGngZpWj6EPH/x3EKUbSE0QvyLM2hPhZS0WFqyWGIipn+p2JhgPEI8bG G+44JoMMOEQ2OM4rW2mfl98S4IpwA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeghedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgoofgvughsqdftgedtgedqtdeiucdlfedttddmne cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtvdenucfhrhhomhepffgrnhcu nfgrnhhgihhllhgvuceouggrnheslhgrnhhgihhllhgvrdhorhhgqeenucggtffrrghtth gvrhhnpefggeefjeduleehveduieegfefgvddutdelgfffjeegudduhefhleekudefueet hfenucffohhmrghinhepfhhrvghshhhpohhrthhsrdhorhhgnecukfhppeejvddrjeekrd duledtrdduledtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomhepuggrnheslhgrnhhgihhllhgvrdhorhhg 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 C09F63280065; Sun, 22 Nov 2020 19:58:59 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: Monitoring commits on all branches From: Dan Langille In-Reply-To: Date: Sun, 22 Nov 2020 19:58:59 -0500 Cc: freebsd-git@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6EA93D4C-B399-413D-8C35-224103CC48D6@langille.org> References: <197541CC-FEA7-4B4C-936E-66A5625BB64C@langille.org> <3c9f6285-ae7c-1062-2dd3-42f8c953a230@gmail.com> <93aa2a3e-7e8a-8199-3feb-6e464a590d72@gmail.com> <785f1386-f521-46d2-8e2e-a7c502fd943a@www.fastmail.com> To: Marc Branchaud X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4CfTLX5jNzz4gxH X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=langille.org header.s=fm2 header.b=FPhjwylo; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=go20xya+; dmarc=pass (policy=none) header.from=langille.org; spf=pass (mx1.freebsd.org: domain of dan@langille.org designates 66.111.4.221 as permitted sender) smtp.mailfrom=dan@langille.org X-Spamd-Result: default: False [-3.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.221]; RWL_MAILSPIKE_GOOD(0.00)[66.111.4.221:from]; 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]; FREEMAIL_TO(0.00)[gmail.com]; 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.221: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)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[langille.org:s=fm2,messagingengine.com:s=fm1]; FREEFALL_USER(0.00)[dan]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[66.111.4.221:from:127.0.2.255]; RCVD_IN_DNSWL_LOW(-0.10)[66.111.4.221:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; 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: Mon, 23 Nov 2020 00:59:01 -0000 Today I managed to sit down and go through the multiple scripts involved = in pulling in a commit. = https://news.freshports.org/2020/11/22/git-commit-processing-how-is-it-don= e/ Some changes were made.... > On Nov 21, 2020, at 2:06 PM, Marc Branchaud = wrote: >=20 > (trimmed some of the quoting) >=20 > On 2020-11-21 9:11 a.m., Dan Langille wrote: >> On Thu, Nov 19, 2020, at 5:30 PM, Marc Branchaud wrote: >>> Watch out with that "git checkout branch" part: This is where a lot = of >>> people get tripped up when they move from svn to git. It doesn't = help >>> that git tries to do some hand-holding here, but really git users = would >>> benefit from simply understanding how branch names are just labels = for >>> commit SHA IDs. Without that understanding, people end up going = down >>> the rabbit-hole that is the "git pull" command, a wretched hive of = scum >>> and villainy if there ever was one. >> I understand the concern and I think I follow. Within the confines = of >> 'only wanting the files for reference, never local modification', = pull and >> fetch might be the same for me. I'll look at fetch more. >=20 > "git fetch" is just the "get updates from the remote repo" part of = "git pull". >=20 > The thing with pull is that it wants to "help" you update your local = branches the "right" way. But the "right" way really depends on how you = work and how your project works. So most advice to "do a 'git pull'" is = only useful for the most general of cases. Commits on the quarterly branch are now being automatically processed. Now that the code is not doing 'git checkout master', which made sense = on master, things are going better. git fetch git checkout master git rebase $REMOTE/master Now its just doing: git pull git rev-list ..HEAD This seems to be working. However, that may change if I start doing local tags. > I consider "git pull" to be one of git's most advanced commands. It's = very powerful, and can certainly make life easier -- once you actually = understand how git works and how to configure pull to do what you = actually want. I always advise git beginners to stay away from using = pull until they have a firm grasp of git's branches and of how they want = to use them. >=20 > I personally never use "git pull" because I regularly want to use my = local branches in different ways, even within a single project/repo. I'll keep that in mind should I start using branches in different ways. >=20 >>> Looking through the set of hooks ("git help hooks"), I don't see >>> anything that would help you. >> My idea for a hook: FreeBSD tells FreshPorts when a new commit = arrives. >> FreshPorts wakes up and processes it. >=20 > That's certainly doable, though a bit unusual: Most "downstream" = projects fetch updates from their upstream. I was assuming you didn't = want any special consideration from the FreeBSD repositories. I am purposely avoiding the github commit hooks. They are too tied in... >=20 >>>> * Once branch exists, how do you find out about the commits when = you have no >>>> starting point for 'git log'? >>>=20 >>> Use "git merge-base" to find where the new branch split off from the >>> "master" or "main" branch. >> That is my starting commit for that branch? >=20 > No, it's the *parent* of your starting commit. >=20 > To list the SHA IDs of all the commits in the branch, do: >=20 > BASE=3D`git merge-base master..$BRANCH` > git rev-list $BASE..$BRANCH Thanks. >=20 >>> One last, small idea: Consider using tags in your local repos to = track >>> your $branch_last_hash. For example, after you finish processing = the >>> 2020Q4 branch, do >>> git tag -f last-2020Q4 origin/branches/2020Q4 >>> Then the next time through the 2020Q4 branch you can start at the >>> "last-2020Q4" tag. For a new branch that doesn't have a tag yet, = use >>> "git merge-base" to find the starting point. >> Tags in my local repos won't get things upset? >=20 > Not at all: tags are local in git -- just make sure to choose unique = tag names, since you don't want to collide with any tags your upstream = repo might use. Tags can be pushed to / fetched from other repos, but = since you're not updating the upstream FreeBSD repos (or any other = public repo, I assume) you can do anything you want with your tags. That may be for next weekend. =20 >> If I lose the local repo.... >=20 > That problem exists no matter how to choose to store state for your = scripts. >=20 > With git it's easy to backup your local repository, including its = tags: just "clone --mirror" it. Got it. --=20 Dan Langille - BSDCan / PGCon dan@langille.org