mbox series

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

Message ID 20191021160043.701-1-szeder.dev@gmail.com (mailing list archive)
Headers show
Series path.c: a couple of common dir/trie fixes | expand

Message

SZEDER Gábor Oct. 21, 2019, 4 p.m. UTC
On Fri, Oct 18, 2019 at 01:35:57PM +0200, SZEDER Gábor wrote:
> > 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.

> > 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(-)