]> asedeno.scripts.mit.edu Git - git.git/commitdiff
git-rebase--interactive.sh: Quote arguments to test
authorMichael W. Olson <mwolson@gnu.org>
Mon, 15 Oct 2007 17:48:27 +0000 (13:48 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 16 Oct 2007 04:59:17 +0000 (00:59 -0400)
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>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-rebase--interactive.sh

index df4cedb8594ef795933bb02447d9a96815e2d64b..0dd77b4005b9d80bfe6c606954d7666df77abc57 100755 (executable)
@@ -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)