You are here

mirror.sh in Realistic Dummy Content 7

#!/bin/bash
if [ "$#" -ne  "1" ]
  then
    echo "Please supply exactly one argument, not $#"
    echo ""
    echo "Usage:"
    echo ""
    echo "Mirrors this git repo from one location to another. This was introduced"
    echo "because Travis CI only works on Github repos, whereas we want the canonical"
    echo "repo for this project to be on Drupal.org."
    echo ""
    echo "First make sure you have access to the source and destinations via ssh key."
    echo "Then call, (for example) periodically from continuous integration server:"
    echo ""
    echo "./scripts/mirror.sh git@example.com/destination/repo"
else
  # We are mirroring from an existing directory.
  # See http://blog.plataformatec.com.br/2013/05/how-to-properly-mirror-a-git-repository/
  git fetch --prune
  git push --prune $1 +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*
fi

File

scripts/mirror.sh
View source
  1. #!/bin/bash
  2. if [ "$#" -ne "1" ]
  3. then
  4. echo "Please supply exactly one argument, not $#"
  5. echo ""
  6. echo "Usage:"
  7. echo ""
  8. echo "Mirrors this git repo from one location to another. This was introduced"
  9. echo "because Travis CI only works on Github repos, whereas we want the canonical"
  10. echo "repo for this project to be on Drupal.org."
  11. echo ""
  12. echo "First make sure you have access to the source and destinations via ssh key."
  13. echo "Then call, (for example) periodically from continuous integration server:"
  14. echo ""
  15. echo "./scripts/mirror.sh git@example.com/destination/repo"
  16. else
  17. # We are mirroring from an existing directory.
  18. # See http://blog.plataformatec.com.br/2013/05/how-to-properly-mirror-a-git-repository/
  19. git fetch --prune
  20. git push --prune $1 +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*
  21. fi