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

Re: Borrowing objects from nearby repositories

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 25, 2014, 22:17 UTC
Message-ID
<xmqqvbv1kjoc.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqtxammctc.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 34 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>>> 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 -d
>
> And then you can try this:
>
>     $ mv .git/objects/info/alternates .git/objects/info/alternates.disabled
>     $ git fsck
>
> to 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.

Oh, I forgot to say that I am not opposed if somebody wants to teach "git clone" a new option to copy its objects from two places, (hopefully) the majority from near-by reference repository and the remainder over the network, without permanently relying on the former via the alternates mechanism. The implementation of such a feature could even literally be "clone with reference first and then repack" at least initially but even in the final version.

Previous: Junio C HamanoNext: Andrew Keller
Message 6 of 10 in “Borrowing objects from nearby repositories”
  1. Andrew KellerMar 12, 2014
  2. Phil HordMar 23, 2014
  3. Ævar Arnfjörð BjarmasonMar 24, 2014
  4. Andrew KellerMar 25, 2014
  5. Junio C HamanoMar 25, 2014
  6. Junio C HamanoMar 25, 2014
  7. Andrew KellerMar 26, 2014
  8. Junio C HamanoMar 26, 2014
  9. Andrew KellerMar 28, 2014
  10. Junio C HamanoMar 28, 2014

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.