{"type":"rich","version":"1.0","author_name":"npub1vlgx34nzzqzrqq0uujch65yyzyknuduuqulj24ydlnarhwdhwzlsx69gsv","author_url":"https://nostr.ae/npub1vlgx34nzzqzrqq0uujch65yyzyknuduuqulj24ydlnarhwdhwzlsx69gsv","provider_name":"njump","provider_url":"https://nostr.ae","html":"📅 Original date posted:2014-05-21\n📝 Original message:On May 21, 2014, at 10:25 PM, David A. Harding \u003cdave at dtrt.org\u003e wrote:\n\n\u003e On Wed, May 21, 2014 at 06:39:44PM +0200, Chris Beams wrote:\n\u003e\u003e I [was] searching for a way to enable signing by default [...]\n\u003e\u003e Unfortunately, there isn't one, meaning it's likely that most folks\n\u003e\u003e will forget to do this most of the time.\n\u003e \n\u003e For all of my projects, I now I put this script in\n\u003e .git/hooks/post-commit and post-merge:\n\u003e \n\u003e    #!/bin/bash -eu\n\u003e \n\u003e    if ! git log -n1 --show-signature | grep -q 'gpg: Good signature'\n\u003e    then\n\u003e        yes \"FORGOT TO SIGN COMMIT MESSAGE\"\n\u003e        exit 1\n\u003e    fi\n\nFunny, I was just in the middle of writing a pre-push hook to do something similar when I decided to check my email :) Your post-commit approach is indeed simpler, so I've gone with it for the moment [1]. Thanks.\n\nHowever, I noticed in the process of testing that this approach messes with rebase workflows. For example: if I make several commits (all of which are properly signed), and then rebase to reorder them, rebase ends up hanging because it delegates to `commit` and the use of `yes` in the post-commit hook blocks forever. I've changed `yes` to `echo` to avoid this, but it still means that one must be rather diligent to keep signatures in place when rebasing. Gerwitz does address rebasing in the presence of commit sigs in the \"horror story\" doc you linked to [2], but there's no magic: this makes the whole rebasing process considerably more tedious, and linearly so with however many commits you're modifying.\n\nThis may amount to a rationale for going with a pre-push hook after all, i.e. in order to defer the check for signatures until the last possible moment. This would allow for cheap iterative rebasing once again.\n\nI suppose the proper solution would be a `git config` option such as 'commit.sign', that if set to true would mean your commits are always signed, even if rebase is the one calling `commit`. This would obviate the need for the alias I mention below as well.\n\n\n\u003e So anytime I forget to sign, I get an obvious error and can immediately\n\u003e run git commit --amend -S.\n\nIf one is already in the habit of using an alias for `commit` (I've long used `ci` for concision), the -S can be included in the alias:\n\n    git config alias.ci 'commit -S'\n\n\n\u003e To automatically add a script like the one above to all new projects (plus\n\u003e quickly add it old current projects), you can follow these instructions:\n\u003e \n\u003e    http://stackoverflow.com/questions/2293498/git-commit-hooks-global-settings\n\nThis was a great tip, thanks!\n\n- Chris\n\n[1]: https://github.com/cbeams/dotfiles/commit/58d6942\n[2]: http://mikegerwitz.com/papers/git-horror-story.html#_option_3\n-------------- next part --------------\nAn HTML attachment was scrubbed...\nURL: \u003chttp://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20140522/16681d8b/attachment.html\u003e\n-------------- next part --------------\nA non-text attachment was scrubbed...\nName: signature.asc\nType: application/pgp-signature\nSize: 842 bytes\nDesc: Message signed with OpenPGP using GPGMail\nURL: \u003chttp://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20140522/16681d8b/attachment.sig\u003e"}
