threads / discuss / 13147

Confused about "ident" filter

Subject: Confused about "ident" filter

## tl;dr

3 messages between Apr 17, 2008 and Apr 19, 2008.

replies: 2people: 3as markdown or json

Peter Karlsson· Apr 17, 2008, 07:15 UTC · lore
Hi!

While convincing my employer to convert to Git, I've ran into the old RCS keyword expansion problem again. They have files that they need to export to a customer, without revision history, but they need to embed an identifier that can tell them which version of the file it was.

So, I tried setting up a .gitattributes file:
   * ident
and a simple test perl script that would show me the ident:
   #!/usr/bin/perl
   print 'I am $Id$', "\n";

but I cannot figure out how to get it to actually expand the $Id$. I tried doing "git checkout test.perl", I tried "git clone" to get a new copy of the repository, but still it showed only "$Id$".

I found that "git archive" *does* work.
-- 
\\// Peter - http://www.softwolves.pp.se/
Paolo Bonzini· Apr 17, 2008, 14:36 UTC · re: Peter Karlsson · lore

Re: Confused about "ident" filter

Peter Karlsson wrote:
> I tried doing "git checkout test.perl", I tried "git clone" to get a new
> copy of the repository, but still it showed only "$Id$".

In fact I'm a little confused too. The only way I found to expand "$Id$" consistently was "rm test.perl; git checkout test.perl", or "rm test.perl; git reset --hard HEAD".

I was not so surprised that clone did not expand, though IMHO it is a bug -- but I was *very* surprised to see that cloning a bare repository did not expand, either.

Paolo
Jakub Narebski· Apr 19, 2008, 08:27 UTC · re: Paolo Bonzini · lore

Re: Confused about "ident" filter

Paolo Bonzini <bonzini@gnu.org> writes:
Show 7 quoted lines
> Peter Karlsson wrote:
> > I tried doing "git checkout test.perl", I tried "git clone" to get a new
> > copy of the repository, but still it showed only "$Id$".
> 
> In fact I'm a little confused too.  The only way I found to expand
> "$Id$" consistently was "rm test.perl; git checkout test.perl", or "rm
> test.perl; git reset --hard HEAD".

I think that "git checkout -f test.perl" should work, forcing git to replace existing file.

As to clone problem: it might be chicken and egg problem, with `ident` filter needing .gitattribites in working directory during checkout phase (currently there is no way to use gitattributes from a tree in repository), and checkout writing this file.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

← back to recent threads