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 28, 2014, 17:02 UTC
Message-ID
<xmqq8urucl3s.fsf@gitster.dls.corp.google.com>
In-Reply-To
<8030ADEA-B11F-47E8-AFE7-8F46E861F560@kellerfarm.com>
Andrew Keller <andrew@kellerfarm.com> writes:
Show 5 quoted lines
> Okay, so to re-frame my idea, like you said, the goal is to find a user-
> friendly way for the user to tell git-clone to set up the alternates file
> (or perhaps just use the --alternates parameter), and run a repack,
> and disconnect the alternate.  And yet, we still want to be able to use
> --reference on its own, because there are existing use cases for that.

Here are a few possible action items that came out of this discussion:

 1. Introduce a new "--borrow" option to "git clone".
    The updates to the SYNOPSIS section may go like this:
    -'git clone' [--reference <repository>] ...other options...
    +'git clone' [[--reference|--borrow] <repository>] ...other options...
    The new option can be used instead of "--reference" and they
    will be mutually incompatible.  The first implementation of the
    "--borrow" option would do the following:
      (1) run the same "git clone" with the same command line but
          replacing "--borrow" with "--reference"; if this fails, exit
          with the same failure.
      (2) in the resulting repository, run "git repack -a -d"; if this
          fails, remove the entire directory the first step created,
          and exit with failure.
      (3) remove .git/objects/info/alternates from the resulting
          repository and exit with success.
    and it may be acceptable as the final implementation as well.
 2. Make "git repack" safer for the users of "clone --reference" who
    want to keep sharing objects from the original.
    - Introduce the "repack.local" configuration variable that can
      be set to either true or false.  Missing variable defaults to
      "false".  
    - A "repack" that is run without "-l" option on the command line
      will pretend as if it was given "-l" from the command line if
      "repack.local" is set to "true".  Add "repack --no-local"
      option to countermand this configuration variable from the
      command line.
    - Teach "git clone --reference" (but not "git clone --borrow")
      to set "repack.local = true" in the configuration of the
      resulting repository.
Previous: Andrew Keller
Message 10 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.