git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Noe Rubinstein <nrubinstein@proformatique.com>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Noe Rubinstein <nrubinstein@proformatique.com>
Subject: [PATCH] rebase -i: fix has_action
Date: Thu,  4 Aug 2011 11:39:40 +0200	[thread overview]
Message-ID: <1312450780-5021-1-git-send-email-nrubinstein@proformatique.com> (raw)

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

             reply	other threads:[~2011-08-04  9:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04  9:39 Noe Rubinstein [this message]
2011-08-04 12:15 ` [PATCH] rebase -i: fix has_action 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312450780-5021-1-git-send-email-nrubinstein@proformatique.com \
    --to=nrubinstein@proformatique.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).