Hi Jon, On Wed, 14 Dec 2022, Jon Turney wrote:
> On 11/12/2022 14:45, Johannes Schindelin wrote: > > On December 11, 2022 2:54:02 PM GMT+01:00, Jon Turney > > <jon.tur...@dronecode.org.uk> wrote: > > > On 05/12/2022 15:23, Johannes Schindelin wrote: > > > > On Mon, 28 Nov 2022, Corinna Vinschen wrote: > > > > > On Nov 28 13:00, Jon Turney wrote: > > > > > > On 15/11/2022 10:46, Corinna Vinschen wrote: > > > > > > > > > > > > > > It would be great if we could get used to using the same syntax as > > > > > > > the > > > > > > > Linux kernel project to document stuff. I'm trying to follow > > > > > > > their lead > > > > > > > for a while. For fixes to former commits, it looks like this in > > > > > > > the > > > > > > > kernel, at the end of the commit message: > > > > > > > > > > > > > > Fixes: 123456789012 ("title of commit 123456789012") > > > > > > > > > > > > > > Yeah, core.abbrev is 12 digits. I'm using this setting for quite > > > > > > > some > > > > > > > time locally. > > > > > > > > > > > > Sounds good. Is there some script to automate generating this kind > > > > > > of > > > > > > comment from a commit-id? > > > > > > > > > > I don't think so, at least I don't see anything like that in git > > > > > docs... > > > > > > > > It's note _quite_ what you asked for, but `git show --pretty=reference > > > > -s > > > > <commit>` (https://git-scm.com/docs/git-show#_pretty_formats) gives you > > > > _almost_ what you are looking for. > > > > > > > > But you can always call `git show -s --format='%h ("%s")' <commit>`, and > > > > even configure an alias for this: > > > > > > > > git config --global alias.pretty-print-commit \ > > > > "-c core.abbrev=12 show -s --format='%h (\"%s\")'" > > > > > > > Thanks! > > > > > > I added '-c core.pager=', but this is what I was looking for, to save a > > > bit of copying and pasting and editing. > > > > > > > Better use `git -P`, then... (see > > https://git-scm.com/docs/git#Documentation/git.txt--P for full details) > > > > I started off with that, but that fails when used with: > > fatal: alias 'pretty-print-commit' changes environment variables. > You can use '!git' in the alias to do this > > ... which I'm sure tells me the right way to write this :) My apologies for leading you on this windy path through Git's obscure and intricate internals. The problem is that the `-P` option claims to change the environment (see https://github.com/git/git/blob/v2.40.0/git.c#L176-L179), and aliases are not allowed to do that. You _can_ work around that by using `!git -P [...]`, i.e. by forcing a shell to be spawned that then spawns `git`. But that is wasteful, especially given the performance characteristics of spawning processes in Cygwin. Therefore, your `-c core.pager=` solution is much preferable to my suggestion to use `-P`. Ciao, Johannes