From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: Commit ID in exported Tar Ball Date: Tue, 22 May 2007 15:54:35 -0700 Message-ID: <7vd50s79lg.fsf@assigned-by-dhcp.cox.net> References: <20070517163803.GE4095@cip.informatik.uni-erlangen.de> <200705171857.22891.johan@herland.net> <20070517171150.GL5272@planck.djpig.de> <464F5CA2.3070809@lsrfire.ath.cx> <7vd50wv88t.fsf@assigned-by-dhcp.cox.net> <20070520035752.GG3141@spearce.org> <46502EF7.6000708@lsrfire.ath.cx> <20070521060231.GI3141@spearce.org> <4651F908.2000608@lsrfire.ath.cx> <46536E32.6000202@lsrfire.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: "Shawn O. Pearce" , git@vger.kernel.org, Frank Lichtenheld , Johan Herland , Thomas Glanzmann , Michael Gernoth To: =?utf-8?Q?Ren=C3=A9?= Scharfe X-From: git-owner@vger.kernel.org Wed May 23 00:54:46 2007 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1HqdFe-0008H5-4s for gcvg-git@gmane.org; Wed, 23 May 2007 00:54:46 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756276AbXEVWyk convert rfc822-to-quoted-printable (ORCPT ); Tue, 22 May 2007 18:54:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756499AbXEVWyk (ORCPT ); Tue, 22 May 2007 18:54:40 -0400 Received: from fed1rmmtao105.cox.net ([68.230.241.41]:36449 "EHLO fed1rmmtao105.cox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756276AbXEVWyj convert rfc822-to-8bit (ORCPT ); Tue, 22 May 2007 18:54:39 -0400 Received: from fed1rmimpo02.cox.net ([70.169.32.72]) by fed1rmmtao105.cox.net (InterMail vM.7.05.02.00 201-2174-114-20060621) with ESMTP id <20070522225439.EUVF22040.fed1rmmtao105.cox.net@fed1rmimpo02.cox.net>; Tue, 22 May 2007 18:54:39 -0400 Received: from assigned-by-dhcp.cox.net ([68.5.247.80]) by fed1rmimpo02.cox.net with bizsmtp id 2Nue1X0061kojtg0000000; Tue, 22 May 2007 18:54:39 -0400 cc: Linus Torvalds In-Reply-To: <46536E32.6000202@lsrfire.ath.cx> (=?utf-8?Q?Ren=C3=A9?= Scharfe's message of "Wed, 23 May 2007 00:26:58 +0200") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: Ren=C3=A9 Scharfe writes: > OK, so here's a first shot at the mentioned parser. It only understa= nds > @@COMMITID@@ and @@@@, but it's easily extendible. The internals of > git-describe would need to be converted to library functions, prefera= bly > offering every piece of version info separately (see thread "[PATCH] > Make sure an autogenerated version has at least four parts" for why). > > Before doing that, we should determine if this is the way to, though. > > Ren=C3=A9 Hmmm. I am torn. It almost feels as if we'd better bite the bullet and do more insane things in ident substitution, instead of introducing this apparent syntax inconsistency between "$id$" and "@@COMMITID@@". That is, we could (I am not seriously proposing to do this, as I expect this will lead to a lot of insanity at the end): (1) introduce "const unsigned char commit_in_focus[20]", globally available to git suite, and clear it at the beginning of main(); (2) teach ident substitution to expand "$commit$" to sprintf("$commit: %40s $", sha1_to_hex(commit_in_focus[])), and unexpand "$commit: .* $". (3) have git-archive set commit_in_focus[] before letting the convert_to_working_tree do its work. (4) later, we _might_ teach a single tree read-tree to also set up commit_in_focus[], so that: $ rm -f .git/index $ git checkout -f HEAD would expand "$commit$" in blobs. This obviously have a lot of problems once we start adding the commit_in_focus[] to more random programs. Even two-tree read-tree case would behave in an unexpected way for an uninitiated person, if you do something like: $ git checkout master $ git checkout next I am CC'ing Linus because he would literally hate me suggesting the above.