setup_traverse_info(): stop copying oid
[gitweb.git] / worktree.c
index 4f66cd9ce178d855245712b42d681ff8bcda0636..5b4793caa34e3ab981268662efdc1d840ac53390 100644 (file)
@@ -228,9 +228,12 @@ struct worktree *find_worktree(struct worktree **list,
                free(to_free);
                return NULL;
        }
-       for (; *list; list++)
-               if (!fspathcmp(path, real_path((*list)->path)))
+       for (; *list; list++) {
+               const char *wt_path = real_path_if_valid((*list)->path);
+
+               if (wt_path && !fspathcmp(path, wt_path))
                        break;
+       }
        free(path);
        free(to_free);
        return *list;