git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git smudge filter fails
@ 2016-03-09 18:29 Stephen Morton
  2016-03-10  1:59 ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Morton @ 2016-03-09 18:29 UTC (permalink / raw)
  To: git@vger.kernel.org

A git smudge filter, at least one that relies on the results from 'git
log' does not seem to work
on file A when doing a 'git update' from a revision where file A
doesn't exist to a revision where
it does exist.

Below is a simple recipe to reproduce.

This appears to me to be a bug. If not, why is it expected and is
there anything I can do to
work around this behaviour?

Steve

mkdir git_test
cd git_test/
git init .
touch bar.c
git add .
git commit -am "Initial commit. foo.c not here yet."
git tag no_foo

touch foo.c
git add .
git commit -am "Add foo, no content"
echo 'Date is $Date$' >> foo.c
git commit -am "Add date to foo.c"
echo 'foo.c filter=dater' > .git/info/attributes
git config --local filter.dater.smudge 'myDate=`git log
--pretty=format:"%cd" --date=iso -1 -- %f`; sed -e
"s/\(\\$\)Date[^\\$]*\\$/\1Date: $myDate \\$/g"'
git config --local filter.dater.clean 'sed -e
"s/\(\\$\)Date[^\\$]*\\$/\1Date\\$/g"'
rm -f foo.c
git checkout -- foo.c
cat foo.c
# observe keyword expansion

git checkout no_foo
git checkout master
cat foo.c
#observe keyword expansion lost

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-03-15 16:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 18:29 git smudge filter fails Stephen Morton
2016-03-10  1:59 ` Jeff King
2016-03-10 14:45   ` Stephen Morton
2016-03-10 21:05     ` Jeff King
2016-03-10 22:04       ` Junio C Hamano
2016-03-15 16:17         ` Stephen Morton
2016-03-15 16:48           ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).