Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit 2b2e7e0

Browse files
committed
fix: Retry gets correct last constructed message
The retry command was using the very first saved commit message. This has been fixed so that it uses the most recently saved commit message.
1 parent b240bb1 commit 2b2e7e0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gitcommit/gitcommit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,9 @@ def run(args):
425425
if len(args) > 0 and args[0] == "retry":
426426
args = args[1:] # consume the "retry" first arg
427427
cm_histories_iter = commit_msg_history.load_history_strings()
428-
last_commit_msg = ""
429-
for last_commit_msg in cm_histories_iter:
430-
pass
428+
last_commit_msg = next(cm_histories_iter, "")
429+
if last_commit_msg == "":
430+
Ansi.print_error("Could not find a previous commit message")
431431
commit_msg = last_commit_msg
432432

433433
if commit_msg == "":
@@ -493,7 +493,7 @@ def run(args):
493493

494494
def main():
495495
try:
496-
print(sys.argv)
496+
# print(sys.argv)
497497
run(sys.argv[1:])
498498
except KeyboardInterrupt:
499499
print("\nAborted.")

0 commit comments

Comments
 (0)