From: "Jan Krüger" <jk@jk.gs>
To: Thomas Rast <trast@student.ethz.ch>
Cc: kusmabite@gmail.com, Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: [PATCH v2] rebase -i: more graceful handling of invalid commands
Date: Tue, 27 Oct 2009 15:58:14 +0100 [thread overview]
Message-ID: <20091027155814.0de65db5@perceptron> (raw)
In-Reply-To: <200910271521.09164.trast@student.ethz.ch>
Currently, when there is an invalid command, the rest of the line is
still treated as if the command had been valid, i.e. rebase -i attempts
to produce a patch, using the next argument as a SHA1 name. If there is
no next argument or an invalid one, very confusing error messages
appear (the line was '.'; path to git-rebase-todo substituted):
Unknown command: .
fatal: ambiguous argument 'Please fix this in the file $somefile.':
unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
fatal: Not a valid object name Please fix this in the file $somefile.
fatal: bad revision 'Please fix this in the file $somefile.'
Instead, verify the validity of the remaining line and error out earlier
if necessary.
Signed-off-by: Jan Krüger <jk@jk.gs>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
Thomas Rast wrote:
> I think you need s/sha/sha1/ here?
Of course. For some reason I forgot testing the code path where the
SHA1 is actually valid. Sorry about that.
Dscho's ACK lifted off
<http://article.gmane.org/gmane.comp.version-control.git/131341>.
git-rebase--interactive.sh | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index a1879e3..fdd8eb6 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -416,7 +416,12 @@ do_next () {
;;
*)
warn "Unknown command: $command $sha1 $rest"
- die_with_patch $sha1 "Please fix this in the file $TODO."
+ if git rev-parse --verify -q "$sha1" >/dev/null
+ then
+ die_with_patch $sha1 "Please fix this in the file $TODO."
+ else
+ die "Please fix this in the file $TODO."
+ fi
;;
esac
test -s "$TODO" && return
--
1.6.5.rc1
next prev parent reply other threads:[~2009-10-27 14:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-27 10:13 possible usability issue in rebase -i? Erik Faye-Lund
2009-10-27 12:39 ` [PATCH] rebase -i: more graceful handling of invalid commands Jan Krüger
2009-10-27 14:17 ` Johannes Schindelin
2009-10-27 14:21 ` Thomas Rast
2009-10-27 14:58 ` Jan Krüger [this message]
2009-10-28 7:18 ` [PATCH v2] " Junio C Hamano
2009-10-27 15:17 ` possible usability issue in rebase -i? Baz
2009-10-27 15:50 ` Erik Faye-Lund
2009-10-27 21:05 ` Baz
2009-10-28 12:20 ` Erik Faye-Lund
2009-10-28 14:34 ` Baz
2009-10-28 14:41 ` Erik Faye-Lund
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=20091027155814.0de65db5@perceptron \
--to=jk@jk.gs \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kusmabite@gmail.com \
--cc=trast@student.ethz.ch \
/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).