I am trying to implement a filter that updates a "Last modified: <date>" 
field in a source file comment header on commit. From the reading I've done 
so far this seems to be a different approach to the usual "mimic RCS 
behaviour" approach that uses a source file with the $Date$ (or similar) 
keyword that gets replaced with the current date on checkout.

Most succintly my approach is thus: 
   sed "s|Last modified: [0-9]*|Last modified: ${currentYear}|"
ie. On a clean, look for "Last modified: <some year>" text and replace it 
with "Last modified: <this year>" as the file is committed (a change to a 
file isn't "real" until it is preserved in the repo).

I think this approach makes more sense than the RCS approach because now 
the central repository always represents the actual commited changes, 
rather than some abstraction using variables and the local files should 
also be perfectly aligned with packaging for distribution via tarball or 
such because the dates are self-consistent.

The problem is that the local files and the files in the repo end up out of 
sync. The local files have the old date, but the repo has the modified 
date. I have to rm the file and git checkout <myFile> to get the change in 
my local directory; strangely git checkout --force doesn't pick up the 
change either.

Is someone able to explain what I need to do to make this work?

Thanks for your help.


Reply via email to