Skip to content

path.c: a couple of common dir/trie fixes

SZEDER Gábor git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5Documentation: mention more worktree-specific exceptionsDocumentation/gitrepository-layout.txt+5 -50 replies
2/5path.c: clarify trie_find()'s in-code commentpath.c+28 -170 replies
3/5path.c: mark 'logs/HEAD' in 'common_list' as filepath.c+1 -10 replies
4/5path.c: clarify two field names in 'struct common_dir'path.c+33 -330 replies
5/5path.c: don't call the match function without value in trie_find()path.c t/t0060-path-utils.sh+8 -58 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/5] path.c: a couple of common dir/trie fixes
Quoted 1 line · SZEDER Gábor
Quoted 1 line

unfortunately, see two more bugs,

And there are documentation bugs as well, both user-visible (i.e. in a man page) and in in-code comment.

Quoted 21 lines
Quoted 6 lines

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/
path.c +0 -0
index 04b69b9feb..9019169418 100644

path.c static int check_common(const char *unmatched, void *value, void *baton) · line 341

Quoted 8 lines
path.c +1 -1
@@ -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;

Now I made up mind: this isn't the right fix :) The proper fix is in the last patch of this series.

Cc-ing David Turner, the trie's author; if I misunderstood anything, then hopefully he can spot and clarify it.

SZEDER Gábor (5):
Documentation: mention more worktree-specific exceptions path.c: clarify trie_find()'s in-code comment
path.c: mark 'logs/HEAD' in 'common_list' as file path.c: clarify two field names in 'struct common_dir' path.c: don't call the match function without value in trie_find()

 Documentation/gitrepository-layout.txt |  10 +-
 path.c                                 | 122 ++++++++++++++-----------
 t/t0060-path-utils.sh                  |   2 +
 3 files changed, 74 insertions(+), 60 deletions(-)
Signature · 1 line
2.24.0.rc0.472.ga6f06c86b4