git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: log messages > comments

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 4, 2022, 19:41 UTC
Message-ID
<xmqqk0d91p5s.fsf@gitster.g>
In-Reply-To
<220304.86ilsuf1e8.gmgdl@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 18 quoted lines
> On Thu, Mar 03 2022, Junio C Hamano wrote:
>
>> Emily Shaffer <emilyshaffer@google.com> writes:
>>
>>>> +The goal of your log message is to convey the _why_ behind your
>>>> +change to help future developers.
>>>> +
>>>
>>> This is pretty compelling. Is it clear enough why we care about this in
>>> the commit message, as opposed to in the patch description (cover letter
>>> or post-"---" blurb)? Is it too obvious to explicitly mention that the
>>> commit message is the first thing we try to make sense of during a 'git
>>> blame' or 'git bisect'?
>>
>> Again, patches welcome ;-)
>
> I think for something that's a stylistic preference I'd see why Emily
> would try to see how you feel about it first.

I do not think there is a need to write down stylistic preference. I may show my preference during my reviews, of course, but I won't take preference-only things as a blocker.

I also do not think things like "'We used to do X here but we do Y because ...' does not belong to in-code comment, but to log message" is "stylistic preference", and if people are unclear about, I agree that we should spell it out.

An example, I can think of offhand, of what should be in comment, whether we also write in the log, is "We do X here because that other code expects us to", when it is tricky to figure out by reading the code by itself without going back to "git blame".

"git blame" certainly can be used to figure out which commit touched the line that does X (which is hard to figure out why), and the log message can refer to "that other code expects us to", but that is an extra operation.

Also, when we really need to figure out, it is wonderful that we can ask "blame" to give us the commit, and can look at "that other code" in the same commit by checking it out to the working tree, especially when "that other code" may have drifted and the original reasoning no longer applies (iow, what we find out from "git blame" may become stale, and it will stay stale forever because we cannot rewrite the history that old).

Now, it is certainly not black/white decision to say what is and what is not tricky to figure out in the code. We shouldn't be commenting obvious things. Two yardsticks I use are

 (1) if reviewers raise questions during a review, it may indicate
     that it is worth commenting.
 (2) if an earlier round of the same series had a bug around the
     area, it may indicate that the fixed code is worth commenting.

but the way I use them is more to say "I found this uncommented code somewhat tricky---but nobody asked a question and it has stayed the same from the initial round, so it may be clear enough for other people, and after all I managed to figure out myself, so it probably is OK to leave it uncommented".

Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 27 of 28 in “[RFC] Contributor doc: more on the proposed log message”
  1. Junio C HamanoJan 23, 2022
  2. brian m. carlsonJan 23, 2022
  3. Kaartic SivaraamJan 26, 2022
  4. 0/3 contributor doc update around log messagesJunio C Hamano, Jan 26, 2022
  5. 1/3 SubmittingPatches: write problem statement in the log in the present tenseJunio C Hamano, Jan 26, 2022
  6. 2/3 CodingGuidelines: hint why we value clearly written log messagesJunio C Hamano, Jan 26, 2022
  7. Eric SunshineJan 27, 2022
  8. Junio C HamanoJan 27, 2022
  9. 3/3 SubmittingPatches: explain why we care about log messagesJunio C Hamano, Jan 26, 2022
  10. 0/3 contributor doc update around log messagesJunio C Hamano, Jan 27, 2022
  11. Emily ShafferMar 4, 2022
  12. 1/3 SubmittingPatches: write problem statement in the log in the present tenseJunio C Hamano, Jan 27, 2022
  13. Emily ShafferMar 3, 2022
  14. Junio C HamanoMar 4, 2022
  15. Emily ShafferMar 4, 2022
  16. 2/3 CodingGuidelines: hint why we value clearly written log messagesJunio C Hamano, Jan 27, 2022
  17. Emily ShafferMar 4, 2022
  18. Junio C HamanoMar 4, 2022
  19. Junio C HamanoApr 14, 2022
  20. Ævar Arnfjörð BjarmasonApr 14, 2022
  21. Emily ShafferApr 19, 2022
  22. Junio C HamanoApr 20, 2022
  23. 3/3 SubmittingPatches: explain why we care about log messagesJunio C Hamano, Jan 27, 2022
  24. Emily ShafferMar 4, 2022
  25. Junio C HamanoMar 4, 2022
  26. log messages > comments (was: [PATCH v3 3/3] SubmittingPatches: explain why we care about log messages)Ævar Arnfjörð Bjarmason, Mar 4, 2022
  27. Junio C HamanoMar 4, 2022
  28. Junio C HamanoMar 4, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.