Skip to content
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

Improve prompts when amending commits #2980

Merged
merged 1 commit into from
Sep 4, 2023
Merged

Conversation

stefanhaller
Copy link
Collaborator

This fixes two minor problems with the prompts:

  1. When pressing shift-A in the local commits view, it would first prompt whether to stage all files, and then it would prompt whether to amend the commit at all. This doesn't make sense, it needs to be the other way round.

  2. When pressing shift-A on the head commit in an interactive rebase, we would ask whether they want to amend the last commit, like when pressing shift-A in the files view. While this is technically correct, the fact that we're amending the head commit in this case is just an implementation detail, and from the user's point of view it's better to use the same prompt as we do for any other commit.

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go run scripts/cheatsheet/main.go generate)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • Docs (specifically docs/Config.md) have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

This fixes two minor problems with the prompts:

1. When pressing shift-A in the local commits view, it would first prompt
   whether to stage all files, and then it would prompt whether to amend the
   commit at all. This doesn't make sense, it needs to be the other way round.

2. When pressing shift-A on the head commit in an interactive rebase, we would
   ask whether they want to amend the last commit, like when pressing shift-A in
   the files view. While this is technically correct, the fact that we're
   amending the head commit in this case is just an implementation detail, and
   from the user's point of view it's better to use the same prompt as we do for
   any other commit.

To fix these, we remove the confirmation panel from AmendHelper.AmendHead() and
instead add it at the two call sites, so that we have more control over this.
Copy link
Owner

@jesseduffield jesseduffield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stefanhaller stefanhaller merged commit e2c447b into master Sep 4, 2023
11 of 12 checks passed
@stefanhaller stefanhaller deleted the better-amend-prompts branch September 4, 2023 07:45
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.

None yet

2 participants