git clone questions relating to cpio

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

git clone questions relating to cpio

From: Reece Dunn <hidden>
Date: 2016-06-15 22:43:37

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?

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?

Ideally, the hard linking for local clones should be optional. 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?

- Reece

Re: git clone questions relating to cpio

From: Johan Herland <hidden>
Date: 2016-06-15 22:43:37

On Monday 01 October 2007, Reece Dunn wrote:
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, [off-list ref]
www.herland.net

Re: git clone questions relating to cpio

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:43:37

Hi,

On Mon, 1 Oct 2007, Reece Dunn wrote:
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.
You might be interested in the workaround Hannes did in mingw.git; he made 
a wrapper script called 'cpio' using 'tar'.

Ciao,
Dscho

Re: git clone questions relating to cpio

From: Reece Dunn <hidden>
Date: 2016-06-15 22:43:38

On 01/10/2007, Johan Herland [off-list ref] wrote:
On Monday 01 October 2007, Reece Dunn wrote:
quoted
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.
Thanks for the tip.
However, grepping for cpio in the git source tree reveals a couple of uses
in git-merge, so you might bump into problems there...
Looks like I'll need to install cpio, then (also allowing me to take
advantage of the fast local clones via hardlinks).

Do you know if cpio is listed anywhere in required dependencies?
quoted
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.
Exactly. I was asking this to clarify cpio (and therefore git)
behaviour in this situation.
quoted
Ideally, the hard linking for local clones should be optional.
<quote src="git-clone(1)">...</quote>
Indeed, they are. Thanks for the info.
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.
Sure.
quoted
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.
That is good to know.
I also think it's fairly safe to just 'mv' the whole repository to its new
location.
This also works, as long as you are not moving between a bare and
standard repository.
Have fun! :)
Will do :)

Thanks,
- Reece

[PATCH] Mention 'cpio' dependency in INSTALL

From: Johan Herland <hidden>
Date: 2016-06-15 22:43:38

Signed-off-by: Johan Herland <redacted>
---

On Tuesday 02 October 2007, Reece Dunn wrote:
Do you know if cpio is listed anywhere in required dependencies?
Doing the following in the git repo:
$ grep -r cpio *
git-clone.sh:           find objects -depth -print | cpio -pumd$l "$GIT_DIR/" || exit 1
git-merge.sh:   cpio -0 -o >"$GIT_DIR/MERGE_SAVE"
git-merge.sh:           cpio -iuv <"$GIT_DIR/MERGE_SAVE"

reveals that cpio is not mentioned anywhere in the documentation,
nor in the requirements section of the INSTALL file.


Have fun!

...Johan


 INSTALL |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/INSTALL b/INSTALL
index 289b046..f1eb404 100644
--- a/INSTALL
+++ b/INSTALL
@@ -79,6 +79,9 @@ Issues of note:
 	- "perl" and POSIX-compliant shells are needed to use most of
 	  the barebone Porcelainish scripts.
 
+	- "cpio" is used by git-merge for saving and restoring the index,
+	  and by git-clone when doing a local (possibly hardlinked) clone.
+
  - Some platform specific issues are dealt with Makefile rules,
    but depending on your specific installation, you may not
    have all the libraries/tools needed, or you may have
-- 
1.5.3.3.1144.gf10f2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help