{"thread":{"id":"60691","subject":"Bug: git log with log.showSignature enabled","startedAt":"2024-01-06T16:57:06Z","lastAt":"2024-01-06T18:31:00Z","messageCount":2,"participants":["Maxim Iorsh","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"486364","messageId":"CADQ_TR56X_iMitPEiaOyR_h=1dp9ThUQMu_Vqjest1i8xbh9Tw@mail.gmail.com","threadId":"60691","inReplyTo":null,"subject":"Bug: git log with log.showSignature enabled","fromName":"Maxim Iorsh","fromEmail":"iorsh@users.sourceforge.net","sentAt":"2024-01-06T16:56:29Z","receivedAt":"2024-01-06T16:57:06Z","isPatch":false,"sender":{"key":"iorsh@users.sourceforge.net","avatar":null},"body":"Thank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\niorsh-linux:~/devel/fontforge/build> git log -n 1 --oneline\n2aa98f6a5 (HEAD -> master) Dummy signed commit\niorsh-linux:~/devel/fontforge/build> git config log.showSignature true\niorsh-linux:~/devel/fontforge/build> git log -n 1 --oneline\n2aa98f6a5 (HEAD -> master) gpg: Signature made 17:47:50 2024 ינו 06 ש' IST\ngpg:                using RSA key XXXXXXXXXX\ngpg:                issuer \"iorsh@users.sourceforge.net\"\ngpg: Good signature from \"Maxim Iorsh <iorsh@users.sourceforge.net>\" [ultimate]\nDummy signed commit\n\nWhat did you expect to happen? (Expected behavior)\n\nWhen asked for oneliner or any specific format, `git log` shouldn't\nshow signature event when configured.\n\nWhat happened instead? (Actual behavior)\n\n`git log` always show signatures with log.showSignature enabled, even\nfor explicit formatting requests.\n\nWhat's different between what you expected and what actually happened?\n\nAnything else you want to add:\n\nThis behavior obviously breaks any script which relies on git log to\nproduce preformatted info about commits. It's also quite rare, becaus\ne probably very few users set log.showSignature config option.\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.34.1\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC\n2023 x86_64\ncompiler info: gnuc: 11.4\nlibc info: glibc: 2.35\n$SHELL (typically, interactive shell): /bin/tcsh\n\n\n[Enabled Hooks]\n"},{"id":"486365","messageId":"ZZmaQ0RoxJpU2PSH@tapette.crustytoothpaste.net","threadId":"60691","inReplyTo":"CADQ_TR56X_iMitPEiaOyR_h=1dp9ThUQMu_Vqjest1i8xbh9Tw@mail.gmail.com","subject":"Re: Bug: git log with log.showSignature enabled","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2024-01-06T18:21:55Z","receivedAt":"2024-01-06T18:31:00Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2024-01-06 at 16:56:29, Maxim Iorsh wrote:\n> Thank you for filling out a Git bug report!\n> Please answer the following questions to help us understand your issue.\n> \n> What did you do before the bug happened? (Steps to reproduce your issue)\n> \n> iorsh-linux:~/devel/fontforge/build> git log -n 1 --oneline\n> 2aa98f6a5 (HEAD -> master) Dummy signed commit\n> iorsh-linux:~/devel/fontforge/build> git config log.showSignature true\n> iorsh-linux:~/devel/fontforge/build> git log -n 1 --oneline\n> 2aa98f6a5 (HEAD -> master) gpg: Signature made 17:47:50 2024 ינו 06 ש' IST\n> gpg:                using RSA key XXXXXXXXXX\n> gpg:                issuer \"iorsh@users.sourceforge.net\"\n> gpg: Good signature from \"Maxim Iorsh <iorsh@users.sourceforge.net>\" [ultimate]\n> Dummy signed commit\n> \n> What did you expect to happen? (Expected behavior)\n> \n> When asked for oneliner or any specific format, `git log` shouldn't\n> show signature event when configured.\n> \n> What happened instead? (Actual behavior)\n> \n> `git log` always show signatures with log.showSignature enabled, even\n> for explicit formatting requests.\n> \n> What's different between what you expected and what actually happened?\n> \n> Anything else you want to add:\n> \n> This behavior obviously breaks any script which relies on git log to\n> produce preformatted info about commits. It's also quite rare, becaus\n> e probably very few users set log.showSignature config option.\n\nI think this is behaving as designed.  git log is a porcelain command,\nwhich means it's designed for the user to use, but is not intended for\nscripting.  The documentation for `log.showSignature` says this:\n\n  If true, makes git-log(1), git-show(1), and git-whatchanged(1) assume --show-signature.\n\nAs long as the output is what you would have gotten if you manually\nadded --show-signature, the result is correct.\n\nHowever, if you want to script things, you can use git rev-list, which\nis a plumbing command that's specifically designed to allow scripting.\nIt works very similarly to git log, but doesn't have configuration\noptions that change its behaviour, so it doesn't suffer from this\nproblem.\n\nFor example, on one of my branches, I get this:\n\n$ git rev-list -n 1 --oneline HEAD\n404bf1f83a credential: add an argument to keep state\n\nNote that the implicit HEAD of git log doesn't work with git rev-list,\nso you need to specify HEAD explicitly.\n-- \nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"}]}