git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rebase -i: fix has_action
@ 2011-08-04  9:39 Noe Rubinstein
  2011-08-04 12:15 ` Sverre Rabbelier
  2011-08-04 19:34 ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: Noe Rubinstein @ 2011-08-04  9:39 UTC (permalink / raw)
  To: git, gitster; +Cc: Noe Rubinstein

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 <nrubinstein@proformatique.com>
---
 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-08-05 17:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-04  9:39 [PATCH] rebase -i: fix has_action Noe Rubinstein
2011-08-04 12:15 ` Sverre Rabbelier
2011-08-04 19:34 ` Junio C Hamano
2011-08-05 12:36   ` Sverre Rabbelier
2011-08-05 12:46     ` Johannes Sixt
2011-08-05 16:59     ` Junio C Hamano
2011-08-05 14:17   ` Andrew Wong
2011-08-05 17:01     ` Junio C Hamano
2011-08-05 14:47   ` What you can throw (on a Friday) Steffen Daode Nurpmeso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).