From owner-freebsd-git@freebsd.org Wed Nov 18 23:42:13 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 DF144474CEC for ; Wed, 18 Nov 2020 23:42:13 +0000 (UTC) (envelope-from marcnarc@gmail.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (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 4Cbzqm4Lr0z4pWh for ; Wed, 18 Nov 2020 23:42:12 +0000 (UTC) (envelope-from marcnarc@gmail.com) Received: by mail-qt1-x836.google.com with SMTP id g15so3036605qtq.13 for ; Wed, 18 Nov 2020 15:42:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=iInUK31bUK4kWimApSW4Rl1Y9PJHY9kYvnWugNfW39w=; b=LaSuyb05rOXff4o5GRIMoWQM48QF1LeG9LxnAqpqP7nqImKwb4oZTgmNK03SnwIYL5 SoF7wU2G3BXsCdkt9+jfT20kGdx+S1zLN5M+KbBtlylB3BpjVff1/PKrw2LbOGBaoLZw qj5mj9Ir/ntJy9tUHnYbV4m8yRjQjkc/TNhVe6NT+8Z83tiMOnn2CWrBS5n+UIQusQ3B zPCFB4CDH6Tz53uwLKrxeM52kbKscGjRop9VO7JsA6htSDw5DRfKseLrr9ltH6AIUQQw NOPYZzlq89oj9gXWy3rL0FN/bOa+XDd184YzRG+jIwilygR/XjjSzuiWYgUU4o3YAK9B OJ9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=iInUK31bUK4kWimApSW4Rl1Y9PJHY9kYvnWugNfW39w=; b=U5uV65W0zYCU4+A429++kTIBQEO8LhrHaIHz72u7IZD8xllBG9372xF9HpBc5h0nDB JMN8VYBdIf6knQ7PTEl42T2zpgEQXtqjA6M/FL2bqvVgcvX9bikv+xqDilnp7tUuNBT0 +VwjIShT1Gyez+7EQbGz/ZZcKQu8uyfTeRFtMILYSMnnpR5g4KIwuXd027icsSPr72wg mvzBs6wA/faeHRHfKX2Zcr0UNfQcZaY98ul2btiuimiFraOCJeSq5BO9CmPQEDyiI9td lRTBYthqqVjutrQWwx5OeREtXLRbKPYKQxa1DZgYCwnWXYVhmLIezthB/XJTKgZqwPhY lKbw== X-Gm-Message-State: AOAM530WtZ2TTDtXRVXalnsjmL+HQTmMXIpxBkZgYR93/BIAe2eIPEll DWCiX9vuerJ8NKq+QOLxMteeyj3tzRbft2Fc X-Google-Smtp-Source: ABdhPJxukiEcVKiDtGGQlBwwNveHZHmreU7XOF7lJSJxa6hSesgBE3EgbPduEf2XNoIKWgMF+PAHPQ== X-Received: by 2002:ac8:5059:: with SMTP id h25mr7509171qtm.283.1605742931665; Wed, 18 Nov 2020 15:42:11 -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 137sm17584214qkj.109.2020.11.18.15.42.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Nov 2020 15:42:11 -0800 (PST) Subject: Re: checking out a commits on port quarterly branch To: Dan Langille , freebsd-git@freebsd.org References: <5E8AEDD5-327A-46A0-A186-EDBC616A9F89@langille.org> From: Marc Branchaud Message-ID: <47863540-fbe8-bd1e-25bd-da17f4ca5d06@gmail.com> Date: Wed, 18 Nov 2020 18:42:09 -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: <5E8AEDD5-327A-46A0-A186-EDBC616A9F89@langille.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Cbzqm4Lr0z4pWh X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=LaSuyb05; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of marcnarc@gmail.com designates 2607:f8b0:4864:20::836 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::836: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::836:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::836: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: Wed, 18 Nov 2020 23:42:13 -0000 Hi Dan, You're doing it right, assuming that you're not going to be adding any new work atop that checked-out commit. Your working copy does indeed reflect the code as of commit 46433baae934d92698422495b72f811839caa1a9. I've found that the best way to think of git branches is simply as a label for a particular commit SHA ID. Git has other ways of labeling a commit (notably tags, and you can actually create your own, separate sets of labels if you like). Git internally calls these labels "refs". The special thing about a branch "ref" is that, when you have the branch checked-out and create a new commit, git automatically updates the branch's label to refer to the new commit. But you can also checkout a commit using its SHA ID, as you did. In this case you are not using a branch, so git is warning you that it is not tracking a name for any new commits you might create. Git still lets you do anything you want in this "detached" state, with the caveat that if you make new commits then it's up to you to figure out how to keep track of them (SHA IDs being a bit hard to memorize). BTW, checking out a tag also puts git into the "detached" state, because tags are considered static and so they do not get automatically updated when you add new commits. For regular development it's important to understand when you're in the "detached" state, because it's easy to lose your work. Hence the big warning message (which you can disable). But if you're just looking to build the code at a particular commit, you're fine being "detached" from any actual branch. M. On 2020-11-18 5:30 p.m., Dan Langille wrote: > When FreshPorts processes a commit, it needs a working copy of the repo as it was at the time of that commit. > > I have this working on head. I am trying to figure out how to do that when the commit is on a branch. > > To get a copy of the branch, I do: > > $ git checkout branches/2020Q4 > $ git branch > branches/2020Q2 > branches/2020Q3 > * branches/2020Q4 > master > > Next, I want the tree as it existed at commit 46433baae934d92698422495b72f811839caa1a9 > > i.e. https://github.com/freebsd/freebsd-ports/commit/46433baae934d92698422495b72f811839caa1a9 > > My first attempt is > > $ git checkout 46433baae934d92698422495b72f811839caa1a9 > Note: switching to '46433baae934d92698422495b72f811839caa1a9'. > > You are in 'detached HEAD' state. You can look around, make experimental > changes and commit them, and you can discard any commits you make in this > state without impacting any branches by switching back to a branch. > > If you want to create a new branch to retain commits you create, you may > do so (now or later) by using -c with the switch command. Example: > > git switch -c > > Or undo this operation with: > > git switch - > > Turn off this advice by setting config variable advice.detachedHead to false > > HEAD is now at 46433baae934 MFH: r555565 > > That "MFH: r555565' message indicates that I am at the right commit. > > Is this a concern? > > $ git branch > * (HEAD detached at 46433baae934) > branches/2020Q2 > branches/2020Q3 > branches/2020Q4 > master > > > Am I doing this right? > > Thank you > >