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

Re: [RFC/PATCH] clone: introduce clone.submoduleGitDir to relocate $GITDIR

From
Duy Nguyen <pclouds@gmail.com>
Date
Apr 15, 2013, 09:25 UTC
Message-ID
<CACsJy8Cx0QA_epns2WNWjBBSG6zpXVaTebybiTRuVt+OARupAg@mail.gmail.com>
In-Reply-To
<CALkWK0mvtRhFc0_4883ATNaYpb+kDwpV9VxeAoqJy5HxNQ6vgg@mail.gmail.com>

On Mon, Apr 15, 2013 at 6:19 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:

Show 10 quoted lines
> It doesn't make sense as a command-line option, because it is "magic"
> that kicks in only when git clone is executed inside an existing git
> worktree.  The point is that the user doesn't have to remember
> anything special: a normal git clone already does the right thing
> outside a git worktree; my proposal is to make it do the right thing
> inside a git worktree as well.  Although I'm not against allowing a
> user to create a "full clone" inside a git repository by overriding
> clone.submoduleGitDir via a command-line option, I really cannot see
> why this would be anything but rare.  Why would a user *want* a full
> clone inside a git worktree?

If a user is inside .git, I believe setup_git_directory() will also find correct gitdir. In that case, we do not want magic (i.e. only do your magic when you are inside worktree). Still I'd rather see no magic (i.e. command line option) first. Let people try it out for a while. If people like it and find it inconvenient, magic can come later. I suspect you might want more magic in other places. Maybe if you hold it back until you see full picture, you'll only need a few new config keys (instead of one per separate magic).

Show 13 quoted lines
>  Unfortunately, this patch is in pathetic shape and is an RFC for
>  three reasons:
>
>  1. I've used setup_git_directory_gently() at the start of
>     builtin/clone.c to check if I'm inside a git directory.  This
>     breaks a lot of existing tests (I'm yet to understand these
>     failures fully).
>
>  2. setup_git_directory_gently() has the side-effect of changing the
>     current directory and calling set_git_work_tree(), both of which
>     must be done away with if we want the rest of clone.c to work.
>     I've hacked around the issue in a very dirty manner.  What is the
>     solution to this?

Just do what scripts do: spawn a process to run rev-parse so that it does not mess up the main process. You might be able to introduce "dry-run" mode for setup_git_directory(), but that won't be easy. -- Duy

Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 9 of 41 in “clone: introduce clone.submoduleGitDir to relocate $GITDIR”
  1. clone: introduce clone.submoduleGitDir to relocate $GITDIRRamkumar Ramachandra, Apr 13, 2013
  2. Junio C HamanoApr 15, 2013
  3. Junio C HamanoApr 15, 2013
  4. Ramkumar RamachandraApr 15, 2013
  5. Junio C HamanoApr 15, 2013
  6. Ramkumar RamachandraApr 15, 2013
  7. Ramkumar RamachandraApr 15, 2013
  8. Ramkumar RamachandraApr 15, 2013
  9. Duy NguyenApr 15, 2013
  10. Ramkumar RamachandraApr 15, 2013
  11. Junio C HamanoApr 15, 2013
  12. Ramkumar RamachandraApr 15, 2013
  13. Marc BranchaudApr 15, 2013
  14. Junio C HamanoApr 15, 2013
  15. Ramkumar RamachandraApr 15, 2013
  16. Jeff KingApr 15, 2013
  17. Junio C HamanoApr 15, 2013
  18. Ramkumar RamachandraApr 16, 2013
  19. Marc BranchaudApr 16, 2013
  20. Marc BranchaudApr 15, 2013
  21. Ramkumar RamachandraApr 16, 2013
  22. Marc BranchaudApr 16, 2013
  23. Marc BranchaudApr 15, 2013
  24. Junio C HamanoApr 15, 2013
  25. Marc BranchaudApr 15, 2013
  26. Junio C HamanoApr 15, 2013
  27. Ramkumar RamachandraApr 16, 2013
  28. Marc BranchaudApr 16, 2013
  29. Ramkumar RamachandraApr 15, 2013
  30. Jonathan NiederApr 16, 2013
  31. Ramkumar RamachandraApr 16, 2013
  32. Junio C HamanoApr 16, 2013
  33. Jonathan NiederApr 17, 2013
  34. Duy NguyenApr 17, 2013
  35. Ramkumar RamachandraApr 17, 2013
  36. Duy NguyenApr 17, 2013
  37. Ramkumar RamachandraApr 17, 2013
  38. Duy NguyenApr 17, 2013
  39. Ramkumar RamachandraApr 17, 2013
  40. Duy NguyenApr 17, 2013
  41. Junio C HamanoApr 17, 2013

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.