From 3381f9c7908cee34fa955f174825b67cda27048e Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 22 Aug 2016 22:34:02 -0300 Subject: [PATCH] eeshow/file/git-file.c (related_only_repo): lookup repo again after grafting Else, symlinks may confuse us. --- eeshow/file/git-file.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eeshow/file/git-file.c b/eeshow/file/git-file.c index 1b11a1b..6c828ef 100644 --- a/eeshow/file/git-file.c +++ b/eeshow/file/git-file.c @@ -392,6 +392,22 @@ static bool related_only_repo(struct vcs_git *vcs_git) if (!tmp) return 0; + /* + * We now have a new path, but where does it lead ? If it contains a + * symlink, we may end up in an entirely different repo, where new + * adventures await. Let's find out ... + */ + vcs_git->repo = select_repo(tmp); + if (vcs_git->repo) { + free((char *) vcs_git->name); + vcs_git->name = tmp; + if (!strcmp(git_repository_path(vcs_git->related->repo), + git_repository_path(vcs_git->repo))) + return related_same_repo(vcs_git); + else + return related_other_repo(vcs_git); + } + vcs_git->repo = related->repo; vcs_git->tree = related->tree;