sbopkg: Better handling git repository during bad network connection.

Signed-off-by: Willy Sudiarto Raharjo <willysr@sbopkg.org>
This commit is contained in:
Willy Sudiarto Raharjo 2020-01-16 12:56:48 +07:00
parent c702bb8aa0
commit 3fbbe4eb96
No known key found for this signature in database
GPG key ID: 887B8374D7333381
2 changed files with 16 additions and 1 deletions

View file

@ -2458,6 +2458,7 @@ git_command() {
local SYNC_LOCK=$SBOPKGTMP/sbopkg_sync.lck
local URL BRANCH CWD
local NEW_REPO=0
eval $(sed 's/^\(.*\)@\(.*\)$/URL=\1; BRANCH=\2/g' <<< $REPO_LINK)
@ -2473,10 +2474,22 @@ git_command() {
mkdir -p $REPO_DIR
cd $REPO_DIR
git init
NEW_REPO=1
fi
# Update the repository
cd $REPO_DIR
git pull $URL $BRANCH
# If the initial pull fails right after a "git init", the .git
# directory is garbage and will cause further attempts to fail.
if [ "$NEW_REPO" = "1" -a "$?" != 0 ]; then
echo
echo "Failed to check out repository, check the URL or your"
echo "network connection."
rm -rf .git $SYNC_LOCK
return
fi
# Remove leftovers
# This is optional, think of it as a way to emulate the --delete --exclude
# rsync directives

View file

@ -1,6 +1,6 @@
SBOPKG NEWS
sbopkg-dev (2019-12-26 05:13:18 UTC)
sbopkg-dev (2020-01-16 05:55:44 UTC)
FEATURES
* sqg: Parallelize building of single and all packages by option -j.
Patch by Marcel Saegebarth.
@ -55,6 +55,8 @@ sbopkg-dev (2019-12-26 05:13:18 UTC)
* Fix file ownership changes when unpacking tarball
Patch by pv4 (#54)
* Handle upper case value for MD5SUMS
* Better handling at git repository during bad network connection.
Patch by Urchlay
sbopkg 0.38.1 (2016-09-01 13:42 UTC)
FEATURES