I just converted my SVN repository to git. For the management I use keyword-substitution. Excerpt from the git config
smudge = "set author=`git log --pretty=format:%ae -1`; SET last_date=`git log --pretty=format:\"%ai\" -1`; SET version=`echo $lastdate | cut -d \" \" -f 1-2 | sed -e \"s/[ -:]/./g\"`; sed -e \"s/[$]Revision[$]/\\$Revision: $last_date \$/\" -e \"s/[$]Date[$]/\\$Date: $last_date \$/\" -e \"s/[$]Author[$]/\\$Author: $author \\$/\" "
clean = sed -r -e 's/([$]Revision|Date|Author)(:[^$]+ [$])/\\1$/'
Source: https://github.com/np-trivial/git-keyword-substitution
This solution should in principle also run under Windows, since I also use gnuwin32. Tools are accessible in the system environment variable. Unfortunately I always get an error message. As far as I could isolate it is because of the above code. I just have no idea what the problem is.
You do not need gnuwin32.
Content filter driver would work from a regular CMD session, and would be executed with the git bash included with Git for Windows.
That means your smudge/clean scripts should be in bash.
set xx=
is a BAT assignmemnt. xx=...
is a bash assignment.
Try:
smudge = "author=$(git log --pretty=format:%ae -1); last_date=$(git log --pretty=format:\"%ai\" -1); version=$(echo $lastdate | cut -d \" \" -f 1-2 | sed -e \"s/[ -:]/./g\"); sed -e \"s/[$]Revision[$]/\\$Revision: $last_date \$/\" -e \"s/[$]Date[$]/\\$Date: $last_date \$/\" -e \"s/[$]Author[$]/\\$Author: $author \\$/\" "
clean = sed -r -e 's/([$]Revision|Date|Author)(:[^$]+ [$])/\\1$/'
In other words, remove the set
.
However, the OP ozz confirms in the comments that SmartGit does not support content filter driver.
A simple git checkout
or git switch
does triggers it (successfully) in command-line though.