git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Liu Yubao <yubao.liu@gmail.com>
Cc: Dongsheng Song <dongsheng.song@gmail.com>, git@vger.kernel.org
Subject: Re: Does GIT has vc keywords like CVS/Subversion?
Date: Mon, 9 Oct 2006 09:13:14 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0610090904360.3952@g5.osdl.org> (raw)
In-Reply-To: <4529B77A.707@gmail.com>



On Mon, 9 Oct 2006, Liu Yubao wrote:
> 
> IMHO, I don't think keyword substitution is a good idea, as it will confuse
> the external diff/merge tools.

There are other reasons why it's a _horrible_ idea, like the fact that it 
can mess up binary files etc (so if you do keyword substitution, you also 
need to suddenly care _deeply_ whether a file is binary or not).

The whole notion of keyword substitution is just totally idiotic. It's 
trivial to do "outside" of the actual content tracking, if you want to 
have it when doing release trees as tar-balls etc.

So:
 - inside of the SCM, keyword substitution is pointless, since you have 
   much better tools available (like "git log filename")
 - outside of the SCM, keyword substitution can make sense, but doing it 
   should be in helper scripts or something that can easily tailor it for 
   the actual need of that particular project.

For example, we actually do a certain kind of keyword subtituion for the 
kernel. Look at the -git snapshots: the script that generates the snapshot 
diffs has a simple sequence in it to "keyword substitute" the Makefile for 
the EXTRAVERSION flag, so the diff will result in the Makefile having the 
knowledge of which git SHA1 version the resulting patch was, even though 
the thing isn't a git tree any more:

	...
	git-read-tree $CURCOMM
	git-checkout-index Makefile
	perl -pi -e "s/EXTRAVERSION =.*/EXTRAVERSION = $EXTRAVERSION/" Makefile
	git-diff-index -m -p $RELTREE | gzip -9 > $STAGE/patch-$CURNAME.gz
	...

So this is how to do keyword substitution in a _sane_ way.

Sure, we could do something like this as a git script, and support it 
"natively", but the fact is, keyword substitution is just stupid.

		Linus

  parent reply	other threads:[~2006-10-09 16:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-09  1:25 Does GIT has vc keywords like CVS/Subversion? Dongsheng Song
2006-10-09  2:44 ` Liu Yubao
2006-10-09  2:59   ` Petr Baudis
2006-10-09 16:13   ` Linus Torvalds [this message]
2006-10-09 21:08     ` Martin Langhoff
2006-10-09 22:48       ` Johannes Schindelin
2006-10-09 22:57         ` Martin Langhoff
2006-10-09 22:55       ` Junio C Hamano
2006-10-10  7:37       ` Rene Scharfe
2006-10-10 16:49       ` Shawn Pearce
2006-10-10 17:14         ` Linus Torvalds
2006-10-10 17:41           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0610090904360.3952@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=dongsheng.song@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=yubao.liu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).