Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Feb 2021 12:04:33 +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:  <2268670.THHZn3L5Ee@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
--nextPart3763654.kAAoriTUSa
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:04:33 +0100
Message-ID: <2268670.THHZn3L5Ee@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.

Since a "git commit" has a hash, there is no nice number-that-always-goes-up 
to specify a commit; there **is** the hash, though, which might be

b8a9c4c3b78aa58e289dd9212f399e3f6af690b0

That is a long and annoying string, and since *usually* there are no 
collisions, git provides "short hash" notation: a unique prefix of the commit 
hash is enough. In the specific repository I'm working in,

b8a9c4c3b

is enough: 9 characters instead of 40. In a different repo (FreeBSD ports, as 
it happens), asking for a short hash (of a different commit) gives me

be24aaa957c8

so 12 characters. The commit before that one was

ef537e763f17

which shows there is no nice number-that-always-goes-up property.


To get the hash, use (for instance) `git log -1`; to get the shorter one, use 
`git log -1 --abbrev-commit`. You could add an alias ("slog", for short-log) 
adding `--abbrev-commit` if you always want to see the short hash; do note 
that the short hash can become *longer* later in history if a prefix collision 
does happen.

[ade]
--nextPart3763654.kAAoriTUSa
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit

-----BEGIN PGP SIGNATURE-----

iQGzBAABCAAdFiEEhrjttu2OP5apuuy1z93JbxKxkVwFAmAdJkEACgkQz93JbxKx
kVyAlwwArG0BhNzmB8dXEgirR/ydWDypKNzrwSwsvcJGqRJqHbx/k1vjU8aF+Ebh
zh2YRRJXRuXmf3ptj/sjcBdnV43Dl/bLrivZVZeeafq7Yv0ReMsf0orTAolC+sw+
I1vyxPjpTNellu4bVgn9MsN1OBMVmcXj/7w+2glJexiJqn3DaFrp9EQkmFDJ3pUy
DeOvKAX4tovLfZpuCUaaCdJZVAwEPC0y1aAemGF/BFfGlAGD0n3rRmgZ/KDEh1x2
iZkod3V+9t/k7tPnOvkMKtZaitBce8NbgFsjlFy+4CSdjY89rhvnkG0cO8hSacSu
0uMTAHn6tHVHoairy+H/puu+4xSTFdrSRe8fU2DDPfHBG2L/BrwfNycCjv/VTTFo
WsRnh81VD/7pNe6NofZyZBBVl0rLcokUAh9TzKBNlIZ6CZTGXFcVBzXQtazmXW+c
EKx+PW5MAt5wUrsHm7ZTfi7qJ/zvoCG5yb/HESoFj/J7Way4bsE7zgKo5wyBndTD
N10a2pS/
=RUZh
-----END PGP SIGNATURE-----

--nextPart3763654.kAAoriTUSa--






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2268670.THHZn3L5Ee>