Skip to content

Commit 2858028

Browse files
mwolsonspearce
authored andcommitted
git-rebase--interactive.sh: Quote arguments to test
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 <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent d55e7c3 commit 2858028

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

git-rebase--interactive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pick_one () {
110110
parent_sha1=$(git rev-parse --verify $sha1^) ||
111111
die "Could not get the parent of $sha1"
112112
current_sha1=$(git rev-parse --verify HEAD)
113-
if test $no_ff$current_sha1 = $parent_sha1; then
113+
if test "$no_ff$current_sha1" = "$parent_sha1"; then
114114
output git reset --hard $sha1
115115
test "a$1" = a-n && output git reset --soft $current_sha1
116116
sha1=$(git rev-parse --short $sha1)

0 commit comments

Comments
 (0)