Skip to content

Commit 19e8dae

Browse files
committed
clone to temp
1 parent 4941d8b commit 19e8dae

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/test/update.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ root="$1"
1010
[ -d "$root" ] || mkdir -p "$root"
1111
pushd "$root" || exit 1
1212
root="."
13-
[ -d ".git" ] || { gh auth status &>/dev/null && gh repo clone "${GITHUB_OWNER:-ipitio}/${GITHUB_REPO:-backage}" "$root" -- --depth=1 -b "$GITHUB_BRANCH" --single-branch || git clone --depth=1 -b "$GITHUB_BRANCH" --single-branch "https://$([ -n "$GITHUB_TOKEN" ] && echo "$GITHUB_TOKEN@" || echo "")github.com/${GITHUB_OWNER:-ipitio}/${GITHUB_REPO:-backage}.git" "$root"; }
13+
14+
if [ ! -d .git ]; then
15+
mkdir -p .bkg
16+
pushd .bkg || exit 1
17+
gh auth status &>/dev/null && gh repo clone "${GITHUB_OWNER:-ipitio}/${GITHUB_REPO:-backage}" "." -- --depth=1 -b "$GITHUB_BRANCH" --single-branch || git clone --depth=1 -b "$GITHUB_BRANCH" --single-branch "https://$([ -n "$GITHUB_TOKEN" ] && echo "$GITHUB_TOKEN@" || echo "")github.com/${GITHUB_OWNER:-ipitio}/${GITHUB_REPO:-backage}.git" "."
18+
popd || exit 1
19+
shopt -s dotglob
20+
mv .bkg/* .
21+
rm -rf .bkg
22+
shopt -u dotglob
23+
fi
24+
1425
pushd src || exit 1
1526
source bkg.sh
1627
popd || exit 1

0 commit comments

Comments
 (0)