On Fri, Oct 18, 2019 at 01:06:18PM +0200, SZEDER Gábor wrote: > > > On a related note, I'm not sure whether the path of the reflogs > > > directory is right while in a different working tree... Both with and > > > without this patch I get a path pointing to the main working tree: > > > > > > $ ./git -C WT/ rev-parse --git-path logs > > > /home/szeder/src/git/.git/logs > > > > > > However, I'm not sure what the right path should be in the first > > > place, given that each working tree has its own 'logs' directory, but > > > only for HEAD's reflog, while everything else goes to the main working > > > tree's 'logs' directory. > > > > It's like Junio said, the reflog for `HEAD` is special because `HEAD` is > > special. Look for `common_list` in `path.c` (it is a bit confusing, I > > admit, you have to look for the 3rd column of numbers: if it is a `1`, > > then it is a worktree-specific path, if it is `0`, it is supposed to > > live in the "commondir", i.e. in the gitdir of the main worktree). > > OK, got it. > > I didn't look yesterday at all, but now I did, and, unfortunately, see > two more bugs, and one of them is a "proper" bug leading to bogus > output: > > $ git -C WT/ rev-parse --git-path logs/refs --git-path logs/refs/ > /home/szeder/src/git/.git/logs/refs > /home/szeder/src/git/.git/worktrees/WT/logs/refs/ This one-liner below fixes it, but I haven't yet made up my mind about whether this is the right fix or whether there could be any fallout (at least the test suite doesn't show any). $ ./git -C WT/ rev-parse --git-path logs/refs --git-path logs/refs/ /home/szeder/src/git/.git/logs/refs /home/szeder/src/git/.git/logs/refs/ diff --git a/path.c b/path.c index 04b69b9feb..9019169418 100644 --- a/path.c +++ b/path.c @@ -335,7 +335,7 @@ static int check_common(const char *unmatched, void *value, void *baton) struct common_dir *dir = value; if (!dir) - return 0; + return -1; if (dir->is_dir && (unmatched[0] == 0 || unmatched[0] == '/')) return !dir->exclude;