Re: Borrowing objects from nearby repositories
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 25, 2014, 17:02 UTC
- Message-ID
- <xmqqtxammctc.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CACBZZX5teZuqtNkPT4PdXJn=g34cOhRH2oNehROT8kJ_M2cgfg@mail.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 16 quoted lines
>> 1) Introduce '--borrow' to `git-fetch`. This would behave similarly > to '--reference', except that it operates on a temporary basis, and > does not assume that the reference repository will exist after the > operation completes, so any used objects are copied into the local > objects database. In theory, this mechanism would be distinct from > --reference', so if both are used, some objects would be copied, and > some objects would be accessible via a reference repository referenced > by the alternates file. > > Isn't this the same as git clone --reference <path> --no-hardlinks > <url> ? > > Also without --no-hardlinks we're not assuming that the other repo > doesn't go away (you could rm-rf it), just that the files won't be > *modified*, which Git won't do, but you could manually do with other > tools, so the default is to hardlink.
I think that the standard practice with the existing toolset is to clone with reference and then repack. That is:
$ git clone --reference <borrowee> git://over/there mine
$ cd mine
$ git repack -a -dAnd then you can try this:
$ mv .git/objects/info/alternates .git/objects/info/alternates.disabled
$ git fsckto make sure that you are no longer borrowing anything from the borrowee. Once you are satisfied, you can remove the saved-away alternates.disabled file.