Re: RCS keyword expansion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, 15 Oct 2007, Peter Karlsson wrote:

> I wrote:
>
> > Finding out which commit last changed that file is slow.  That's why 
> > it breaks down.
> 
> That might be, but it only needs to be done when a file is updated.

Almost.

It also needs to be updated when switching branches.  For every file.  
Since the commit blamed for the current version could be different for 
every file.

> > You are just to used to CVS/SVN to see that there is a much better way 
> > in git.
> 
> I can see that favouring the argument that having a $Id$ that gives me 
> the global state id when the file was last updated is a bad idea. Fair 
> enough. Give me a local state tham (which you did, hash id for the file 
> contents).
> 
> My problem now is the file date. That could possibly be fixed by having 
> it updated before I check in the file.
> 
> 
> So, to summarize, if I've understood the responses here correctly, what
> I really want is:
> 
>  on commit:
>   - replace "$Date$" (or whatever) with the current time.

I think that would be more "on edit".

>   - store the contents.
> 
>  on checkout:
>   - update the file.
>   - replace "$Id$" (ditto) with a magic identifier for the file state.
>   - update git's state so that it doesn't see the "$Id$" expansion
>     as a change in the file contents.
> 
> Now the question is: Where can I find documentation on how to do this
> (i.e what should I search for--"hooks"?)?

For the $Id$ thing: Documentation/gitattributes.txt.  For the $Date$ 
thing: Documentation/hooks.txt, and Documentation/git-rev-list.txt.  
You'll need to roll your own thing there, since Git oldtimers feel that 
what you want to do is the wrong thing (see Randal's comment on generating 
it as part of the build process).

What you want to do might be frowned upon by many on the list, but it is 
certainly doable.  See ExampleScripts on the wiki for inspiration.

> And, if this goes into the ".git" directory, can I still have it 
> replicated when I clone a repository? I noticed that my ".git/ignore" 
> file wasn't replicated and that I had to replace it with a local 
> ".gitignore" to get it under version control.

No, there is not way to have it replicated into the .git directory.  The 
common way would be to either have it installed as templates, so that 
every user of yours gets them automatically, or to check them in under 
different names, and make every user install them by hand.

The rationale: every cloner is free to choose what hooks she wants to run.  
So checking in such hooks is always understood as suggestion what hooks 
to install.

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux