add_submodule.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env bash
  2. . .//setgin.sh
  3. ## this will be taken for the previous code
  4. projectname="testproject"
  5. projectdir=${HOME}/datasets/${projectname}
  6. ##Inputs if made a function:
  7. submodule="raw_data"
  8. folder="10_raw_data2"
  9. ## create repo with readme, no issues
  10. echo "Creating ${submodule} submodule ${projectname}.${submodule}"
  11. createrepot ${projectname}.${submodule}
  12. addrepototeam ${projectname}.${submodule} ${projectteam}
  13. issuetrackeroption ${projectname}.${submodule} false
  14. ## add repo to parent (cloned version)
  15. git -C ${projectdir} submodule add git@${ginssh}:/${organisation}/${projectname}.${submodule} ${folder}
  16. git -C ${projectdir} submodule sync
  17. ## not working: initialise git annex in submodule
  18. git -C ${projectdir} submodule foreach git annex init
  19. ## add to .gitmodules file and sync parent with server
  20. datalad -C ${projectdir} add --to-git .gitmodules --message "Initialise submodules"
  21. datalad -C ${projectdir} publish --recursive
  22. ## sync via gin to have submodules on gin server
  23. cd ${projectdir}
  24. gin sync