I have an issue where we supply source to a client that has to have customer specific legal comment header information installed in source files with several different versions of the headers depending on which source files they are ( ie: developer specified categories )
So what I want is an ability to specify a string like $Id$
or $SpecialName$
to define what header is to be inserted which will be expanded by the code distribution build ( makes zip or jar files ) into
$SpecialName: lots of customer specific stuff like a big header of copyright, legal, and
other info
blah blah blah $
And then if they modify or patch something in the file and send it back I want to check the changes into git and have it ignore everything between the build expanded "$SpecialName:"
and the next "$" the way $Id$
can be made to work when checking things in.
I saw a reference to a "$Format:"
in this question but haven't found references to what it is and whether it is what I'm looking for or not.
Ideally I could specify the strings on the reference repository server "read only" and have it propagate to all users when they pull changes, but that is a separate issue from achieving the functionality which comes first.
It looks like one approach is to use "filters" - from the git book:
However, that result is of limited use. If you’ve used keyword substitution in CVS or Subversion, you can include a datestamp — the SHA isn’t all that helpful, because it’s fairly random and you can’t tell if one SHA is older or newer than another.
It turns out that you can write your own filters for doing substitutions in files on commit/checkout. These are the “clean” and “smudge” filters. In the .gitattributes file, you can set a filter for particular paths and then set up scripts that will process files just before they’re committed (“clean”, see Figure 7.2) and just before they’re checked out (“smudge”, see Figure 7.3). These filters can be set to do all sorts of fun things.
The relevant thing here is it would be appropriate to do this on the repository server and not on the client - is processing of the "file" data pre-commit and pre-checkout possible on the repository server?