From owner-freebsd-git@freebsd.org Sat Nov 21 19:07:00 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 C391746DFF7 for ; Sat, 21 Nov 2020 19:07:00 +0000 (UTC) (envelope-from marcnarc@gmail.com) Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CdjZq60Hlz3KMN for ; Sat, 21 Nov 2020 19:06:59 +0000 (UTC) (envelope-from marcnarc@gmail.com) Received: by mail-qt1-x835.google.com with SMTP id e60so561921qtd.3 for ; Sat, 21 Nov 2020 11:06:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6GrDPzZFlol8mHxAHBL9I1vBp5ARf1CmWeDrPCzw/2I=; b=S6KAqnsNFhcT8hpIAL6cFvTjkaUMg5CILEf3fKC8rfdPdmSwJOKJ+ojkVbRkqTUlQ1 8JoQzRB3soUcJueo+zuXyY9hiJtQV9B6rj5d58natSG3gq19dxVsJHDER0f8hGOoiNvw jsCAKbTc2ESz2nMR1a/PAMwhLCFZgQtKS5aAbFg4S7VDk1x8koif9gboN/8B8SBgHluj qkbHcSygxnGX28pWJIFP1y0aHKA7rYg5/3qZjTTrJq1FxRAXS8iFpbvKLDFcUK9KqGrA Pbxy7zSudlY3y2tsxmZlSFpEWu405VaAI9OuTP/J7reOe4aHfwGr7balWsQmfdXKnyVc eQtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6GrDPzZFlol8mHxAHBL9I1vBp5ARf1CmWeDrPCzw/2I=; b=eKW/2rGwCFTOIf8KibDgATWiBFB+BYN3dEaIs8DX/brfaxto+n3/xgn62xf9kqdvQC vpPyWSrdP3xIfKSEusZBTWu4p49EE1SjnGMtC9CGhsu9nGDXz13S1bCybUTF/7XG4+P0 s9HnTYL6sIDO2QdgUQjr9vXMyOIQWoNVD3+0LTfk1c76dLzD4hNMv7OvQ/UnTkHwQzAk OEqOR474HTUTqDkY6BD2ZL0x1yHeDfzTF7b3R7wc7bJqRl6LYVRIkOW1gjy0nTvJBI44 hd7bjXhOO4W6L15UJvBf2r5sq/Yy4+PYPtSAOGbYV8cScJubTZdc/RVfaazBdgxct1iL wxBw== X-Gm-Message-State: AOAM530e8yHPUXw08DjNA4cJzw25T3bNop3CwWyKA1oTjjpbO+2kRXB2 M9MQnAs5Plqx/Ohh0ioJurg= X-Google-Smtp-Source: ABdhPJx035IcKY19GXS3aLBtkN0G52cUz10xFJpLnsoOndCbBqJZ5LrzGjTEPUDlturCo1Htu2ouZg== X-Received: by 2002:a05:622a:206:: with SMTP id b6mr21701728qtx.285.1605985618647; Sat, 21 Nov 2020 11:06:58 -0800 (PST) Received: from [192.168.222.18] (192-222-183-158.qc.cable.ebox.net. [192.222.183.158]) by smtp.gmail.com with ESMTPSA id l91sm4543824qte.28.2020.11.21.11.06.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Nov 2020 11:06:57 -0800 (PST) Subject: Re: Monitoring commits on all branches To: Dan Langille Cc: freebsd-git@freebsd.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> From: Marc Branchaud Message-ID: Date: Sat, 21 Nov 2020 14:06:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 In-Reply-To: <785f1386-f521-46d2-8e2e-a7c502fd943a@www.fastmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CdjZq60Hlz3KMN X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=S6KAqnsN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of marcnarc@gmail.com designates 2607:f8b0:4864:20::835 as permitted sender) smtp.mailfrom=marcnarc@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::835:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-git@freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::835:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::835:from]; RCVD_TLS_ALL(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: Sat, 21 Nov 2020 19:07:00 -0000 (trimmed some of the quoting) 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. "git fetch" is just the "get updates from the remote repo" part of "git pull". 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. 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. I personally never use "git pull" because I regularly want to use my local branches in different ways, even within a single project/repo. >> 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. 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. >>> * Once branch exists, how do you find out about the commits when you have no >>> starting point for 'git log'? >> >> 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? No, it's the *parent* of your starting commit. To list the SHA IDs of all the commits in the branch, do: BASE=`git merge-base master..$BRANCH` git rev-list $BASE..$BRANCH >> 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? 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. > If I lose the local repo.... That problem exists no matter how to choose to store state for your scripts. With git it's easy to backup your local repository, including its tags: just "clone --mirror" it. M.