From 947c4a9359a54fa1be5debe02acd00d2edcdafa9 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 21 Oct 2024 11:03:04 -0400 Subject: [PATCH] CONTRIBUTING.adoc: document how to refer to a commit in commit messages This is what I already do, I would like it to make it an official procedure. What I want to avoid is having commits referred to just using their hashes, which is meaningless for humans. Change-Id: I47b5044d74d3d10e2b953fe7ad291b4468391da2 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/13379 Reviewed-by: Philippe Proulx --- CONTRIBUTING.adoc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index 9225518b..c15dc1ce 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -1,8 +1,8 @@ // Render with Asciidoctor = Babeltrace{nbsp}2 contributor's guide -Jérémie Galarneau, Philippe Proulx -22 February 2024 +Jérémie Galarneau, Simon Marchi, Philippe Proulx +23 October 2024 :toc: left :toclevels: 3 :icons: font @@ -2307,3 +2307,19 @@ https://github.com/psf/black[Black] specified in `dev-requirements.txt`. All Python imports must be sorted using the version of https://pycqa.github.io/isort/[isort] indicated in `dev-requirements.txt`. + +== Git + +=== Commit message style + +When referring to a specific commit (either in free text or in a +trailer line), use the `__12-DIGIT HASH__ ("__SUBJECT__")` +https://www.kernel.org/doc/html/v4.10/process/submitting-patches.html#describe-your-changes[format], +for example: + + 602446e40e7a ("ctf: add explicit cast to CStringView in ternary") + +Generate such a string from the `HEAD` commit of a repository with: + + $ git log -1 --abbrev=12 --pretty='%h ("%s")' + -- 2.34.1