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

Re: [PATCH] submodule--helper: set alternateLocation for cloned submodules

From
vi0oss <vi0oss@gmail.com>
Date
Dec 7, 2016, 21:24 UTC
Message-ID
<9493435c-16e5-d8af-9455-ec3f3cba390d@gmail.com>
In-Reply-To
<CAGZ79kY3LR2KA69b4iDJb164EhJLb3JuVSRRcN0-4-kp-eryog@mail.gmail.com>
On 12/07/2016 11:09 PM, Stefan Beller wrote:
Show 9 quoted lines
>> As submodule's alternate target does not end in .git/objects
>> (rather .git/modules/qqqqqq/objects), this alternate target
>> path restriction for in add_possible_reference_from_superproject
>> relates from "*.git/objects" to just */objects".
> I wonder if this check is too weak and we actually have to check for
> either .git/objects or modules/<name/possibly/having/slashes>/objects.
> When writing the referenced commit I assumed we'd need a stronger check
> to be safer and not add some random location as a possible alternate.
>
1. Do we really need to check that it is named ".git"? Although
"git clone --mirror --recursive" is not (directly) supported
now, user may create one bare repository with [remnants of]
submodules by converting reqular repository into bare one.
Why not take advantage of additional information available locally
in this case?
2. Is the check need to be strict because of we need to traverse
one directory level up? Normally this "/objects" part is added by
Git, so just one "../" seems to be OK. User can't specify "--reference
somerepo/.git/objects", a strange reference can appear only if user
manually creates alternates. Maybe better to document this case
instead of restricting the feature?
3. If nonetheless check for ".git/*/objects", then
a. What functions should be used in Git codebase for such checks?
b. Should we handle tricks like "smth/.git/../../objects" and so on?
4. Should we print (or print in verbose mode) each used alternate,
to inform operator what his or her new clone will depend on?

P.S. Actually I discovered the --recursive --reference feature when tried to put reference to a mega-repo with all possible submodules added as remotes. I expected --reference to just get though across all submodules, but it complained to missing "/modules/..." instead (the check went though becase the repository was named like "megarepo.git", so it did ended in ".git/objects").

Previous: Junio C HamanoNext: Stefan Beller
Message 6 of 7 in “submodule--helper: set alternateLocation for cloned submodules”
  1. submodule--helper: set alternateLocation for cloned submodulesvi0oss@gmail.com, Dec 7, 2016
  2. Stefan BellerDec 7, 2016
  3. Junio C HamanoDec 7, 2016
  4. Stefan BellerDec 7, 2016
  5. Junio C HamanoDec 7, 2016
  6. vi0ossDec 7, 2016
  7. Stefan BellerDec 7, 2016

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.