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

amend: Force editing if inserting instead of throwing error #120

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/amend.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ use the old commit message as-is.
**--insert, -i**
: Instead of amending the given commit, insert the changes in cache
as a new commit after the given commit. If there are no changes in
cache, this inserts an empty commit. Cannot be used with --no-edit,
since the new commit requires a commit message.
cache, this inserts an empty commit. Implies --edit, since the new commit
requires a commit message.

**--drop, -d**
: Instead of amending the given commit, drop it and leave any changes
Expand Down
3 changes: 1 addition & 2 deletions revup/amend.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,10 @@ async def get_has_unstaged() -> bool:
get_has_unstaged(),
)

args.edit = args.edit or args.insert
has_diff = has_staged or has_unstaged or args.drop
if not has_diff and not args.edit:
return 0
if args.insert and not args.edit:
raise RevupUsageException("Can't skip wording an inserted commit!")

if args.drop and args.insert:
raise RevupUsageException("Doesn't make sense to drop and insert")
Expand Down