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

Re: git clone questions relating to cpio

From
Johan Herland <johan@herland.net>
Date
Oct 1, 2007, 21:42 UTC
Message-ID
<200710012342.37352.johan@herland.net>
In-Reply-To
<3f4fd2640710011228w61ce34b5ve47ea529eed384fd@mail.gmail.com>
On Monday 01 October 2007, Reece Dunn wrote:
Show 7 quoted lines
> Hi,
> 
> I am running a Linux From Scratch 6.2 system that does not have cpio
> installed on it. This means that I can't clone a local repository
> unless I install cpio. Is it possible to use a fallback method if cpio
> is not present, as there is no NO_CPIO option on make like there is
> for OpenSSH, cURL and expat?

Using "file://" when specifying the source repo will force git-clone to use the git protocol, instead of doing a copy/hardlink.

I.e. change "git clone foo bar" to "git clone file://foo bar" in order to prevent git-clone from calling cpio.

However, grepping for cpio in the git source tree reveals a couple of uses in git-merge, so you might bump into problems there...

> Also, I have an external USB hardrive that is mounted onto the virtual
> filesystem. Will clones from the USB harddrive (or a USB flash drive
> that is mounted) result in a copy being performed, not a hardlink?

Hardlinks are impossible across filesystems. If you're cloning to a different filesystem git will _have_ to make a full copy.

> Ideally, the hard linking for local clones should be optional.

<quote src="git-clone(1)"> --local, -l

  When the repository to clone from is on a local machine, this flag 
bypasses normal "git aware" transport mechanism and clones the repository 
by making a copy of HEAD and everything under objects and refs directories. 
The files under .git/objects/ directory are hardlinked to save space when 
possible. This is now the default when the source repository is specified 
with /path/to/repo syntax, so it essentially is a no-op option. To force 
copying instead of hardlinking (which may be desirable if you are trying to 
make a back-up of your repository), but still avoid the usual "git aware" 
transport mechanism, --no-hardlinks can be used.
--no-hardlinks
  Optimize the cloning process from a repository on a local filesystem by 
copying files under .git/objects directory.
</quote>

And as I said above, you can use "file://" to force the "git aware" transport mechanism, which bypasses the whole local copy/hardlink issue entirely.

> What if I want to move a repository because, for example, I have imported
> a CVS repository and now want to push it to a new bare repository?

Even if you were to use hardlinks, cloning a repo followed by deleting the original will be safe (as long as you don't supply '--shared' to git-clone). That's the beauty of hardlinks.

I also think it's fairly safe to just 'mv' the whole repository to its new location.

Have fun! :)
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Reece DunnNext: Reece Dunn
Message 2 of 14 in “git clone questions relating to cpio”
  1. Reece DunnOct 1, 2007
  2. Johan HerlandOct 1, 2007
  3. Reece DunnOct 2, 2007
  4. Mention 'cpio' dependency in INSTALLJohan Herland, Oct 2, 2007
  5. Junio C HamanoOct 3, 2007
  6. Chris LarsonOct 3, 2007
  7. Miklos VajnaOct 3, 2007
  8. INSTALL: Update section on external dependenciesJohan Herland, Oct 3, 2007
  9. Johannes SchindelinOct 3, 2007
  10. Shawn O. PearceOct 3, 2007
  11. Johannes SchindelinOct 1, 2007
  12. Junio C HamanoOct 1, 2007
  13. Johannes SixtOct 2, 2007
  14. Junio C HamanoOct 2, 2007

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.