User Aliases in jj logs
Here’s a quick bit of jj config that streamlines the log lines. I use this for my immediate team, and for dependabot, to make my logs more glancable, while leaving commits from irregular contributors louder:
[template-aliases]
'user_alias(signature)' = '''config('user-aliases."' ++ signature.email() ++ '"')'''
'format_short_signature(signature)' = '''label(
'author',
if (signature.email() == config('user.email').as_string(),
config('user-aliases.me').as_string(),
if (user_alias(signature),
user_alias(signature).as_string(),
signature
)
)
)
'''
[user-aliases]
"me" = "⏺ Andrew"
'foo.bar@example.invalid' = 'Foo'
'…dependabot[bot]@users.noreply.github.com' = '🤖 dependabot'
This overrides format_short_signature which is used by the default log line template. Better factoring of the templates is left as an exercise for the reader.
The me alias is a special case that uses the already configured user.email config setting. This also means that we could commit a repo level config file with common aliases if we wanted to, and my own commits would still be annotated with the bullet.