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

#!/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="\$\$\${GITSUBSTITUTE_REPO_ROOT}"
for entryFileToSubstitute in $listFilesToSubstitute; do
fullPath="${repoRoot}/${entryFileToSubstitute}"
fullPathSubstitute="${repoRoot}/${entryFileToSubstitute%.gitsubstitute}"
fileContent=$(<$fullPath)
echo "${fileContent//${staticPathSubstitution}/${repoRoot}}" > "${fullPathSubstitute}"
done
mv hw_platform/platform.tcl TMP1
mv hw_platform/platform.tcl.gitsubstitute TMP2
rm -rf hw_platform
mkdir hw_platform
mv TMP1 hw_platform/platform.tcl
mv TMP2 hw_platform/platform.tcl.gitsubstitute
xsct hw_platform/platform.tcl