Re: [PATCH v3 03/12] dir: fix off-by-one error in match_pathspec_item

2019-09-13 Thread Junio C Hamano
Elijah Newren writes: > For a pathspec like 'foo/bar' comparing against a path named "foo/", > namelen will be 4, and match[namelen] will be 'b'. The correct location > of the directory separator is namelen-1. And the reason why name[namelen-1] may not be slash, in which case your new code make

[PATCH v3 03/12] dir: fix off-by-one error in match_pathspec_item

2019-09-12 Thread Elijah Newren
For a pathspec like 'foo/bar' comparing against a path named "foo/", namelen will be 4, and match[namelen] will be 'b'. The correct location of the directory separator is namelen-1. The reason the code worked anyway was that the following code immediately checked whether the first matchlen charac