From: Nguyễn Thái Ngọc Duy Date: Sat, 20 Nov 2010 06:50:51 +0000 (+0700) Subject: get_cwd_relative(): do not misinterpret root path X-Git-Tag: v1.7.4-rc0~36^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/fbbb4e19bee8c4d62f274f9e07b91c45e4df838c?hp=fbbb4e19bee8c4d62f274f9e07b91c45e4df838c get_cwd_relative(): do not misinterpret root path Commit 490544b (get_cwd_relative(): do not misinterpret suffix as subdirectory) handles case where: dir = "/path/work"; cwd = "/path/work-xyz"; When it comes to the end of get_cwd_relative(), dir is at '\0' and cwd is at '-'. The rest of cwd, "-xyz", clearly cannot be the relative path from dir to cwd. However there is another case where: dir = "/"; /* or even "c:/" */ cwd = "/path/to/here"; In this special case, while *cwd == 'p', which is not a path separator, the rest of cwd, "path/to/here", can be returned as a relative path from dir to cwd. Handle this case and make t1509 pass again. Reported-by: Albert Strasheim Reported-by: Matthijs Kooijman Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano ---