Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement jj sign and jj unsign commands #4747

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

pylbrecht
Copy link
Contributor

@pylbrecht pylbrecht commented Nov 1, 2024

Closes #4712

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@julienvincent julienvincent mentioned this pull request Jan 2, 2025
7 tasks
@pylbrecht pylbrecht force-pushed the pylbrecht/push-tokrxypvsmqw branch 5 times, most recently from 517e230 to 45be04d Compare January 4, 2025 13:14
@pylbrecht pylbrecht force-pushed the pylbrecht/push-tokrxypvsmqw branch 9 times, most recently from 6b049ab to 2c49a16 Compare January 5, 2025 11:31
@pylbrecht
Copy link
Contributor Author

pylbrecht commented Jan 6, 2025

This is still WIP, but I would love to get some feedback on the general approach and if this has any design flaws that I need to address before polishing.
@yuja, @necauqua, since you have been involved in my last PR, maybe you have some suggestions?
(Of course anyone else is also welcome to leave feedback!)

// edit

Some things, which have been discussed in jj sign related issues/PRs, are still missing: showing hints if signatures have been dropped during a rebase, or builtin template(s) for displaying signatures.
I don't know if we want to make them part of this PR or address them separately.

Copy link
Contributor

@necauqua necauqua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually left a couple of comments.

Dropped signatures hint and builtin templates can be separate PRs, yes.

Will reiterate my idea for the templates here:

There should be a some_consistent_name_for_crypt_sig template that's used in the default log template and by default it's empty.
Then there should be some_other_name template that's unused, but is present by default, with my pretty checkmarks or whatever.
And then in FAQ or in docs, there should be a tip "you can run this jj config command to set that first template to equal that second one so that you'll get checkmarks in all the default templates".

"Or you can set that template to if(signature, "[•]", "") to just differentiate signed commits from unsigned in the logs, which is very fast compared to actually verifying them"

Another thing that could be in some tips and tricks section, is an alias for jj log that has --config= set that template thing to show signatures temporarily.

Also for the builtin_log_detailed there was a change somewhere that showed a Signature: extra line - maybe do the same thing with empty default one + unused verifying one?. Or have the detailed log always verify. Maybe Yuja has an opinion there

@pylbrecht
Copy link
Contributor Author

pylbrecht commented Jan 6, 2025

Wow, thanks a lot for your feedback, @necauqua and @martinvonz!
This helps a lot. Being new to the codebase (and the VCS domain), I struggle with what is expected a fair bit. It's great to receive some guidance here.

Now I am all set to return to my dungeon and work on the how.

// edit
Also, still wrapping my head around Rust, so.. please bear with me. 😅

@necauqua
Copy link
Contributor

necauqua commented Jan 6, 2025

Very offtopic, sorry, but there's no chance in hell I'd have contributed to jj if is was cpp or something.
Even if it was C (that I don't dislike per se) every single project has it's own very specific patterns etc. and the build systems are plentiful.
Here in Rust we have cargo that just works, we have rustfmt, and we have the borrowchecker to not be scared of your code, and to not learn again how the particular project handles memory.

@pylbrecht
Copy link
Contributor Author

Thanks @yuja!

@pylbrecht pylbrecht force-pushed the pylbrecht/push-tokrxypvsmqw branch 7 times, most recently from 57f73d5 to 69f4222 Compare February 23, 2025 09:26
@pylbrecht pylbrecht requested a review from yuja February 23, 2025 10:08
@pylbrecht pylbrecht force-pushed the pylbrecht/push-tokrxypvsmqw branch 5 times, most recently from 180472f to 1c151ed Compare February 24, 2025 13:08
@pylbrecht pylbrecht requested a review from yuja February 24, 2025 13:34
necauqua and others added 2 commits February 25, 2025 07:05
We always sign commits. This means commits, which are already signed,
will be resigned. While this is cumbersome for people using hardware
devices for signatures, we cannot reliably check if a commit is already
signed at the moment (see jj-vcs#5786).

We output warnings when signing commits, which are not authored by the
user. This is encouraging to use `jj undo`, in case one unintentionally
signs commits of others.

The output of `jj sign` is based on that of `jj abandon`.

---

Co-authored-by: julienvincent <m@julienvincent.io>
Co-authored-by: necauqua <him@necauq.ua>
The output of `jj unsign` is based on that of `jj abandon`.

We output warnings when unsigning commits, which are not authored by the
user. This is encouraging to use `jj undo`, in case one unintentionally
drops signatures of others.

---

Co-authored-by: julienvincent <m@julienvincent.io>
Co-authored-by: necauqua <him@necauq.ua>
@pylbrecht pylbrecht force-pushed the pylbrecht/push-tokrxypvsmqw branch from 1c151ed to 9fc7b2d Compare February 25, 2025 06:08
@pylbrecht pylbrecht added this pull request to the merge queue Feb 25, 2025
Merged via the queue into jj-vcs:main with commit f7ceac3 Feb 25, 2025
24 checks passed
@pylbrecht pylbrecht deleted the pylbrecht/push-tokrxypvsmqw branch February 25, 2025 13:52
pylbrecht added a commit to pylbrecht/jj that referenced this pull request Feb 27, 2025
pylbrecht added a commit to pylbrecht/jj that referenced this pull request Feb 27, 2025
@pylbrecht pylbrecht mentioned this pull request Feb 27, 2025
4 tasks
pylbrecht added a commit to pylbrecht/jj that referenced this pull request Feb 28, 2025
pylbrecht added a commit to pylbrecht/jj that referenced this pull request Feb 28, 2025
github-merge-queue bot pushed a commit that referenced this pull request Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: Add a command for signing commits (when signing.sign-all = false)
5 participants