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

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

From
Stefan Beller <sbeller@google.com>
Date
Dec 7, 2016, 22:09 UTC
Message-ID
<CAGZ79kYuNri2aVtvRESxA9=E5OuBBqVkU_TcekxdyNJobFn5Mg@mail.gmail.com>
In-Reply-To
<9493435c-16e5-d8af-9455-ec3f3cba390d@gmail.com>
On Wed, Dec 7, 2016 at 1:24 PM, vi0oss <vi0oss@gmail.com> wrote:
Show 18 quoted lines
> On 12/07/2016 11:09 PM, Stefan Beller wrote:
>>>
>>> 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?
Oh, great point.
Show 7 quoted lines
>
> 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?
Not sure I understand what needs better documentation here?
>
> 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?
I see we're getting into problems here.
Show 11 quoted lines
>
> 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").
Oh :(
With that said, I think the original patch is a sensible approach.

Thanks, Stefan

Previous: vi0oss
Message 7 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.