Stack Overflow / Git filter and sed fight over `\$`
Stack Overflow / Git filter and sed fight over `\$`
I am trying to write a git filter using sed
[filter "revisioner"]
smudge = sed -e "s/\\\$Revision\\\$/\$Revision: $(GIT_EXEC_PATH=/usr/lib/git-core/ git describe --tag svn)\$/g"
clean = sed -e "s/\\\$Revision: [^$]*\\\$/\$Revision\$/g"
For sed to do the correct thing it wants to have an odd number of \ to escape the $, however git complains about an odd number of \ with:
fatal: bad config line 2 in file .git/../.gitconfig
I don't really want to move my sed script into an external command because it is yet an other moving part my users need to setup on their system, before using my repository.
Any advice?