Date: Fri, 05 Feb 2021 12:24:17 +0100 From: Adriaan de Groot <adridg@freebsd.org> To: freebsd-git@freebsd.org Subject: Re: Referencing git commit in the comment of Bugzilla Message-ID: <2170105.sMrx5ctUpN@beastie.bionicmutton.org> In-Reply-To: <20210205.094644.1159184285479762732.yasu@utahime.org> References: <20210205.094644.1159184285479762732.yasu@utahime.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart3020904.ZmR5Pbtf01 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8"; protected-headers="v1" From: Adriaan de Groot <adridg@freebsd.org> To: freebsd-git@freebsd.org Cc: Yasuhiro Kimura <yasu@utahime.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> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2170105.sMrx5ctUpN>