Skip to content

Commit

Permalink
amend: Add more detail to the reflog action
Browse files Browse the repository at this point in the history
Previously, amend had a customized reflog message, but
it was static and did not have detail on which change was
amended. This made looking through the reflog pretty confusing
if amend was used many times.

Add additional detail to show whether drop/insert was used and
which commit was targeted with the amend. We don't need to
show the new HEAD because this is already in the reflog.
  • Loading branch information
jerry-skydio committed Mar 11, 2024
1 parent d7f409c commit e8d675c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion revup/amend.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,14 @@ async def get_has_unstaged() -> bool:
for stack_entry in stack:
new_commit = await git_ctx.cherry_pick_from_tree(stack_entry, new_commit)

commit_details = '{}: "{}"'.format(
stack[0].commit_id[:8], stack[0].commit_msg.splitlines()[0][:40]
)
reflog_action_str = "revup amend {}{}".format(
"--drop " if args.drop else "--insert " if args.insert else "", commit_details
)
git_env = {
"GIT_REFLOG_ACTION": "reset --soft (revup amend)",
"GIT_REFLOG_ACTION": reflog_action_str,
}
await git_ctx.soft_reset(new_commit, git_env)
return 0

0 comments on commit e8d675c

Please sign in to comment.