diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-03-07 19:29:17 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-08 11:57:47 +0900 |
commit | b9317d55a37f93c47d48f12a7b3e45a71434d0e7 (patch) | |
tree | 42b04d1a12063ffa4d3065c86c73c92033b4e007 /refs | |
parent | files-backend.c: reduce duplication in add_per_worktree_entries_to_dir() (diff) | |
download | tgif-b9317d55a37f93c47d48f12a7b3e45a71434d0e7.tar.xz |
Make sure refs/rewritten/ is per-worktree
a9be29c981 (sequencer: make refs generated by the `label` command
worktree-local, 2018-04-25) adds refs/rewritten/ as per-worktree
reference space. Unfortunately (my bad) there are a couple places that
need update to make sure it's really per-worktree.
- add_per_worktree_entries_to_dir() is updated to make sure ref listing
look at per-worktree refs/rewritten/ instead of per-repo one [1]
- common_list[] is updated so that git_path() returns the correct
location. This includes "rev-parse --git-path".
This mess is created by me. I started trying to fix it with the
introduction of refs/worktree, where all refs will be per-worktree
without special treatments. Unfortunate refs/rewritten came before
refs/worktree so this is all we can do.
This also fixes logs/refs/worktree not being per-worktree.
[1] note that ref listing still works sometimes. For example, if you
have .git/worktrees/foo/refs/rewritten/bar AND the directory
.git/worktrees/refs/rewritten, refs/rewritten/bar will show up.
add_per_worktree_entries_to_dir() is only needed when the directory
.git/worktrees/refs/rewritten is missing.
Reported-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs')
-rw-r--r-- | refs/files-backend.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c index cb92677151..3daf8e6dd0 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -214,13 +214,13 @@ static void files_ref_path(struct files_ref_store *refs, } /* - * Manually add refs/bisect and refs/worktree, which, being + * Manually add refs/bisect, refs/rewritten and refs/worktree, which, being * per-worktree, might not appear in the directory listing for * refs/ in the main repo. */ static void add_per_worktree_entries_to_dir(struct ref_dir *dir, const char *dirname) { - const char *prefixes[] = { "refs/bisect/", "refs/worktree/" }; + const char *prefixes[] = { "refs/bisect/", "refs/worktree/", "refs/rewritten/" }; int ip; if (strcmp(dirname, "refs/")) |