Code

Revert removal of multi-match discard heuristic in 27af01
[git.git] / abspath.c
index 01858eb7bca277a125c414ef4bf1904fd0ea9059..37287f86c18f8b532feb38b5c70541c8cb3d3a44 100644 (file)
--- a/abspath.c
+++ b/abspath.c
@@ -102,7 +102,8 @@ static const char *get_pwd_cwd(void)
        pwd = getenv("PWD");
        if (pwd && strcmp(pwd, cwd)) {
                stat(cwd, &cwd_stat);
-               if (!stat(pwd, &pwd_stat) &&
+               if ((cwd_stat.st_dev || cwd_stat.st_ino) &&
+                   !stat(pwd, &pwd_stat) &&
                    pwd_stat.st_dev == cwd_stat.st_dev &&
                    pwd_stat.st_ino == cwd_stat.st_ino) {
                        strlcpy(cwd, pwd, PATH_MAX);