Thread (34 messages) 34 messages, 4 authors, 2019-10-28
STALE2450d

[PATCH 0/5] path.c: a couple of common dir/trie fixes

From: SZEDER Gábor <hidden>
Date: 2019-10-21 16:01:01

On Fri, Oct 18, 2019 at 01:35:57PM +0200, SZEDER Gábor wrote:
quoted
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 hunk ↗ jump to hunk
quoted
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;
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(-)

-- 
2.24.0.rc0.472.ga6f06c86b4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help