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

Re: [PATCH] Submodules always use a relative path to gitdir

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 3, 2012, 18:27 UTC
Message-ID
<7vsjjwvdyl.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4F007492.8010909@web.de>
Jens Lehmann <Jens.Lehmann@web.de> writes:
Show 12 quoted lines
> Am 29.12.2011 23:40, schrieb Junio C Hamano:
>> Antony Male <antony.male@gmail.com> writes:
>> I further wonder if we can get away without using separate-git-dir option
>> in this codepath, though. IOW using
>> 
>>         git clone $quiet -bare ${reference:+"$reference"} "$url" "$gitdir"
>> 
>> might be a better solution.
>
> A quick test shows that using a bare repo won't fly because without the
> core.worktree setting commands that operate on the work tree can't be
> run anymore inside submodules (starting with the initial checkout). 

Probably the right thing to do would be to restructure the flow as I suggested, i.e.

	if we do not have it yet
        then
        	git clone --bare ...
	fi
	# now we have it, make sure they are correct
	git config core.bare false
	git config core.worktree $there
        echo "gitdir: $here" >$there/.git
> Yes, and the core.worktree setting also contains an absolute path. So
> we must either make that relative too and rewrite it on every "git
> submodule add" to record the possibly changed path there or make the
> bare clone work with a work tree (which sounds a bit strange ;-).

Update of core.worktree has to be done regardless of the absolute/relative differences anyway, no?

The first version of the superproject you trigger module_clone for submodule $name may happen to have it at $path, module_clone notices that you do not have it, and the initial "clone --separate-git-dir" will set the core.worktree to $superproject/$path. Nobody will update it after that, even when we check out different version of superproject that has the same submodule $name at a different location in the superproject.

Previous: Jens LehmannNext: Jens Lehmann
Message 7 of 16 in “Submodules always use a relative path to gitdir”
  1. Submodules always use a relative path to gitdirAntony Male, Dec 29, 2011
  2. Junio C HamanoDec 29, 2011
  3. Phil HordDec 31, 2011
  4. Junio C HamanoJan 3, 2012
  5. Junio C HamanoJan 3, 2012
  6. Jens LehmannJan 1, 2012
  7. Junio C HamanoJan 3, 2012
  8. Jens LehmannJan 3, 2012
  9. Junio C HamanoJan 3, 2012
  10. Jens LehmannJan 5, 2012
  11. Junio C HamanoJan 6, 2012
  12. Phil HordJan 6, 2012
  13. Nguyen Thai Ngoc DuyJan 6, 2012
  14. Junio C HamanoJan 6, 2012
  15. Fredrik GustafssonDec 29, 2011
  16. Phil HordDec 31, 2011

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.