Our bespoke IDE outputs XML files with an encoding that makes them look like binary files. Diffs and merges of these files fail.
We can create ASCII versions of these files with the tr
command. I would like to get to a state where these files are always automatically converted to ascii before they are committed.
I picked up my copy of Version Control with Git and it wholeheartedly warns me away from using hooks unless I really need to.
Should I be using a hook for this purpose? Or can I do something else to ensure the files are always converted before commit?
Windows XP with msysgit 1.7.4
--= update =--
Thanks everyone for your help and patience. Looking to this question I tried the following, but it does not work:
echo "*.xrp filter=xrp" > .git/info/attributes
git config --global filter.xrp.clean 'tr -cd '\''\11\12\15\40-\176'\'''
git config --global filter.xrp.smudge cat
git checkout --force
The files remain unchanged after this config change. Even when I delete and re-checkout.
The tr
command configured as the clean task does work in isolation. Proof:
$ head -n 1 cashflow/repo/C_GMM_CashflowRepo.xrp
ÿþ< ! - - X M L R e p o s i t o r y f i l e 1 . 0 - - >
$ tr -cd '\''\11\12\15\40-\176'\' < cashflow/repo/C_GMM_CashflowRepo.xrp | head -n 1
<!-- XML Repository file 1.0 -->
Can anyone see what is wrong with my config?