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.

16 lines
571 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="\${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