git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael W. Olson" <mwolson@gnu.org>
To: git@vger.kernel.org
Subject: [PATCH] git-rebase--interactive.sh: Quote arguments to test
Date: Mon, 15 Oct 2007 13:48:27 -0400	[thread overview]
Message-ID: <87odf0clqs.fsf@hariken.mwolson.org> (raw)

If /bin/sh is /bin/dash, then the script will display an error if
$parent_sha1 is undefined.  This patch works fixes the issue by
quoting both arguments to `test'.  Arguments composed solely of
variable expansions should always be quoted, unless we know for
certain that the contents are defined.

Signed-off-by: Michael W. Olson <mwolson@gnu.org>
---

Resending, this time directly to the mailing list instead of via Gmane.

 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 050140d..8a03062 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -110,7 +110,7 @@ pick_one () {
 	parent_sha1=$(git rev-parse --verify $sha1^) ||
 		die "Could not get the parent of $sha1"
 	current_sha1=$(git rev-parse --verify HEAD)
-	if test $no_ff$current_sha1 = $parent_sha1; then
+	if test "$no_ff$current_sha1" = "$parent_sha1"; then
 		output git reset --hard $sha1
 		test "a$1" = a-n && output git reset --soft $current_sha1
 		sha1=$(git rev-parse --short $sha1)
-- 
1.5.3.4

                 reply	other threads:[~2007-10-15 18:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87odf0clqs.fsf@hariken.mwolson.org \
    --to=mwolson@gnu.org \
    --cc=git@vger.kernel.org \
    /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).