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

Re: [PATCH] Add platform-independent .git "symlink"

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Feb 4, 2008, 22:08 UTC
Message-ID
<47A78CF9.6040001@nrlssc.navy.mil>
In-Reply-To
<alpine.LSU.1.00.0802042128170.8543@racer.site>
Johannes Schindelin wrote:
> Hi,
> 
> On Mon, 4 Feb 2008, Brandon Casey wrote:
> In my local version of git, you can say "git 
> branch --new-workdir=../bla new-branch [branch-point]".
Ah, I see, you are creating a new branch too.
>> Have you thought about using git-clone instead?
> 
> Briefly.  But this is not about cloning the repository.  It is about 
> having an additional working directory for the current repository.

I think that is true at the low level, but from a high level it feels similar to me.

After your "git branch --new-workdir=..." you have something that acts exactly like a full-fledged repository. It is very much dependent on the original repo, similarly to how a --shared repo is, and it now has new semantics in that operations within the new repo have an effect in the original repo (and vice-versa). Making new repositories from existing repositories is what git-clone does.

  git-branch: makes new branches, or generally handles modifying branches.
git-checkout: modifies the contents of the working directory.
   git-clone: makes new repositories from existing repositories.

Also, of the three, git-clone is the only one allowed to operate outside of the repo. The other two are required to be called from within a repo (or have GIT_DIR set), and currently only modify data within that repo. So, allowing them to have an effect outside of the repo would extend their current scope of operation.

Show 6 quoted lines
>> It seems a good fit but would require a new option to specify a branch 
>> to checkout (which I believe is a requested feature for clone).
> 
> It is an often-requested feature for clone, but we have "clone -n" for 
> now, and nobody seemed to care deeply enough to actually do something 
> about it.
I'll probably do it if it is not beyond me.
> I _want_ the original 
> repository to know that there is another working directory.

Yes, your ideas are much better than simply adding the functionality of the git-new-workdir script (which is what I was planning on doing btw :)

-brandon
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 13 of 29 in “Add platform-independent .git "symlink"”
  1. Add platform-independent .git "symlink"Lars Hjemli, Feb 2, 2008
  2. Add tests for .git fileLars Hjemli, Feb 2, 2008
  3. Johannes SchindelinFeb 2, 2008
  4. Lars HjemliFeb 2, 2008
  5. Add platform-independent .git "symlink"Lars Hjemli, Feb 2, 2008
  6. Johannes SchindelinFeb 2, 2008
  7. Johannes SchindelinFeb 2, 2008
  8. Shawn O. PearceFeb 4, 2008
  9. Junio C HamanoFeb 4, 2008
  10. Johannes SchindelinFeb 4, 2008
  11. Brandon CaseyFeb 4, 2008
  12. Johannes SchindelinFeb 4, 2008
  13. Brandon CaseyFeb 4, 2008
  14. Johannes SchindelinFeb 4, 2008
  15. Brandon CaseyFeb 4, 2008
  16. Brandon CaseyFeb 4, 2008
  17. Johannes SchindelinFeb 5, 2008
  18. Johannes SchindelinFeb 5, 2008
  19. Brandon CaseyFeb 5, 2008
  20. Johannes SchindelinFeb 5, 2008
  21. Lars HjemliFeb 2, 2008
  22. Johannes SchindelinFeb 3, 2008
  23. Junio C HamanoFeb 4, 2008
  24. Johannes SchindelinFeb 4, 2008
  25. Shawn O. PearceFeb 4, 2008
  26. Junio C HamanoFeb 4, 2008
  27. Shawn O. PearceFeb 4, 2008
  28. Lars HjemliFeb 4, 2008
  29. Johannes SchindelinFeb 4, 2008

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.