-
Notifications
You must be signed in to change notification settings - Fork 349
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
FR: git commit --verbose
equivalent for jj describe
#1946
Comments
jj describe --verbose
git commit --verbose
equivalent for jj describe
This could apply to quite a few commands ( |
Maybe we can have a configurable template for producing that. We currently include something like this:
Maybe that could be replaced by a template like We don't yet have support for including a diff in templates, so we'd need to implement that first. #1354 is slightly related. |
I went looking for this feature, remembered |
Looking for consensus before implementing this:
|
I think config knob is better. It was discussed previously in
Template is preferred because it can solve other problems (such as #1354 and #3385), but it's not easy. I think adding a diff formatting option is also good as a short-term workaround.
Yeah. Perhaps, the default
and |
This implements a building block of "signed-off-by line" jj-vcs#1399 and "commit --verbose" jj-vcs#1946. We'll probably need an easy way to customize the diff part, but I'm not sure if it can be as simple as a template alias function. User might want to embed diffs without "JJ: " prefixes? Perhaps, we can deprecate "ui.default-description", but it's not addressed in this patch. It could be replaced with "default_description" template alias, but we might want to configure default per command. Suppose we add a default "backout_description" template, it would have to be rendered against the source commit, not the newly-created backout commit. The template key is named as "draft_commit_description" because it is the template to generate an editor template. "templates.commit_description_template" sounds a bit odd. There's one minor behavior change: the default description is now terminated by "\n". Closes jj-vcs#1354
This implements a building block of "signed-off-by line" #1399 and "commit --verbose" #1946. We'll probably need an easy way to customize the diff part, but I'm not sure if it can be as simple as a template alias function. User might want to embed diffs without "JJ: " prefixes? Perhaps, we can deprecate "ui.default-description", but it's not addressed in this patch. It could be replaced with "default_description" template alias, but we might want to configure default per command. Suppose we add a default "backout_description" template, it would have to be rendered against the source commit, not the newly-created backout commit. The template key is named as "draft_commit_description" because it is the template to generate an editor template. "templates.commit_description_template" sounds a bit odd. There's one minor behavior change: the default description is now terminated by "\n". Closes #1354
For those who stumble upon this; the nearest equivalent (since #4153) is to add something like this to your config file:
or if you don't want it all the time add an alias using
The most notable deficiency is that you don't get diff highlighting in your text editor like you would with a git commit diff because of the prefixed Edited to fix |
Important note - you almost certainly don't want |
Since #5155, you can now do something like: [template-aliases]
commit_description_verbose = '''
concat(
description,
"\n",
"JJ: This commit contains the following changes:\n",
indent("JJ: ", diff.stat(72)),
"JJ: ignore-rest\n",
diff.git(),
)
'''
[aliases]
dv = ["--config=templates.draft_commit_description=commit_description_verbose", "describe"] |
Thanks. I think we can now close this issue? |
Often when writing a commit message, it's useful to be able to see the diff at a glance. Git has
git commit --verbose
, which displays the diff inline in your editor while you're writing the message. This saves having to try to remember what changes you made.I personally use this all the time. I have
which I use for committing almost exclusively.
It would be cool if
jj
supported this as well! I'm not wedded to the name--verbose
, which I think could be clearer (and in fact looking at the help it conflicts with an existing flag with different functionality). Maybe--show-diff
?The text was updated successfully, but these errors were encountered: