From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: emacs-repository-version on MS-Windows Date: Sun, 16 Nov 2014 18:03:04 +0200 Message-ID: <834mtzdtfr.fsf@gnu.org> References: <83vbmii0ud.fsf@gnu.org> <5465D212.20604@gmx.at> <83lhndj2b3.fsf@gnu.org> <83oas8dxmm.fsf@gnu.org> <3isihk87gt.fsf@fencepost.gnu.org> <87oas89jbt.fsf@igel.home> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1416153820 27526 80.91.229.3 (16 Nov 2014 16:03:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Nov 2014 16:03:40 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 16 17:03:33 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xq2IW-00055q-AX for ged-emacs-devel@m.gmane.org; Sun, 16 Nov 2014 17:03:32 +0100 Original-Received: from localhost ([::1]:44219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xq2IV-0005LD-MX for ged-emacs-devel@m.gmane.org; Sun, 16 Nov 2014 11:03:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xq2IN-0005He-Ty for emacs-devel@gnu.org; Sun, 16 Nov 2014 11:03:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xq2II-0006yB-KM for emacs-devel@gnu.org; Sun, 16 Nov 2014 11:03:23 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:64336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xq2II-0006y0-CR; Sun, 16 Nov 2014 11:03:18 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NF500M0035OHI00@a-mtaout22.012.net.il>; Sun, 16 Nov 2014 18:03:16 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NF500MQZ39FHD00@a-mtaout22.012.net.il>; Sun, 16 Nov 2014 18:03:16 +0200 (IST) In-reply-to: <87oas89jbt.fsf@igel.home> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:177313 Archived-At: > From: Andreas Schwab > Cc: Eli Zaretskii , emacs-devel@gnu.org > Date: Sat, 15 Nov 2014 23:42:46 +0100 > > > The bzr version of this intentionally avoided calling external executables. > > (Apparently not possible with git.) > > You can do that with git as well, the repository structure is fully > documented (gitrepository-layout(5)). Of course, you have to be > prepared to update the procedure in case of future extensions. So is the following algorithm correct? . visit the file .git/HEAD . if the contents is a SHA1 checksum, we are done: return that SHA1 . otherwise: . parse the contents of .git/HEAD that should have the form "ref: refs/heads/BRANCH" where BRANCH is the name of the active branch . try visiting the file .git/refs/heads/BRANCH . if the file exists, its contents should be the SHA1 checksum we are looking for . otherwise: . visit the file .git/packed-refs, whose contents should be lines of the form "SHA1 REF" . find the line in that file whose REF part is "refs/heads/BRANCH" . the SHA1 part of that line is the checksum we are looking for Does this cover all the possible arrangements of the repository and all the possible workflows? Btw, I think the packed-refs part is unnecessary, since the active branch will never be packed -- is that right? Question: Can .git/HEAD specify a branch in refs/remotes/? If so, what do we do in the above algorithm? punt and return nil?