update-subtree.sh 648 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. set -e
  3. bash .utils/.check-workdir.sh
  4. if [ "${1}" = "" ]; then
  5. echo "Usage: <path>"
  6. exit
  7. fi
  8. path="${1}"
  9. while read -u $remote repo branch subdir; do
  10. if [ "${repo:0:1}" = "#" ]; then
  11. continue
  12. fi
  13. if [ "${subdir}" = "/" ]; then
  14. exec {capture}>&1
  15. result="$(git subtree pull -P "${path}" "${repo}" "${branch}" -m "Merge ${path} from ${repo}" 2>&1 | tee /proc/self/fd/$capture)"
  16. bash .utils/.check-merge.sh "${path}" "${repo}" "${result}"
  17. else
  18. bash .utils/.subtree-subdir-helper.sh "${path}" "${repo}" "${branch}" "${subdir}" merge
  19. fi
  20. done {remote}< "${path}/.gitsubtree"