Fix gitfetch script for submodules

This commit is contained in:
Talia 2020-05-20 10:14:36 +02:00
parent 16f78c53cc
commit 7d335fb63d

View file

@ -1,13 +1,17 @@
#!/bin/sh #!/bin/sh
git__fetch() { git__fetch() {
if [ -f "$1/.git" ]
then dir="$(cat $top/.git | sed -e 's/^gitdir: //')"
else dir="$1/.git"
fi
if [ -n "$BASH_AUTOFETCH_TIMEOUT" ]; then if [ -n "$BASH_AUTOFETCH_TIMEOUT" ]; then
timeout=$BASH_AUTOFETCH_TIMEOUT timeout=$BASH_AUTOFETCH_TIMEOUT
else else
timeout=60 timeout=60
fi fi
if [ -f "$1/.git/FETCH_HEAD" ]; then if [ -f "$dir/FETCH_HEAD" ]; then
diff=$(($(date +%s) - $(stat -c %Y $1/.git/FETCH_HEAD))) diff=$(($(date +%s) - $(stat -c %Y $dir/FETCH_HEAD)))
else else
diff=9999 diff=9999
fi fi
@ -16,7 +20,7 @@ git__fetch() {
else run=0 else run=0
fi fi
if [ "$run" -gt 0 ]; then if [ "$run" -gt 0 ]; then
touch $1/.git/FETCH_HEAD touch $dir/FETCH_HEAD
nohup git fetch > /dev/null 2>&1 & nohup git fetch > /dev/null 2>&1 &
fi fi
echo $run echo $run