Skip to content

Conversation

stepheneb
Copy link
Contributor

This is based on nanotech's patch here -- however using the --gpg-sign arg now seems to work.
#32 (comment)

This is not a complete pull request because adding the arg for gpg signing
should only happen if one or maybe ALL of the following are true:

  • A "GPG Sign" GitX preference is set to true
  • A git [commit] setting in either a local or global .gitconfig includes: gpgsign = true
  • The directory ~/gnupg exists

The commit in this pull request created with my local build of GitX with this branch on an M1 Pro Mac is signed -- so it seems to work.

image

This is based on nanotech's patch here -- however using the '--gpg-sign' arg now seems to work.
gitx#32 (comment)

This is not a complete pull request because adding the arg for gpg signing
should only happen if one or maybe ALL of the following are true:

- A "GPG Sign" GitX preference is set to true
- A git [commit] setting in either a local or global .gitconfig includes: gpgsign = true
- The directory ~/gnupg exists
stepheneb added a commit to stepheneb/dotfiles that referenced this pull request Aug 12, 2022
@hannesa2
Copy link
Contributor

close #32

@hannesa2 hannesa2 merged commit cf4280b into gitx:master Aug 14, 2022
@hannesa2
Copy link
Contributor

@stepheneb Should I create a new release with this ?

@stepheneb
Copy link
Contributor Author

stepheneb commented Aug 15, 2022

@stepheneb Should I create a new release with this ?

I don't think so. I think at the very least it needs a new item in the Preferences pane for enabling or disabling a boolean GPG Sign. Right now it will always try to sign the commit. I haven't tested what happens when a GPG setup is not enabled but I think it's likely it will be an issue.

I started looking at adding this but got slowed down because I haven't really worked with Cocoa before and wasn't sure if I could just replicate similar code and extend the nib or if I needed to use xcode gui tools to wire up outlets.

I also think generating this boolean might be desirable gitConfigGPGSign: true if a git [commit] setting in either a local or global .gitconfig includes: gpgsign = true.

If false then the GPG Sign preference should be disabled and perhaps add a note indicating that gpgsign = true needs to be added to .gitconfig.

Curious what you think?

@tiennou
Copy link
Contributor

tiennou commented Aug 25, 2022

Yeah, I'm getting an error when committing/amending because of that:

-[PBGitIndex commitWithMessage:andVerify:]: Error Domain=PBTaskErrorDomain Code=4 "Task exited unsuccessfully" UserInfo={NSLocalizedFailureReason=The task "/usr/local/bin/git --git-dir=/Users/tiennou/Projects/gitx/.git commit-tree 4496934a2b57533e486c81029177d126df0b8c1c -p HEAD^ --gpg-sign" returned a non-zero return code, PBTaskTerminationStatusKey=1, PBTaskTerminationOutputKey=error: cannot run gpg: No such file or directory
error: gpg n'a pas pu signer les données
, NSLocalizedDescription=Task exited unsuccessfully}

and the report from GitX doesn't make it obvious its from GPG signing ("Could not create a commit object").

I've got no error running that command manually in Terminal, or via git commit.

I'm setup to sign some repos but not all of them, and gitx isn't one of those, which makes me wonder if it's failing because my gpg is in /usr/local/bin and that's not in $PATH.

There's also user.signingkey that might be useful to know if we should sign or not, but I guess that's part of what --gpg-sign handles by itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants