git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	"Robin H. Johnson" <robbat2@gentoo.org>
Subject: Re: Weird shallow-tree conversion state, and branches of shallow trees
Date: Sun, 15 Apr 2007 20:51:31 +0100	[thread overview]
Message-ID: <200704152051.35639.andyparkins@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0704151115270.5473@woody.linux-foundation.org>

On Sunday 2007, April 15, Linus Torvalds wrote:

> Keyword substitution is just *stupid*. It's an inexcusable
> braindamage. Don't do it. It leads to all kinds of idiotic problems
> downstream, and it really doesn't help *anything* except for "but I'm
> used to it". There are absolutely no valid uses for it.

You're right that it can cause problems, but it is certainly not the 
case that there are no valid uses for it.  I've mentioned it before but 
I'll say it again, because it is the only feature I miss from 
subversion and I can't see why it is invalid.

I keep diagrams for a project in SVG format in the repository, this 
works very well because SVG is so nicely ASCII.  In the title block of 
the diagram I put "$Id$", then in subversion, after checking in and 
updating it got expanded to

 $Id: diagram.svg 148 2002-07-28 21:30:43Z andyp $

Now, I print out that diagram and pin it to my wall - sometimes copies 
of it are given to others.  I do this on a regular basis.  The diagram 
is big and complicated and all versions of it look very similar.  In 
short it is very convenient to have the version of the file actually 
printed on the piece of paper.  This is a piece of paper remember, 
there is no way to hash the daigram, or even look at the underlying 
source.  When someone comes to me with a random version of the diagram, 
I can use that ID to checkout exactly the revision that that diagram 
refers to.

Please explain to me why that is not a valid use.

> If you want to tag your files somehow, do it in "git archive" when
> exporting it, but not in the working tree. And realize that once you
> export it with the stupid keyword expansion, diffs etc will all be
> corrupted, and will not - AND MUST NOT - apply to the uncorrupted
> working tree.

All of the problems you describe apply equally to CRLF conversion, and 
yet there seems to be no problem with implementing that.  In fact the 
problem there is significantly worse, as it changes every line of the 
file.

Now, solving the keyword problem is not simple, obviously, but it's 
certainly not impossible.  On git-add the expanded tags get unexpanded 
so $Tag: blah blah blah$ becomes $Tag$; on checkout they get expanded. 
Similarly while calculating diffs - the diff engine unexpands as it 
goes so the lines with the keywords in them are not seen as different 
regardless of the expanded part.

Applying diffs from some external source doesn't corrupt anything - 
because the diff engine is, by definition, going to unexpand the 
keywords when it compares.

So, someone sends you a diff that has this:

- /* $Id: diagram.svg 148 2002-07-28 21:30:43Z andyp $ */
+ /* $Id: diagram.svg 149 2002-07-29 20:32:47Z andyp $ */

And you apply it to the working tree - well, that line will be seen as 
this by the diff engine:

- /* $Id$ */
+ /* $Id$ */

No change.  Obviously this is entirely optional and would be activated 
on a per-file basis.  For git it would be even more useful because of 
all the information actually available.  I'd love to have git-keywords 
like these:

 $Commit: 2bfe3cec92be4f5e3bfc0e71ed560df4a726c07b$
 $Object: b1bd9e46c2bd64e00b671ff5ed512d9c12b53309$
 $Describe: v1.5.1.1-83-g2bfe3ce$
 $Id: cache.h v1.5.1.1-83-g2bfe3ce $

Feelings seem very strong about this; I've seen comments again and again 
about how braindamaged it is and I just can't see it - please, help me 
see - what is it that is so utterly broken about it?  I can see that it 
adds a complication to many parts, but I can't see why it is seen as so 
evil.



Andy

-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com

  reply	other threads:[~2007-04-15 19:52 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-12  0:53 Weird shallow-tree conversion state, and branches of shallow trees Robin H. Johnson
2007-04-14  8:56 ` Johannes Schindelin
2007-04-15  0:03   ` Robin H. Johnson
2007-04-15  0:02     ` David Lang
2007-04-15  2:01       ` Robin H. Johnson
2007-04-15  4:31         ` Shawn O. Pearce
2007-04-15  5:57           ` Nguyen Thai Ngoc Duy
2007-04-15  8:54             ` Jakub Narebski
2007-04-15 18:18             ` Linus Torvalds
2007-04-15 19:51               ` Andy Parkins [this message]
2007-04-15 20:51                 ` Linus Torvalds
2007-04-16  0:11                   ` Bill Lear
2007-04-16  9:10                     ` Andy Parkins
2007-04-16 15:17                       ` Julian Phillips
2007-04-16  2:17                   ` Robin H. Johnson
2007-04-16  3:01                     ` Theodore Tso
2007-04-16  3:23                       ` Nguyen Thai Ngoc Duy
2007-04-16 15:08                         ` Linus Torvalds
2007-04-16 16:06                           ` Nguyen Thai Ngoc Duy
2007-04-16  3:32                       ` Robin H. Johnson
2007-04-16 17:00                         ` Linus Torvalds
2007-04-17  4:16                         ` Daniel Barkalow
2007-04-16 14:59                     ` Linus Torvalds
2007-04-16  9:03                   ` Andy Parkins
2007-04-16 15:54                     ` Sven Verdoolaege
2007-04-16 15:58                     ` Linus Torvalds
2007-04-16 23:25                       ` Weird shallow-tree conversion state, and branches of shallowtrees David Lang
2007-04-17 19:50                         ` David Lang
2007-04-17  9:45                       ` Weird shallow-tree conversion state, and branches of shallow trees Andy Parkins
2007-04-16 19:41                     ` Junio C Hamano
2007-04-16 20:55                       ` Andy Parkins
2007-04-17 21:24                         ` Junio C Hamano
2007-04-17 21:51                           ` Andy Parkins
2007-04-15  9:44           ` Robin H. Johnson

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=200704152051.35639.andyparkins@gmail.com \
    --to=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=robbat2@gentoo.org \
    --cc=spearce@spearce.org \
    --cc=torvalds@linux-foundation.org \
    /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).