From owner-freebsd-git@freebsd.org Fri Feb 5 11:24:20 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 9AEAE54588F for ; Fri, 5 Feb 2021 11:24:20 +0000 (UTC) (envelope-from adridg@freebsd.org) Received: from lb3-smtp-cloud8.xs4all.net (lb3-smtp-cloud8.xs4all.net [194.109.24.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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.xs4all.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXCjw2WvCz4tCF for ; Fri, 5 Feb 2021 11:24:20 +0000 (UTC) (envelope-from adridg@freebsd.org) Received: from cust-d4a83f22 ([IPv6:fc0c:c11d:cecc:f58a:eaa1:c0:9d8f:c143]) by smtp-cloud8.xs4all.net with ESMTPA id 7zDllOpx4W4yN7zDmletuS; Fri, 05 Feb 2021 12:24:19 +0100 From: Adriaan de Groot To: freebsd-git@freebsd.org Subject: Re: Referencing git commit in the comment of Bugzilla Date: Fri, 05 Feb 2021 12:24:17 +0100 Message-ID: <2170105.sMrx5ctUpN@beastie.bionicmutton.org> Organization: FreeBSD In-Reply-To: <20210205.094644.1159184285479762732.yasu@utahime.org> References: <20210205.094644.1159184285479762732.yasu@utahime.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart3020904.ZmR5Pbtf01"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-CMAE-Envelope: MS4xfFXNeG3HFwMTnmCCaD2P4IEqcOIz6LbBVNM6sg0+mxCOAwi+PcuA05g72+tngcEF5Nf5/h4BNc2Co+5bSYkZEqW+mUmB8inJqmSRFDCJbQtq7Rg32OIb u3BoJqfIRm3W2HdhSHP3u5CvIJO01OC/gE94tn+mioH4mmdCdWyBgiBz7imgY17xcRzcdjeCoALCl8X4/d0SdQwMn1oeOyoyDRaLd2hkFL+iLrkqsB5RU0z8 bm/hwQ29XrMQfBqYbE7YSpYN91MjSGxcca/6a7u6iOEQUvbincYVztDP+UoOxTvX X-Rspamd-Queue-Id: 4DXCjw2WvCz4tCF X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:3265, ipnet:194.109.0.0/16, country:NL] 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: Fri, 05 Feb 2021 11:24:20 -0000 --nextPart3020904.ZmR5Pbtf01 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8"; protected-headers="v1" From: Adriaan de Groot To: freebsd-git@freebsd.org Cc: Yasuhiro Kimura Subject: Re: Referencing git commit in the comment of Bugzilla Date: Fri, 05 Feb 2021 12:24:17 +0100 Message-ID: <2170105.sMrx5ctUpN@beastie.bionicmutton.org> Organization: FreeBSD In-Reply-To: <20210205.094644.1159184285479762732.yasu@utahime.org> References: <20210205.094644.1159184285479762732.yasu@utahime.org> On Friday, 5 February 2021 01:46:44 CET Yasuhiro Kimura wrote: > Doc and src have already migrated to git and ports will follow soon. > In this situation it's quite possbile that bug reporter wants to > reference git commit in the comment of bug report submitted to > Bugzilla. Then is there standard(?) way to do it? As for subversion > syntax such as "base r123456" or "ports r778899" is provided. And I > expect similar one is provided for git. Carrying on with two points: - If you always want to see short hashes in `git log` and similar commands, you can configure it. Set `log.abbrevCommit` to true, for instance git config --global log.abbrevCommit true You can leave out `--global` if you only want to apply it to the "current" git repository, which is wherever your current working directory is. - To address the nice-number-that-goes-up issue -- and remember, git is all branchy -- you can ask the question "can I follow commit history from hash A to hash B?". I'm not sure git can answer this question directly, but a question you **can** ask is "what is the shared ancestor commit of hash A and hash B?". If the answer is "A" then B is reachable from A, and A comes before B. If the answer is "B" then it's the other way around. And if there is some **other** answer, then the two hashes are not ordered -- for instance, when they are in different branches. Git provides the `merge-base` command to find that common ancestor, with a flag `--is-ancestor` to .. huh, to answer the original question and return a truthiness exit value, for instance: git merge-base --is-ancestor c5cc7822b0494e5474c2f305dda95aabeb64aa6f b8a9c4c3b78aa58e289dd9212f399e3f6af690b0 && echo yes [ade] --nextPart3020904.ZmR5Pbtf01 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQGzBAABCAAdFiEEhrjttu2OP5apuuy1z93JbxKxkVwFAmAdKuEACgkQz93JbxKx kVxAvQv/RZfOihXlwCOZ7eHREQ7mQRQLXr5kL3uUb57d0JUdqTTjiFGibfZ8Wp5H xzj+osHyQ+hcVznKIKxx2NJDkjbZ0P1gq+EcFhLcod4ThU1360sJ6L1MVAPPJNfN r/4Q5vDc1ZC/yIE+5O6/PvrOkIVH/Haw7tHGMDLFbvA7oy9DjUG9B8udtUkOo2rM bNrQVVMXQhsIrMQSp/s6bU3QHMdDX0+voBKRePS9ypaXOte00v9HKvoSITZNk/H3 9xBNyIaK1ycrsEuB2OgM5dKoR/vRUZ+wk08AechJebGDJk8YBbaMK70kLXu1Mccd WFbFQMkt96LbE7J874SriH8lyikzStkkTsx5IH6Bb1VG+w90pVC8/3aTaWWAb0Cz mEMT8QuU+JvHPHNP7rtQqQTtn3cF6ul9p2RXVMu5eleUt08oAPX8J+TJOFa6ZJu1 2zmAGTD4wmN1IyH9k5c3yWoUvQXWGhUJPus49jMT/ro4d8SAz3QAnBoZD3+frr4i YVIpdUvZ =+UpU -----END PGP SIGNATURE----- --nextPart3020904.ZmR5Pbtf01--