You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
817 B

  1. #!/bin/bash
  2. repoRoot=$(git rev-parse --show-toplevel)
  3. listFilesToSubstitute=$(find -name *.gitsubstitute)
  4. listStaticPathFiles=$(git grep -lr --untracked $repoRoot)
  5. listStagedFiles=$(git diff --staged --name-only)
  6. staticPathSubstitution="\$\$\${GITSUBSTITUTE_REPO_ROOT}"
  7. for entryFileToSubstitute in $listFilesToSubstitute; do
  8. fullPath="${repoRoot}/${entryFileToSubstitute}"
  9. fullPathSubstitute="${repoRoot}/${entryFileToSubstitute%.gitsubstitute}"
  10. fileContent=$(<$fullPath)
  11. echo "${fileContent//${staticPathSubstitution}/${repoRoot}}" > "${fullPathSubstitute}"
  12. done
  13. mv hw_platform/platform.tcl TMP1
  14. mv hw_platform/platform.tcl.gitsubstitute TMP2
  15. rm -rf hw_platform
  16. mkdir hw_platform
  17. mv TMP1 hw_platform/platform.tcl
  18. mv TMP2 hw_platform/platform.tcl.gitsubstitute
  19. xsct hw_platform/platform.tcl