Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What's going on here: Git is optimized to switch between branches as quickly as possible. In particular, <code>git checkout</code> is designed to not touch any files that are identical in both branches.</p> <p>Unfortunately, RCS keyword substitution breaks this. For example, using <code>$Date$</code> would require <code>git checkout</code> to touch every file in the tree when switching branches. For a repository the size of the Linux kernel, this would bring everything to a screeching halt.</p> <p>In general, your best bet is to tag at least one version:</p> <pre><code>$ git tag v0.5.whatever </code></pre> <p>...and then call the following command from your Makefile:</p> <pre><code>$ git describe --tags v0.5.15.1-6-g61cde1d </code></pre> <p>Here, git is telling me that I'm working on an anonymous version 6 commits past v0.5.15.1, with an SHA1 hash beginning with <code>g61cde1d</code>. If you stick the output of this command into a <code>*.h</code> file somewhere, you're in business, and will have no problem linking the released software back to the source code. This is the preferred way of doing things.</p> <p>If you can't possibly avoid using RCS keywords, you may want to start with this <a href="http://kerneltrap.org/mailarchive/git/2007/10/12/335953" rel="noreferrer">explanation by Lars Hjemli</a>. Basically, <code>$Id$</code> is pretty easy, and you if you're using <code>git archive</code>, you can also use <code>$Format$</code>.</p> <p>But, if you absolutely cannot avoid RCS keywords, the following should get you started:</p> <pre><code>git config filter.rcs-keyword.clean 'perl -pe "s/\\\$Date[^\\\$]*\\\$/\\\$Date\\\$/"' git config filter.rcs-keyword.smudge 'perl -pe "s/\\\$Date[^\\\$]*\\\$/\\\$Date: `date`\\\$/"' echo '$Date$' &gt; test.html echo 'test.html filter=rcs-keyword' &gt;&gt; .gitattributes git add test.html .gitattributes git commit -m "Experimental RCS keyword support for git" rm test.html git checkout test.html cat test.html </code></pre> <p>On my system, I get:</p> <pre><code>$Date: Tue Sep 16 10:15:02 EDT 2008$ </code></pre> <p>If you have trouble getting the shell escapes in the <code>smudge</code> and <code>clean</code> commands to work, just write your own Perl scripts for expanding and removing RCS keywords, respectively, and use those scripts as your filter.</p> <p>Note that you <em>really</em> don't want to do this for more files than absolutely necessary, or git will lose most of its speed.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload