git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: is there a "symlink" option for cloning a repo in a separate filesystem?

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Sep 23, 2017, 18:55 UTC
Message-ID
<20170923185543.ithsgi3nvksp5uos@genre.crustytoothpaste.net>
In-Reply-To
<alpine.LFD.2.21.1709230418340.22644@localhost.localdomain>
On Sat, Sep 23, 2017 at 04:22:32AM -0400, Robert P. J. Day wrote:
Show 14 quoted lines
> 
>   reading "man git-clone", and i understand the mechanics of the local
> protocol, so that if i run:
> 
>   $ git clone /path/to/repo
> 
> then "files under .git/objects/ directory are hardlinked to save space
> when possible."
> 
>   but if the repo is in a separate filesystem, or on an NFS mount,
> hardlinks clearly won't work, so what happens then? does it default
> all the way back to regular copies? is there no intermediate symlink
> feature that would still work? (i suspect i am far from the first
> person to wonder this.)

I believe the current behavior is to make a copy. However, if the source repo is reasonably well packed, you won't be copying that many files anyway. You can always run git gc in the source repo to speed up that process if you're going to be making many clones.

As Torsten pointed out, --reference is available. If your source repository is ephemeral (or otherwise won't last as long the destination repository), then you won't want to use that option, as you'll lose data. The --shared option documents all the sharp edges.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204
Previous: Torsten BögershausenNext: Junio C Hamano
Message 3 of 4 in “is there a "symlink" option for cloning a repo in a separate filesystem?”
  1. Robert P. J. DaySep 23, 2017
  2. Torsten BögershausenSep 23, 2017
  3. brian m. carlsonSep 23, 2017
  4. Junio C HamanoSep 24, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.