From 9d2d9593895955fc3d1edea5d3f2fd35ff8e0084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samo=20Poga=C4=8Dnik?= Date: Sun, 17 Nov 2024 09:19:19 +0100 Subject: [PATCH] Fixing shellcheck errors found during docker-test --- test/clone.t | 2 +- test/config.t | 2 +- test/init.t | 4 ++-- test/issue29.t | 10 +++++----- test/issue95.t | 6 +++--- test/issue96.t | 6 +++--- test/push-after-init.t | 4 ++-- test/setup | 6 +++--- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/test/clone.t b/test/clone.t index 4a066d7e..de37302a 100644 --- a/test/clone.t +++ b/test/clone.t @@ -10,7 +10,7 @@ clone-foo-and-bar ( mkdir -p "$OWNER/empty" - git init --initial-branch=$DEFAULTBRANCH "$OWNER/empty" + git init --initial-branch="${DEFAULTBRANCH}" "$OWNER/empty" ) # Test that the repos look ok: diff --git a/test/config.t b/test/config.t index e06e9890..83fc3cb6 100644 --- a/test/config.t +++ b/test/config.t @@ -15,7 +15,7 @@ gitrepo=$OWNER/init/doc/.gitrepo cd "$OWNER/init" git config user.email "ini@ini" git config user.name "IniUser" - git config init.defaultBranch $DEFAULTBRANCH + git config init.defaultBranch "${DEFAULTBRANCH}" git subrepo init doc ) > /dev/null diff --git a/test/init.t b/test/init.t index b3450a8e..68ecb1c5 100644 --- a/test/init.t +++ b/test/init.t @@ -24,7 +24,7 @@ output=$( cd "$OWNER/init" git config user.email "ini@ini" git config user.name "IniUser" - git config init.defaultBranch $DEFAULTBRANCH + git config init.defaultBranch "${DEFAULTBRANCH}" git subrepo init doc ) @@ -53,7 +53,7 @@ git clone "$UPSTREAM/init" "$OWNER/init" &>/dev/null cd "$OWNER/init" git config user.email "ini@ini" git config user.name "IniUser" - git config init.defaultBranch $DEFAULTBRANCH + git config init.defaultBranch "${DEFAULTBRANCH}" git subrepo init doc -r git@github.com:user/repo -b foo -M rebase ) >/dev/null diff --git a/test/issue29.t b/test/issue29.t index c12684e5..7c51a053 100644 --- a/test/issue29.t +++ b/test/issue29.t @@ -18,9 +18,9 @@ cd "$TMP" # Make 3 new repos: ( mkdir share main1 main2 - git init --initial-branch=$DEFAULTBRANCH share - git init --initial-branch=$DEFAULTBRANCH main1 - git init --initial-branch=$DEFAULTBRANCH main2 + git init --initial-branch="${DEFAULTBRANCH}" share + git init --initial-branch="${DEFAULTBRANCH}" main1 + git init --initial-branch="${DEFAULTBRANCH}" main2 ) > /dev/null # Add an empty 'readme' to the share repo: @@ -44,7 +44,7 @@ cd "$TMP" touch main1 git add main1 git commit -m "Initial main1" - git subrepo clone ../share share -b "$DEFAULTBRANCH" + git subrepo clone ../share share -b "${DEFAULTBRANCH}" ) > /dev/null # `subrepo clone` the share repo into main2: @@ -55,7 +55,7 @@ cd "$TMP" touch main2 git add main2 git commit -m "Initial main2" - git subrepo clone ../share share -b "$DEFAULTBRANCH" + git subrepo clone ../share share -b "${DEFAULTBRANCH}" ) > /dev/null diff --git a/test/issue95.t b/test/issue95.t index 46c432dc..3f2578c0 100644 --- a/test/issue95.t +++ b/test/issue95.t @@ -12,8 +12,8 @@ use Test::More # Make two new repos ( mkdir host sub - git init --initial-branch=$DEFAULTBRANCH host - git init --initial-branch=$DEFAULTBRANCH sub + git init --initial-branch="${DEFAULTBRANCH}" host + git init --initial-branch="${DEFAULTBRANCH}" sub ) > /dev/null # Initialize host repo @@ -49,7 +49,7 @@ use Test::More touch feature git add feature git commit -m "feature added" - git checkout "$DEFAULTBRANCH" + git checkout "${DEFAULTBRANCH}" ) &> /dev/null # Commit directly to subrepo diff --git a/test/issue96.t b/test/issue96.t index d1250e21..2334629b 100644 --- a/test/issue96.t +++ b/test/issue96.t @@ -11,8 +11,8 @@ use Test::More # Make two new repos ( mkdir host sub - git init --initial-branch=$DEFAULTBRANCH host - git init --initial-branch=$DEFAULTBRANCH sub + git init --initial-branch="${DEFAULTBRANCH}" host + git init --initial-branch="${DEFAULTBRANCH}" sub ) > /dev/null # Initialize host repo @@ -90,7 +90,7 @@ use Test::More # expected: successful push without conflicts is "$( cd host - git subrepo push sub -b "$DEFAULTBRANCH" -u + git subrepo push sub -b "${DEFAULTBRANCH}" -u )" \ "Subrepo 'sub' pushed to '../sub' ($DEFAULTBRANCH)." diff --git a/test/push-after-init.t b/test/push-after-init.t index e7bda8d4..93d8fc0f 100644 --- a/test/push-after-init.t +++ b/test/push-after-init.t @@ -12,14 +12,14 @@ use Test::More ( mkdir -p "$OWNER/init" cd "$OWNER/init" - git init --initial-branch=$DEFAULTBRANCH + git init --initial-branch="${DEFAULTBRANCH}" git config user.name "IniUser" git config user.email "ini@ini" mkdir doc add-new-files doc/FooBar git subrepo init doc || die mkdir ../upstream - git init --initial-branch=$DEFAULTBRANCH --bare ../upstream || die + git init --initial-branch="${DEFAULTBRANCH}" --bare ../upstream || die cd ../upstream git config user.name "UpsUser" git config user.email "ups@ups" diff --git a/test/setup b/test/setup index fe36ffc8..acb42519 100644 --- a/test/setup +++ b/test/setup @@ -59,7 +59,7 @@ mkdir -p "$UPSTREAM" "$OWNER" "$COLLAB" cp -r test/repo/{foo,bar,init} "$UPSTREAM/" DEFAULTBRANCH=$( git config --global --get init.defaultbranch || true ) -[[ -z $DEFAULTBRANCH ]] && DEFAULTBRANCH="master" +[[ -z "${DEFAULTBRANCH}" ]] && DEFAULTBRANCH="master" export DEFAULTBRANCH ### @@ -73,7 +73,7 @@ clone-foo-and-bar() { cd "$OWNER/foo" git config user.name "FooUser" git config user.email "foo@foo" - git config init.defaultBranch $DEFAULTBRANCH + git config init.defaultBranch "${DEFAULTBRANCH}" ) # bar will act as the subrepo git clone "$UPSTREAM/bar" "$OWNER/bar" @@ -81,7 +81,7 @@ clone-foo-and-bar() { cd "$OWNER/bar" git config user.name "BarUser" git config user.email "bar@bar" - git config init.defaultBranch $DEFAULTBRANCH + git config init.defaultBranch "${DEFAULTBRANCH}" ) ) &> /dev/null || die }