Prefix is the result of Git moving back from current directory to
worktree's top directory and it has to prepend all user provided paths
so that they become relative to the new current directory. Any
wildcards in the prefix should not be treated as such because it's not
the user intention. Make sure all wildcards in the prefix part is

Signed-off-by: Nguyễn Thái Ngọc Duy <>
 setup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/setup.c b/setup.c
index 4fcdae6..573ef79 100644
--- a/setup.c
+++ b/setup.c
@@ -250,6 +250,8 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
        *raw = item->match;
        item->len = strlen(item->match);
        item->nowildcard_len = simple_length(item->match);
+       if (item->nowildcard_len < prefixlen)
+               item->nowildcard_len = prefixlen;
        return magic;

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to