quote_path: fix collapsing of relative paths
The code tries to collapse identical leading components between the prefix and the path. So if we're in "dir1", the path "dir1/file" should become just "file". However, we were ending up with "../dir1/file". The included test expected the wrong output. The "len" parameter to quote_path can be negative to mean "this is a NUL terminated string". Simply count it so that the loop can rely on it being the length of the path. Signed-off-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
Showing
想要评论请 注册 或 登录