From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.devel Subject: Re: Multiple checkout copies Date: Tue, 03 Feb 2015 07:14:29 +0000 Message-ID: <87k2zzh3fu.fsf@violet.siamics.net> References: <54CE9E10.5000709@cs.ucla.edu> <87sieogqgf.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1422947707 14220 80.91.229.3 (3 Feb 2015 07:15:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 Feb 2015 07:15:07 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 03 08:15:03 2015 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 1YIXhL-0005uS-FL for ged-emacs-devel@m.gmane.org; Tue, 03 Feb 2015 08:14:59 +0100 Original-Received: from localhost ([::1]:58007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIXhK-0003Wb-NG for ged-emacs-devel@m.gmane.org; Tue, 03 Feb 2015 02:14:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIXh5-0003WI-VV for emacs-devel@gnu.org; Tue, 03 Feb 2015 02:14:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIXh4-0000r9-Nw for emacs-devel@gnu.org; Tue, 03 Feb 2015 02:14:43 -0500 Original-Received: from fely.am-1.org ([2a01:4f8:d15:1b86::2]:37595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIXh4-0000pi-DJ for emacs-devel@gnu.org; Tue, 03 Feb 2015 02:14:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=MUfeetjYtlsB/file/pfo8NlSttCRXyaB9g1rM7frzU=; b=U3yrNcLKytAYBN7OA0WXKApQMGSpMYbhJIqixM694M3qeebL0eiwmYrOJ/B4bVbEwffvb1oCbAMbx2msRLtktDAPTGdXVPgXTb/zXsibzoBeMWFuYYmcEIaczGTHncRnAsb76STsjeELRy5oEcOmGLQO1dKMjUdHrXZtE986pX8=; Original-Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YIXgz-0007AJ-OD for emacs-devel@gnu.org; Tue, 03 Feb 2015 07:14:38 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YIXgs-000580-9P for emacs-devel@gnu.org; Tue, 03 Feb 2015 14:14:30 +0700 Mail-Followup-To: emacs-devel@gnu.org In-Reply-To: (Richard Stallman's message of "Mon, 02 Feb 2015 20:10:54 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a01:4f8:d15:1b86::2 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:182312 Archived-At: >>>>> Richard Stallman writes: [=E2=80=A6] >> Using --shared may be risky, as Git may choose to GC the dangling >> objects away from emacs-1, not taking into account the possibility >> of them being used in some other trees. In my case, the source >> directory is often a =E2=80=9Cbare=E2=80=9D Git repository used only to= mirror the >> upstream one, and thus it has no =E2=80=9Clocal=E2=80=9D commits, which= are somewhat >> likely to become dangling after rebases and such. > Maybe I could use it in that way, but is there no way to make two > working trees both checked out in parallel from the same repository? I=E2=80=99m unsure I understand the purpose. The problem is that a Git repository (as in: working-copy/.git) is not just the graph of its respective commits, but also the mapping of branch (and tag) names to commit identifiers. When a working copy is updated (say, via $ git pull), the respective branch name (.git/refs/heads/branchname) is also updated to point to the new head commit of the branch. And I doubt that sharing such a mapping among several working copies for the same branch would be sensible. The approach I use is roughly as follows. First, I create a local clone of the remote repository /without/ an associated working copy, like: $ git clone --bare -- \ git://example.org/jrh/example.git ~/public/download/git/example-2015.= git=20 The repository so created can be updated with git-fetch(1): $ GIT_DIR=3D~/public/download/git/example-2015.git \ git fetch -t origin master:master=20 =E2=80=A6 Or without giving the branches explicitly, should example-2015.git/config contain an appropriate default, like: [remote "origin"] url =3D git://example.org/jrh/example.git fetch =3D master:master example-42:example-42 The working copies may now be created from this local repository (which git-clone(1) automatically aliases to =E2=80=98origin=E2=80=99) with --shared, and updated with the regular $ git pull command from there: $ git clone --shared -- \ ~/public/download/git/example-2015.git ~/devel/example-1=20 $ git clone --shared -- \ ~/public/download/git/example-2015.git ~/devel/example-2=20 =E2=80=A6 $ GIT_DIR=3D~/public/download/git/example-2015.git \ git fetch -t origin master:master ## update the =E2=80=9Cbare=E2=80= =9D repository=20 $ cd ~/devel/example-1=20 $ git pull origin ## update the working copy=20 This way, the commits which made it to the upstream are always available from example-2015.git and get reused upon git-pull(1), thus saving both time and filesystem space. Furthermore, unless the upstream decides to =E2=80=9Crewrite history=E2=80=9D (at which point = Git will require manual intervention), these commits won=E2=80=99t be eligible to GC, thus eliminating the risks generally associated with --shared. The commits made locally to either of the working copies stay in that same working copy (unless explicitly copied.) I=E2=80=99m unsure that those of them which get incorporated upstream (and thus become available from example-2015.git) would be eligible for GC, but any =E2=80=9Ctemporary=E2=80=9D histories held within the individu= al example-N/.git (such as those left behind after a successful $ git rebase) surely would. The .git/refs/ mappings of these working copies are also entirely independent. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A