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

Re: Setting file timestamps to commit time (git-checkout)

From
Duy Nguyen <pclouds@gmail.com>
Date
Dec 10, 2013, 10:34 UTC
Message-ID
<CACsJy8Bsgfh=0mTHY4kFAXE6+y7ODx5AwVHcLzVgz01Biiy=7A@mail.gmail.com>
In-Reply-To
<20131210084622.GC4087@linux.vnet.ibm.com>
On Tue, Dec 10, 2013 at 3:46 PM, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
Show 13 quoted lines
>
> > I suspect the simplest way to accomplish what you're looking for would
> > be to keep separate worktrees for each branch you regularly build.
> > It's possible to do that using entirely independent clones, clones
> > sharing some objects (using "git clone --shared" from some master
> > copy), or even multiple worktrees for the same clone (using the
> > git-new-workdir script from contrib/workdir/).
>
> I've tried the first two ways for separate workdirs in the past
> but did not like them.  How does git-new-workdir cope with
> rebasing (e.g. you have the same branch checked out in two working
> trees and "rebase -i" it in one of them)?  Is it really a working
> option?

I wonder if we could promote multiple worktree from a hack to a supported feature. What I have in mind is when you "clone --separate-worktree" it would create a .git file that describes separate worktree:

gitbasedir: /path/to/the/original/.git name: foo

HEAD, index and logs/HEAD would be stored in /path/to/the/original/.git/worktrees/foo/. GIT_DIR would be set to .../foo/, GIT_OBJECT_DIRECTORY, the new GIT_REF_DIRECTORY (which covers root for all refs/, logs/ and packed-refs) and maybe GIT_HOOKS_DIRECTORY are pointed to directories in .../original/.git/... though.

This allows all worktrees to be aware of the others and locking could be implemented so that no two worktrees check out the same branch (or they can, but the other becomes detached if the ref is updated in this worktree)..

-- 
Duy
Previous: Dominik VogtNext: Jonathan Nieder
Message 9 of 11 in “Setting file timestamps to commit time (git-checkout)”
  1. Dominik VogtDec 9, 2013
  2. Junio C HamanoDec 9, 2013
  3. Dominik VogtDec 10, 2013
  4. Andreas SchwabDec 10, 2013
  5. Dominik VogtDec 11, 2013
  6. Constantine A. MureninDec 11, 2013
  7. Jonathan NiederDec 9, 2013
  8. Dominik VogtDec 10, 2013
  9. Duy NguyenDec 10, 2013
  10. Jonathan NiederDec 11, 2013
  11. Jonathan NiederDec 11, 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.