From: Junio C Hamano Date: Tue, 13 Nov 2018 13:37:26 +0000 (+0900) Subject: Merge branch 'nd/per-worktree-ref-iteration' X-Git-Tag: v2.20.0-rc0~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e146cc97be4c054c60d38e9f4edcdc33205bf563;p=thirdparty%2Fgit.git Merge branch 'nd/per-worktree-ref-iteration' The code to traverse objects for reachability, used to decide what objects are unreferenced and expendable, have been taught to also consider per-worktree refs of other worktrees as starting points to prevent data loss. * nd/per-worktree-ref-iteration: git-worktree.txt: correct linkgit command name reflog expire: cover reflog from all worktrees fsck: check HEAD and reflog from other worktrees fsck: move fsck_head_link() to get_default_heads() to avoid some globals revision.c: better error reporting on ref from different worktrees revision.c: correct a parameter name refs: new ref types to make per-worktree refs visible to all worktrees Add a place for (not) sharing stuff between worktrees refs.c: indent with tabs, not spaces --- e146cc97be4c054c60d38e9f4edcdc33205bf563 diff --cc Documentation/git-worktree.txt index 5e986ce8aa,69d55f1350..cb86318f3e --- a/Documentation/git-worktree.txt +++ b/Documentation/git-worktree.txt @@@ -204,36 -204,35 +204,65 @@@ working trees, it can be used to identi you only have two working trees, at "/abc/def/ghi" and "/abc/def/ggg", then "ghi" or "def/ghi" is enough to point to the former working tree. + REFS + ---- + In multiple working trees, some refs may be shared between all working + trees, some refs are local. One example is HEAD is different for all + working trees. This section is about the sharing rules and how to access + refs of one working tree from another. + + In general, all pseudo refs are per working tree and all refs starting + with "refs/" are shared. Pseudo refs are ones like HEAD which are + directly under GIT_DIR instead of inside GIT_DIR/refs. There are one + exception to this: refs inside refs/bisect and refs/worktree is not + shared. + + Refs that are per working tree can still be accessed from another + working tree via two special paths, main-worktree and worktrees. The + former gives access to per-worktree refs of the main working tree, + while the latter to all linked working trees. + + For example, main-worktree/HEAD or main-worktree/refs/bisect/good + resolve to the same value as the main working tree's HEAD and + refs/bisect/good respectively. Similarly, worktrees/foo/HEAD or + worktrees/bar/refs/bisect/bad are the same as + GIT_COMMON_DIR/worktrees/foo/HEAD and + GIT_COMMON_DIR/worktrees/bar/refs/bisect/bad. + + To access refs, it's best not to look inside GIT_DIR directly. Instead + use commands such as linkgit:git-rev-parse[1] or linkgit:git-update-ref[1] + which will handle refs correctly. + +CONFIGURATION FILE +------------------ +By default, the repository "config" file is shared across all working +trees. If the config variables `core.bare` or `core.worktree` are +already present in the config file, they will be applied to the main +working trees only. + +In order to have configuration specific to working trees, you can turn +on "worktreeConfig" extension, e.g.: + +------------ +$ git config extensions.worktreeConfig true +------------ + +In this mode, specific configuration stays in the path pointed by `git +rev-parse --git-path config.worktree`. You can add or update +configuration in this file with `git config --worktree`. Older Git +versions will refuse to access repositories with this extension. + +Note that in this file, the exception for `core.bare` and `core.worktree` +is gone. If you have them in $GIT_DIR/config before, you must move +them to the `config.worktree` of the main working tree. You may also +take this opportunity to review and move other configuration that you +do not want to share to all working trees: + + - `core.worktree` and `core.bare` should never be shared + + - `core.sparseCheckout` is recommended per working tree, unless you + are sure you always use sparse checkout for all working trees. + DETAILS ------- Each linked working tree has a private sub-directory in the repository's