Derek Moore
2014-10-09 15:56:19 UTC
I first noticed this using the system git provided in Fedora 21, so I
cloned the official git repo, built from source, and it would appear
there are even more options that don't work with export-subst in the
latest code.
I tested this under commit 63a45136a329bab550425c3142db6071434d935e
(HEAD, origin/master, origin/HEAD, master).
Take, for example, the following script:
FILE=Foo.pm
DIR=$(mktemp -d /tmp/git.XXXXXX)
cd $DIR
git init
echo '*.pm export-subst ident' >> .gitattributes
echo '# Last Author : $Author: $Format:%an$ $' > $FILE
echo '# Last Date : $Date: $Format:%ai (%ad)% $' >> $FILE
echo '# Last Version : $Revision: $Format:%d$ $' >> $FILE
echo '# Last Version v2: $Revision: $Format:%D$ $' >> $FILE
echo '# Last Commit : $Commit: $Format:%H$ $' >> $FILE
echo '# This File : $Id$' >> $FILE
echo 'our $VERSION = (qw($Format:%N$))[1];' >> $FILE
git add .
git commit -a -m "Initial commit."
git notes add -f -m '$Release: 0048 $'
git tag -f releases/R0048
git archive HEAD $FILE | tar xf - --to-stdout
rm $FILE
git checkout -- $FILE
cat $FILE
git log --format='%N' -1
You can tell I'm attempting to recreate CVS keywords (bwahahaa!) for a
project that is insisting they need them.
I'd be happy to write a bunch of unit tests for export-subst and all
PRETTY FORMATS format:<string> options, if that would be desirable. I
see the t/ directory, and the t/test-lib.sh stuff looks simple enough
(TAP in bash, hmm).
Thanks,
Derek
cloned the official git repo, built from source, and it would appear
there are even more options that don't work with export-subst in the
latest code.
I tested this under commit 63a45136a329bab550425c3142db6071434d935e
(HEAD, origin/master, origin/HEAD, master).
Take, for example, the following script:
FILE=Foo.pm
DIR=$(mktemp -d /tmp/git.XXXXXX)
cd $DIR
git init
echo '*.pm export-subst ident' >> .gitattributes
echo '# Last Author : $Author: $Format:%an$ $' > $FILE
echo '# Last Date : $Date: $Format:%ai (%ad)% $' >> $FILE
echo '# Last Version : $Revision: $Format:%d$ $' >> $FILE
echo '# Last Version v2: $Revision: $Format:%D$ $' >> $FILE
echo '# Last Commit : $Commit: $Format:%H$ $' >> $FILE
echo '# This File : $Id$' >> $FILE
echo 'our $VERSION = (qw($Format:%N$))[1];' >> $FILE
git add .
git commit -a -m "Initial commit."
git notes add -f -m '$Release: 0048 $'
git tag -f releases/R0048
git archive HEAD $FILE | tar xf - --to-stdout
rm $FILE
git checkout -- $FILE
cat $FILE
git log --format='%N' -1
You can tell I'm attempting to recreate CVS keywords (bwahahaa!) for a
project that is insisting they need them.
I'd be happy to write a bunch of unit tests for export-subst and all
PRETTY FORMATS format:<string> options, if that would be desirable. I
see the t/ directory, and the t/test-lib.sh stuff looks simple enough
(TAP in bash, hmm).
Thanks,
Derek