From owner-freebsd-current@freebsd.org Sun Jan 24 22:40:50 2021 Return-Path: Delivered-To: freebsd-current@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 072634DDE3C for ; Sun, 24 Jan 2021 22:40:50 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP7J11fmkz4hpZ for ; Sun, 24 Jan 2021 22:40:48 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.16.1/8.16.1) with ESMTPS id 10OMekLd077472 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 24 Jan 2021 14:40:46 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.16.1/8.16.1/Submit) id 10OMekLu077471; Sun, 24 Jan 2021 14:40:46 -0800 (PST) (envelope-from sgk) Date: Sun, 24 Jan 2021 14:40:46 -0800 From: Steve Kargl To: Warner Losh Cc: Jeffrey Bouquet , Yasuhiro Kimura , freebsd-current Subject: Re: Getting /usr/src to match specific git hash? Message-ID: <20210124224046.GA77416@troutmask.apl.washington.edu> References: <20210124041403.GB73653@troutmask.apl.washington.edu> <20210124191445.GA76809@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4DP7J11fmkz4hpZ X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=washington.edu (policy=none); spf=none (mx1.freebsd.org: domain of sgk@troutmask.apl.washington.edu has no SPF policy when checking 128.95.76.21) smtp.mailfrom=sgk@troutmask.apl.washington.edu X-Spamd-Result: default: False [-2.00 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RBL_DBL_DONT_QUERY_IPS(0.00)[128.95.76.21:from]; SPAMHAUS_ZRD(0.00)[128.95.76.21:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:73, ipnet:128.95.0.0/16, country:US]; MAILMAN_DEST(0.00)[freebsd-current]; DMARC_POLICY_SOFTFAIL(0.10)[washington.edu : No valid SPF, No valid DKIM, none] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 22:40:50 -0000 On Sun, Jan 24, 2021 at 03:22:18PM -0700, Warner Losh wrote: > On Sun, Jan 24, 2021, 12:14 PM Steve Kargl > wrote: > >> >> Any advice on how to jump, say, 4 days ahead of the current >> date of the src/ tree? That is, I have src/ that should >> correspond to 24 Dec 2020. How do I jump to 28 Dec 2020? >> > > You could use git bisect, but as you say, the laundry list is extensive. > > Git doesn't offer checkout by date, alas. So here's some tools to help you > out. > > First, let's get a count of how many commits behind main you are at the > moment. Use 'git log --oneline --first-parent HEAD..main | wc' to get a > count of the number of commits between what you have checked out and the > tip of current. My count is 994, but I just updated, so your count will > differ and that's OK.The --first-parent in the git log above is critical, > since otherwise a number of commits from vendor merges in the vendor > branches will appear in git log's output, throwing the count off). > > Now, this is 1 month worth of -current. 4 days in the month is about 13%. > However, let's keep things simple and step forward 100 commits at a time > (which is 10% of 1000). The precise numbers don't matter, but it works out > well in this case. > > So, your commit is: > % git log -1 3cc0c0d66a0 > Author: Li-Wen Hsu > Date: Sun Dec 20 02:59:44 2020 +0000 > > Mark the repository as being converted to Git. > > which is the last subversion commit. It's also head~994, you can do a 'git > log -1 main~900' to verify that. So, let's move forward 94 commits. This > would be: > > % git log main~900 > commit 8d405efd73d3991fe1647f91a2b7c9989dd5f18f > Author: Ulrich Sprlein > Date: Wed Dec 23 22:29:34 2020 +0100 > > Fix newvers.sh to no longer print an outdated SVN rev > > which is 3 days newer and may be a good place to start: > > % git checkout main~900 > > and that will move you forward 94 commits. Do it again with main~800, etc > to find a spot that's good for you. Not as convenient as giving dates, but > once you have a count of the number of commits between where you are and > head, you can use that number to decide how far forward to go. > > You can adjust this as needed. If you don't do a git pull during this > process (and you likely shouldn't) these numbers will be stable, and a lot > easier to work with than hashes. I've found I like to move N commits rather > than N days. > > Hope this is helpful. Sadly I found no way to say HEAD+50 commits directly > in git, but maybe one of the more knowledgeable folks on this list can give > a better hint there. > > Warner Thanks for the thorough reply! After David's response I started to think (yes, I should do that more often) about the mailing list archive dev-commits-src-main. Each subject line starts with, for example, "git: 68dc94c7d314 - main -". I assume that the hash value is sufficient to grab a src/ up to and including the commit. Will the following % cd /usr/src # This is at 3cc0c0d66a0 % git checkout 68dc94c7d314 # Update to last commit in 2020. bring the src/ update to 68dc94c7d314 or do I need to use 'git pull 68dc94c7d314'? -- Steve