# Confused about "ident" filter

3 messages from 2008-04-17 to 2008-04-19. Participants: Peter Karlsson, Paolo Bonzini, Jakub Narebski.
Thread: https://gitlist.dev/t/13147

## Peter Karlsson, 2008-04-17 07:15

Subject: Confused about "ident" filter
Message-ID: <Pine.LNX.4.64.0804170812230.7970@ds9.cixit.se>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0804170812230.7970%40ds9.cixit.se

```
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, 2008-04-17 14:36

Subject: Re: Confused about "ident" filter
Message-ID: <48076059.4040503@gnu.org>
URL: https://gitlist.dev/e/48076059.4040503%40gnu.org
In-Reply-To: <Pine.LNX.4.64.0804170812230.7970@ds9.cixit.se>

```
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, 2008-04-19 08:27

Subject: Re: Confused about "ident" filter
Message-ID: <m3skxiqmfr.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3skxiqmfr.fsf%40localhost.localdomain
In-Reply-To: <48076059.4040503@gnu.org>

```
Paolo Bonzini <bonzini@gnu.org> writes:

> 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

```
