Code

quote_path: fix collapsing of relative paths
authorJeff King <peff@peff.net>
Mon, 3 Dec 2007 05:30:01 +0000 (00:30 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Dec 2007 07:35:46 +0000 (23:35 -0800)
commit69e7491835a0aa4e1a793a7c131783d8bb1cbb2b
treecfa2dbbec33eb2cfb6a2c0778e17d7b7089bcba4
parent2f02b25f36bce23e6b65c5112876796a56e084ca
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: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7502-status.sh
wt-status.c