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

#!/bin/bash
repoRoot=$(git rev-parse --show-toplevel)
listFilesToSubstitute=$(find -name *.gitsubstitute)
listStaticPathFiles=$(git grep -lr --untracked $repoRoot)
listStagedFiles=$(git diff --staged --name-only)
staticPathSubstitution="\${REPO_ROOT}"
for entryFileToSubstitute in $listFilesToSubstitute; do
fullPath="${repoRoot}/${entryFileToSubstitute}"
fullPathSubstitute="${repoRoot}/${entryFileToSubstitute%.gitsubstitute}"
fileContent=$(<$fullPath)
echo "${fileContent//${staticPathSubstitution}/${repoRoot}}" > "${fullPathSubstitute}"
done