tag editor layout
Rethink tag editor
I'm think there's room for improvement on the (just released) tagging workflow #1381
The view
The "tag editor" could have two pannel, for tag name and message, the second optional: (similar to how the ": - execute custom command" is shown)
┌─ tag name ───────────────────────────────────────────────────┐
│ some-tag │
└──────────────────────────────────────────────────────────────┘
┌─ message (optional) ─────────────────────────────────────────┐
│ ... │
│ │
│ │
│ │
│ │
└──────────────────────────────────────────────────────────────┘
How it would behave
- pressing
Ton pannel (commit or branch as on #2421), don't need the mid-step menu for selecting lightweight or annotated- typping on tag name box and pressing ⏎, creates a lightweight
- pressing tab on "tag name" box, move cursor to "message" box. Tag with message becomes annotated
- message box could handle multi-line message.
- For this ⏎ add lines, and ctrl+⏎ should be used to "submit"
- Or could have a "submit" button bellow. So you ⥂ from message, and ⏎ on button (not optimal)
Type evaluation flow
I'm not familiar with Go, but here's how i thinks the fields state translate to a "codable steps" on submitting:
Has message?
│ ╭────────────────────────────────────╮
├─ No ──┤ "git tag {{tag_name}} {{branch}}" │
│ ╰────────────────────────────────────╯
│
╰─ Yes ─╮
Is message single line?
│ ╭──────────────────────────────────────────────────────╮
├─ Yes ────┤ "git tag -a {{tag_name}} -m {{message}} {{branch}}" │
│ ╰──────────────────────────────────────────────────────╯
╰─ No ──╮
│ ╭───────────────────────────────────╮
╰──┤ for line in {{message}} : │
│ final_msg += "-m {{line}} " │
│ end │
╰───────────────────────────────────╯
↓ then
╭─────────────────────────────────────────────────────╮
│ `git tag -a {{tag_name}} {{final_msg}} {{branch}}` │
╰─────────────────────────────────────────────────────╯
Alternatives
For the case of those who prefer to open their editor to write (probably highly complex) multi-line tag messages, a cumbersome way that comes to my mind is, if focus on message box, and ctrl+⏎ without writing nothing, open the editor for message (aka: runs "git tag -a {{tag_name}} {{branch}}")
That would make the flow drawn above a bit more complex, and doesn't worth represent here
Wanna hear what you guys think.
offtopic
That's unrelated to editor itself, but i personally thing that tags should get the date of the commit pointing to, what can be achieved setting a VAR_ENV on run command, like so:
GIT_COMMITTER_DATE="$(git show $3 --format=%aD | head -1)"
Whats do you guys thing about setting it by default on tagging over lazygit? If it is not much of a thing for everybody, how am i suppose to enable it for my self only?
The suggested "tag editor" is awfully reminiscent of the new commit message editor, i.e. tab moving the cursor to the description panel.
Nothing else to add, just pointing that out.
Yep, almost exactly the same. Should wait a bit for that to merge, and turn this to "make tags just like commits" then?
And testing this PR on that uffizzi link, i've now think that the ⥂ > ⏎ has quite the same effort of ctrl + ⏎.
Making that point unnecessary too. Although still a valid alternative maybe
Now only the possibility to write message on external editor, if user wants it, is left open. And that would be a good improvement, for tag, commit, and everything else
@mark2185 I thought the exact same thing just now upon reading this issue.
I agree we should use the new commit message panel for this (and all things that have a one mandatory field and one optional multi-line field)
As for bringing up an external editor, that's worth more consideration. I reckon that deserves its own issue
@JonatasAmaral as for GIT_COMMITTER_DATE, I'd prefer to stick to the default behaviour in regular git, but am open to suggestions about how to set that in general (including with commit messages)
This is implemented in https://github.com/jesseduffield/lazygit/pull/2809