[PATCH 2/2] rebase -i: interrupt rebase when "commit --amend" failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"commit --amend" could fail if the user empties the commit message.
Although this is not a real error, it seems to make more sense to
interrupt the rebasing, rather than ignoring the error and continue on
rebasing.  This gives users a way to gracefully interrupt a "reword" if
they decided they actually want to do an "edit", or even "rebase
--abort".

Signed-off-by: Andrew Wong <andrew.kw.w@xxxxxxxxx>
---
 git-rebase--interactive.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index df9f7e9..7055ef4 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -397,7 +397,8 @@ do_next () {
 		mark_action_done
 		pick_one $sha1 ||
 			die_with_patch $sha1 "Could not apply $sha1... $rest"
-		git commit $commit_verbose_flag --amend --no-post-rewrite
+		git commit $commit_verbose_flag --amend --no-post-rewrite ||
+			die_with_patch $sha1 "Cannot amend commit after successfully picking $sha1... $rest"
 		record_in_rewritten $sha1
 		;;
 	edit|e)
-- 
1.7.2.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]