git remote set-head doesn't work with bare repo

This commit is contained in:
z4yx 2020-05-22 17:14:37 +08:00
parent d5b43fc50d
commit cca64b873b

3
git.sh
View File

@ -14,7 +14,8 @@ function update_linux_git() {
echo "==== SYNC $UPSTREAM START ====" echo "==== SYNC $UPSTREAM START ===="
git remote set-url origin "$UPSTREAM" git remote set-url origin "$UPSTREAM"
/usr/bin/timeout -s INT 3600 git remote -v update -p /usr/bin/timeout -s INT 3600 git remote -v update -p
git remote set-head origin --auto 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=$(find objects -type f | wc -l)
[[ "$objs" -gt 8 ]] && git repack -a -b -d [[ "$objs" -gt 8 ]] && git repack -a -b -d
sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+') sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+')