X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=pull-usrlocalsrc;h=ef9167b7f70561a8ac522b1400adda822c7cae33;hb=d5edda00cd5b8ecd8ca9b3b38654b25176beb3cb;hp=f8654c0839ce407c10f2f084a4741c29906a1157;hpb=f288a00b6279914b19c3e92e69fc62ad71cc7bea;p=git-scripts.git diff --git a/pull-usrlocalsrc b/pull-usrlocalsrc index f8654c0..ef9167b 100755 --- a/pull-usrlocalsrc +++ b/pull-usrlocalsrc @@ -1,9 +1,18 @@ #! /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 | -while true; do - read d || exit 0 - 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 pull upstream main:master; } && + git push origin master || exit 1 + elif has_remote origin; then + git pull origin master || exit 1 + fi done