mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 04:12:42 +00:00
git: return non-zero when failed
This commit is contained in:
parent
0a5fa2e05c
commit
3194c6653e
9
aosp.sh
9
aosp.sh
@ -8,6 +8,8 @@ UPSTREAM=${TUNASYNC_UPSTREAM_URL:-"https://android.googlesource.com/mirror/manif
|
||||
git config --global user.email "mirrors@tuna"
|
||||
git config --global user.name "tuna mirrors"
|
||||
|
||||
repo_sync_rc=0
|
||||
|
||||
function repo_init() {
|
||||
mkdir -p $TUNASYNC_WORKING_DIR
|
||||
cd $TUNASYNC_WORKING_DIR
|
||||
@ -16,7 +18,11 @@ function repo_init() {
|
||||
|
||||
function repo_sync() {
|
||||
cd $TUNASYNC_WORKING_DIR
|
||||
$REPO sync -f -j1 || echo "WARNING: repo-sync may fail, but we just ignore it."
|
||||
set +e
|
||||
$REPO sync -f -j1
|
||||
repo_sync_rc=$?
|
||||
set -e
|
||||
[[ "$repo_sync_rc" -ne 0 ]] && echo "WARNING: repo-sync may fail, but we just ignore it."
|
||||
}
|
||||
|
||||
function git_repack() {
|
||||
@ -44,3 +50,4 @@ if [[ "$USE_BITMAP_INDEX" == "1" ]]; then
|
||||
git_repack
|
||||
echo "Total size is" $(numfmt --to=iec $total_size)
|
||||
fi
|
||||
exit $repo_sync_rc
|
||||
|
5
git.sh
5
git.sh
@ -14,7 +14,9 @@ function update_linux_git() {
|
||||
echo "==== SYNC $UPSTREAM START ===="
|
||||
git remote set-url origin "$UPSTREAM"
|
||||
/usr/bin/timeout -s INT 3600 git remote -v update -p
|
||||
head=$(git remote show origin | awk '/HEAD branch:/ {print $NF}')
|
||||
local ret=$?
|
||||
[[ $ret -ne 0 ]] && echo "git update failed with rc=$ret"
|
||||
local head=$(git remote show origin | awk '/HEAD branch:/ {print $NF}')
|
||||
[[ -n "$head" ]] && echo "ref: refs/heads/$head" > HEAD
|
||||
objs=$(find objects -type f | wc -l)
|
||||
[[ "$objs" -gt 8 ]] && git repack -a -b -d
|
||||
@ -22,6 +24,7 @@ function update_linux_git() {
|
||||
sz=$(($sz*1024))
|
||||
echo "size-pack:" $(numfmt --to=iec $sz)
|
||||
echo "==== SYNC $UPSTREAM DONE ===="
|
||||
return $ret
|
||||
}
|
||||
|
||||
if [[ ! -f "$TUNASYNC_WORKING_DIR/HEAD" ]]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user