Skip to content

feat: Implement jj-configured branch names#142

Open
ilyapoz wants to merge 2 commits into
jennings:mainfrom
ilyapoz:ilyapoz/feat-implement-jj-configured-branch-names-yvpxz
Open

feat: Implement jj-configured branch names#142
ilyapoz wants to merge 2 commits into
jennings:mainfrom
ilyapoz:ilyapoz/feat-implement-jj-configured-branch-names-yvpxz

Conversation

@ilyapoz

@ilyapoz ilyapoz commented May 24, 2026

Copy link
Copy Markdown

I want to use the same branch names that would be created if I used jj git push -c <>.

In this PR I introduce spr.useJjBookmarkNames config option that would allow to turn this behavior on.

It works by running jj log ... -T and using the string as the branch name.

ilyapoz added 2 commits May 25, 2026 02:31
Rationale: putting such functions into config is questionable in
general.

In particular, I would like to make them depend on Jujutsu and it feels
weird to depend on this struct from config. I just make these free
standing functions and put them into the only module that uses them.
I want to use the same branch names that would be created if I used `jj
git push -c <>`.

In this PR I introduce spr.useJjBookmarkNames config option that would
allow to turn this behavior on.

It works by running `jj log ... -T` and using the string as the branch
name.
@jennings

Copy link
Copy Markdown
Owner

May I ask how this improves your workflow? If anything, I would think the readable branch names would be better.

@ilyapoz

ilyapoz commented May 25, 2026

Copy link
Copy Markdown
Author

@jennings I do have readable branch names configured in jj:

[templates]
git_push_bookmark = "git_push_bookmark_template"

[template-aliases]
subject = 'description.first_line()'
ticket = 'subject.match(regex:"^[A-Z][A-Z0-9_]*-[0-9]+: ").remove_suffix(": ")'
'remove_ticket(subject)' = 'subject.replace(regex:"^[A-Z][A-Z0-9_]*-[0-9]+:\\s*", "")'
'slugify(str)' = 'str.lower().replace(regex:"[^a-z0-9]+", "-").remove_prefix("-").remove_suffix("-")'

git_push_bookmark_template= '''
committer.email().local() ++ "/" ++
if(description,
  surround("", "/", ticket) ++
  slugify(remove_ticket(subject))
)
'''

posted about it on discord: https://discord.com/channels/968932220549103686/1503725496544792678/1504593218543681637

also, other people posted before. templates.git_push_bookmark

So this is a case for consistency.

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.

2 participants