[PATCH] rebase -i: fix has_action

Subsystems: the rest

STALE3716d

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] rebase -i: fix has_action

From: Noe Rubinstein <hidden>
Date: 2016-06-15 22:51:44

When doing git rebase -i, removing all actions in the todo list is
supposed to result in aborting the rebase. However, if there are spaces
at the beginning of an empty line, has_action returns true and the
rebase therefore removes all commits. This is probably not what a user
leaving a space on an empty line expects.

This patch fixes the bug by changing has_action to grep any line
containing anything that is not a space nor a #.

Signed-off-by: Noe Rubinstein <redacted>
---
 git-rebase--interactive.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index c6ba7c1..bed79af 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -149,7 +149,7 @@ die_abort () {
 }
 
 has_action () {
-	sane_grep '^[^#]' "$1" >/dev/null
+	sane_grep '^[^#[:space:]]' "$1" >/dev/null
 }
 
 # Run command with GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and
-- 
Noé Rubinstein
Avencall - XiVO IPBX OpenHardware
10 bis, rue Lucien VOILIN - 92800 Puteaux
Tél. : +33 (0)1 41 38 99 60 ext 123
Fax. : +33 (0)1 41 38 99 70

Re: [PATCH] rebase -i: fix has_action

From: Sverre Rabbelier <hidden>
Date: 2016-06-15 22:51:45

Heya,

On Thu, Aug 4, 2011 at 11:39, Noe Rubinstein
[off-list ref] wrote:
This patch fixes the bug by changing has_action to grep any line
containing anything that is not a space nor a #.
Probably maint-worthy? Should this have a test too?

-- 
Cheers,

Sverre Rabbelier
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help