From: Junio C Hamano <junkio@cox.net>
To: Johannes Sixt <johannes.sixt@telecom.at>
Cc: git@vger.kernel.org
Subject: Re: Is cp -al safe with git?
Date: Thu, 16 Nov 2006 11:19:57 -0800 [thread overview]
Message-ID: <7v7ixv9p2a.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <ejibnp$mmq$1@sea.gmane.org> (Johannes Sixt's message of "Thu, 16 Nov 2006 19:47:20 +0100")
Johannes Sixt <johannes.sixt@telecom.at> writes:
> For one reason or another I would like to "clone" a local repo including the
> checked-out working tree with cp -al instead of cg-clone/git-clone, i.e.
> have all files hard-linked instead of copied.
>
> Can the copies be worked on independently without interference (with the git
> tool set)?
>
> One thing I noticed is that git-reset or probably git-checkout-index breaks
> links of files that need not be changed by the reset. Example:
>
> # make 2 files, commit
> $ mkdir orig && cd orig
> $ git-init-db
> defaulting to local storage area
> $ echo foo > a && cp a b && git-add a b && git-commit -a -m 1
> Committing initial tree 99b876dbe094cb7d3850f1abe12b4c5426bb63ea
>
> # 2nd commit modifies only one file:
> $ echo bar > a && git-commit -a -m 2
>
> # create the copy:
> $ cd ..
> $ cp -al orig copy
> $ cd copy
>
> # working files are hard-linked:
> $ ls -l
> total 8
> -rw-r--r-- 2 jsixt users 4 Nov 16 19:24 a
> -rw-r--r-- 2 jsixt users 4 Nov 16 19:23 b
>
> # nuke a commit:
> $ git-reset --hard HEAD^
> $ ls -l
> total 8
> -rw-r--r-- 1 jsixt users 4 Nov 16 19:24 a
> -rw-r--r-- 1 jsixt users 4 Nov 16 19:24 b
>
> I'd have expected that the hard-link of b remained and only a's link were
> broken. Does it mean that git-reset writes every single file also for large
> trees like the kernel? I cannot believe this. Can someone scratch the
> tomatoes off my eyes please?
Most likely you didn't run "update-index --refresh" after "cp -l"?
Not just in the new copied repository but in the original
repository I would suspect you would see this. This is because
the index caches ctime and making a new hardlink manipulates the
files' inodes, thus making the cached information stale.
prev parent reply other threads:[~2006-11-16 19:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-16 18:47 Is cp -al safe with git? Johannes Sixt
2006-11-16 19:19 ` Linus Torvalds
2006-11-16 19:19 ` Junio C Hamano [this message]
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=7v7ixv9p2a.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=johannes.sixt@telecom.at \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox