]> git.phdru.name Git - git-scripts.git/blobdiff - pull-usrlocalsrc
Fix(.gitignore): locate-all.list can only be in the root
[git-scripts.git] / pull-usrlocalsrc
index 5ec06a01b38da175ddf2747c3a1f870972469f74..2fb2f2f302b04640949acde416184096d7db4f24 100755 (executable)
@@ -2,10 +2,18 @@
 
 PATH=/usr/local/src/Python/git-remote-hg:$PATH
 
+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 read d; do
    echo "----- $d -----"; cd "$d" &&
-   git remote | xargs -I'{}' git pull '{}' master || exit 1
+   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