Skip to content

Support multiple worktrees

Nguyễn Thái Ngọc Duy git 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest21 patches 11 repliesIn review
  2. v17 patches 8 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21path.c: avoid PATH_MAX as buffer size from get_pathname()path.c+16 -123 replies
2/21path.c: rename vsnpath() to git_vsnpath()path.c+4 -47 replies
3/21path.c: move git_path() closer to similar functions git_pathdup()path.c+13 -130 replies
4/21Make git_path() aware of file relocation in $GIT_DIRcache.h environment.c path.c +2 more+123 -50 replies
5/21reflog: use avoid constructing .lock path with git_pathbuiltin/reflog.c+1 -10 replies
6/21fast-import: use git_path() for accessing .git dir instead of get_git_dir()fast-import.c+1 -40 replies
7/21Add new environment variable $GIT_SUPER_DIRDocumentation/git.txt cache.h environment.c +2 more+126 -20 replies
8/21setup.c: refactor path manipulation out of read_gitfile()setup.c+24 -200 replies
9/21setup.c: add split-repo support to .git filescache.h setup.c+38 -40 replies
10/21setup.c: add split-repo support to is_git_directory()setup.c+22 -60 replies
11/21setup.c: reduce cleanup sites in setup_explicit_git_dir()setup.c+8 -120 replies
12/21environment.c: support super .git file specified by $GIT_DIRenvironment.c+6 -20 replies
13/21setup: support $GIT_SUPER_DIR as well as super .git filesDocumentation/config.txt Documentation/gitrepository-layout.txt builtin/rev-parse.c +6 more+147 -270 replies
14/21checkout: support checking out into a new working directoryDocumentation/git-checkout.txt Documentation/gitrepository-layout.txt builtin/checkout.c +1 more+104 -20 replies
15/21checkout: clean up half-prepared directories in --to modebuiltin/checkout.c+47 -20 replies
16/21setup.c: keep track of the .git file location if readcache.h environment.c setup.c+32 -160 replies
17/21prune: strategies for split repositoriesDocumentation/git-prune.txt Documentation/gitrepository-layout.txt builtin/checkout.c +2 more+136 -10 replies
18/21refs: adjust reflog path for repos/<id>/HEADrefs.c+13 -20 replies
19/21refs: detach split repos' HEAD when the linked ref is updated/deletedrefs.c+37 -00 replies
20/21refs.c: refactor do_head_ref(... to do_one_head_ref("HEAD", ...refs.c+8 -70 replies
21/21revision: include repos/../HEAD in --allrefs.c refs.h revision.c+23 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/21] Support multiple worktrees

The UI and behavior are taking shape now. On the UI side, you do

  git checkout --to /somewhere -b newbranch origin/master

which will create worktree-only repo at /somewhere. "git prune --repos" could be used to remove cruft in .git/repos.

On the behavior side, you should be able to do everything in /somewhere just like in a normal repository. If a ref is updated (from any repository) that also happens to be your HEAD, it will be detached. "git rev-list --all" is also taught to take repos/.../HEAD into account.

The structure of repos/XXX is documented in 17/21. Known issues

- naming ($GIT_SUPER_DIR, the name of the shared repo and the dependent one, the reuse of "gitdir" in .git files)

- gc --auto support, support for manually pruning .git/repos

- should probably support the new .git format in enter_repo() so that we can push to it

- not sure if we need UI for deleting repositories created with checkout --to, or just "rm -r" and let "gc --auto" clean things up. The thing about "rm -r(f)" is that if .git happens to be a real repo, the user is screwed so I don't really like to encourage doing it.

- more tests

Nguyễn Thái Ngọc Duy (21):
path.c: avoid PATH_MAX as buffer size from get_pathname() path.c: rename vsnpath() to git_vsnpath()
path.c: move git_path() closer to similar functions git_pathdup() Make git_path() aware of file relocation in $GIT_DIR
reflog: use avoid constructing .lock path with git_path
fast-import: use git_path() for accessing .git dir instead of get_git_dir() Add new environment variable $GIT_SUPER_DIR
setup.c: refactor path manipulation out of read_gitfile() setup.c: add split-repo support to .git files
setup.c: add split-repo support to is_git_directory()
setup.c: reduce cleanup sites in setup_explicit_git_dir() environment.c: support super .git file specified by $GIT_DIR
setup: support $GIT_SUPER_DIR as well as super .git files
checkout: support checking out into a new working directory
checkout: clean up half-prepared directories in --to mode setup.c: keep track of the .git file location if read
prune: strategies for split repositories
refs: adjust reflog path for repos/<id>/HEAD
refs: detach split repos' HEAD when the linked ref is updated/deleted refs.c: refactor do_head_ref(... to do_one_ref("HEAD", ...
revision: include repos/../HEAD in --all

 Documentation/config.txt               |   3 +-
 Documentation/git-checkout.txt         |   6 +
 Documentation/git-prune.txt            |   4 +
 Documentation/git.txt                  |   8 ++
 Documentation/gitrepository-layout.txt |  30 ++++
 builtin/checkout.c                     | 173 ++++++++++++++++++++++
 builtin/prune.c                        |  65 +++++++++
 builtin/reflog.c                       |   2 +-
 builtin/rev-parse.c                    |   6 +
 cache.h                                |   5 +
 environment.c                          |  37 ++++-
 fast-import.c                          |   5 +-
 path.c                                 | 140 ++++++++++++++----
 refs.c                                 |  88 ++++++++++--
 refs.h                                 |   1 +
 revision.c                             |   1 +
 setup.c                                | 253 ++++++++++++++++++++++++---------
 t/t0060-path-utils.sh                  | 133 +++++++++++++++++
 t/t1501-worktree.sh                    |  52 +++++++
 t/t1510-repo-setup.sh                  |   1 +
 test-path-utils.c                      |   7 +
 trace.c                                |   1 +
 22 files changed, 904 insertions(+), 117 deletions(-)
Signature · 1 line
1.8.5.1.77.g42c48fa