all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Shmakov <ivan@siamics.net>
To: emacs-devel@gnu.org
Subject: Re: Multiple checkout copies
Date: Tue, 03 Feb 2015 07:14:29 +0000	[thread overview]
Message-ID: <87k2zzh3fu.fsf@violet.siamics.net> (raw)
In-Reply-To: <E1YIS10-0000T1-IL@fencepost.gnu.org> (Richard Stallman's message of "Mon, 02 Feb 2015 20:10:54 -0500")

>>>>> Richard Stallman <rms@gnu.org> writes:

[…]

 >> 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 “bare” Git repository used only to mirror the
 >> upstream one, and thus it has no “local” 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’m 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 

	The repository so created can be updated with git-fetch(1):

$ GIT_DIR=~/public/download/git/example-2015.git \
      git fetch -t origin master:master 

	… Or without giving the branches explicitly, should
	example-2015.git/config contain an appropriate default, like:

[remote "origin"]
    url = git://example.org/jrh/example.git
    fetch = master:master example-42:example-42

	The working copies may now be created from this local repository
	(which git-clone(1) automatically aliases to ‘origin’)
	with --shared, and updated with the regular $ git pull command
	from there:

$ git clone --shared -- \
      ~/public/download/git/example-2015.git ~/devel/example-1 
$ git clone --shared -- \
      ~/public/download/git/example-2015.git ~/devel/example-2 
…
$ GIT_DIR=~/public/download/git/example-2015.git \
      git fetch -t origin master:master ## update the “bare” repository 
$ cd ~/devel/example-1 
$ git pull origin   ## update the working copy 

	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 “rewrite history” (at which point Git
	will require manual intervention), these commits won’t 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’m unsure
	that those of them which get incorporated upstream (and thus
	become available from example-2015.git) would be eligible for
	GC, but any “temporary” histories held within the individual
	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.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A



  reply	other threads:[~2015-02-03  7:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-01 20:34 Multiple checkout copies Richard Stallman
2015-02-01 21:43 ` Paul Eggert
2015-02-02 13:35   ` Richard Stallman
2015-02-02 15:19     ` Elias Mårtenson
2015-02-03  1:10       ` Richard Stallman
2015-02-03  1:32         ` Paul Eggert
2015-02-03  8:40         ` David Kastrup
2015-02-02 17:42     ` Ivan Shmakov
2015-02-02 18:12       ` Ivan Shmakov
2015-02-03  1:10       ` Richard Stallman
2015-02-03  7:14         ` Ivan Shmakov [this message]
2015-02-03 10:02         ` Achim Gratz
2015-02-03 10:22           ` David Kastrup
2015-02-03 12:53             ` Achim Gratz
2015-02-03 13:15               ` David Kastrup
2015-02-03 13:37                 ` Ivan Shmakov
2015-02-03 13:57                   ` David Kastrup
2015-02-03 18:30                     ` Ivan Shmakov
2015-02-03 18:53                       ` David Kastrup
2015-02-03 19:17                         ` Ivan Shmakov
2015-02-03 19:41                           ` David Kastrup
2015-02-03 20:25                             ` Ivan Shmakov
2015-02-04 23:02                             ` Richard Stallman
2015-02-03 17:46         ` Stefan Monnier
2015-02-03 16:50 ` Steinar Bang
2015-02-03 17:05   ` David Kastrup
2015-02-03 22:55     ` Steinar Bang
2015-02-03 23:05   ` Richard Stallman
2015-02-04  8:48     ` Achim Gratz
2015-02-04  8:55       ` David Kastrup
2015-02-04 12:02       ` Ivan Shmakov

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=87k2zzh3fu.fsf@violet.siamics.net \
    --to=ivan@siamics.net \
    --cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.