X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=pull-usrlocalsrc;h=f3ce96b671e39e175692c897fa509fe82c7ef307;hb=9a73fd795453b874efe7da629d6954ba05774503;hp=41cfaab1a2aa8e91b0d33ab855be61ab2d0e6bf4;hpb=77bef1e2535afe8c9ac98f9f5e090de73a7f4132;p=git-scripts.git diff --git a/pull-usrlocalsrc b/pull-usrlocalsrc index 41cfaab..f3ce96b 100755 --- a/pull-usrlocalsrc +++ b/pull-usrlocalsrc @@ -1,8 +1,17 @@ #! /bin/sh +has_remote() { + git remote show "$1" >/dev/null 2>&1 +} + prog_dir="`dirname \"$0\"`" && cat "$prog_dir"/locate-all.list | grep -F /usr/local/src | - echo "----- $d -----"; cd "$d" && git pull --all || exit 1 while read d; do + echo "----- $d -----"; cd "$d" && + if has_remote upstream && has_remote origin; then + git pull upstream master && git push origin master || exit 1 + else + git remote | xargs -I% git pull % master || exit 1 + fi done