From 1346a81e4d51352ac63530379a33baf6523dfaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Sun, 23 Jun 2024 10:41:48 -0700 Subject: [PATCH] test_e2e.sh: Quote the rhs of != in [[ ]] to prevent glob matching Fixes SC2053. Part of #891. --- test_e2e.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test_e2e.sh b/test_e2e.sh index 76a1232..938557e 100755 --- a/test_e2e.sh +++ b/test_e2e.sh @@ -1658,7 +1658,7 @@ function e2e::sync_depth_across_updates() { assert_metric_eq "${METRIC_GOOD_SYNC_COUNT}" 1 assert_metric_eq "${METRIC_FETCH_COUNT}" 1 depth=$(git -C "$ROOT/link" rev-list HEAD | wc -l) - if [[ $expected_depth != $depth ]]; then + if [[ $expected_depth != "$depth" ]]; then fail "initial: expected depth $expected_depth, got $depth" fi @@ -1672,7 +1672,7 @@ function e2e::sync_depth_across_updates() { assert_metric_eq "${METRIC_GOOD_SYNC_COUNT}" 2 assert_metric_eq "${METRIC_FETCH_COUNT}" 2 depth=$(git -C "$ROOT/link" rev-list HEAD | wc -l) - if [[ $expected_depth != $depth ]]; then + if [[ $expected_depth != "$depth" ]]; then fail "forward: expected depth $expected_depth, got $depth" fi @@ -1685,7 +1685,7 @@ function e2e::sync_depth_across_updates() { assert_metric_eq "${METRIC_GOOD_SYNC_COUNT}" 3 assert_metric_eq "${METRIC_FETCH_COUNT}" 3 depth=$(git -C "$ROOT/link" rev-list HEAD | wc -l) - if [[ $expected_depth != $depth ]]; then + if [[ $expected_depth != "$depth" ]]; then fail "backward: expected depth $expected_depth, got $depth" fi } @@ -2726,11 +2726,11 @@ function e2e::submodule_sync_depth() { assert_file_eq "$ROOT/link/$SUBMODULE_REPO_NAME/submodule.file" "${FUNCNAME[0]} 1" assert_metric_eq "${METRIC_GOOD_SYNC_COUNT}" 1 depth=$(git -C "$ROOT/link" rev-list HEAD | wc -l) - if [[ $expected_depth != $depth ]]; then + if [[ $expected_depth != "$depth" ]]; then fail "initial depth mismatch expected=$expected_depth actual=$depth" fi submodule_depth=$(git -C "$ROOT/link/$SUBMODULE_REPO_NAME" rev-list HEAD | wc -l) - if [[ $expected_depth != $submodule_depth ]]; then + if [[ $expected_depth != "$submodule_depth" ]]; then fail "initial submodule depth mismatch expected=$expected_depth actual=$submodule_depth" fi @@ -2745,11 +2745,11 @@ function e2e::submodule_sync_depth() { assert_file_eq "$ROOT/link/$SUBMODULE_REPO_NAME/submodule.file" "${FUNCNAME[0]} 2" assert_metric_eq "${METRIC_GOOD_SYNC_COUNT}" 2 depth=$(git -C "$ROOT/link" rev-list HEAD | wc -l) - if [[ $expected_depth != $depth ]]; then + if [[ $expected_depth != "$depth" ]]; then fail "forward depth mismatch expected=$expected_depth actual=$depth" fi submodule_depth=$(git -C "$ROOT/link/$SUBMODULE_REPO_NAME" rev-list HEAD | wc -l) - if [[ $expected_depth != $submodule_depth ]]; then + if [[ $expected_depth != "$submodule_depth" ]]; then fail "forward submodule depth mismatch expected=$expected_depth actual=$submodule_depth" fi @@ -2763,11 +2763,11 @@ function e2e::submodule_sync_depth() { assert_file_eq "$ROOT/link/$SUBMODULE_REPO_NAME/submodule.file" "${FUNCNAME[0]} 1" assert_metric_eq "${METRIC_GOOD_SYNC_COUNT}" 3 depth=$(git -C "$ROOT/link" rev-list HEAD | wc -l) - if [[ $expected_depth != $depth ]]; then + if [[ $expected_depth != "$depth" ]]; then fail "initial depth mismatch expected=$expected_depth actual=$depth" fi submodule_depth=$(git -C "$ROOT/link/$SUBMODULE_REPO_NAME" rev-list HEAD | wc -l) - if [[ $expected_depth != $submodule_depth ]]; then + if [[ $expected_depth != "$submodule_depth" ]]; then fail "initial submodule depth mismatch expected=$expected_depth actual=$submodule_depth" fi rm -rf $SUBMODULE