What's wrong
Both scans replace each GitRepository object in Options.Repos instead of updating the one already there:
ScanDevDirectoryForOwnersAndRepos: Options.Repos[repoFullName] = gitHubRepo; (ProjectDirector/ProjectDirector.cs ~L1188)
SyncGitHubRepoInfoForOwner: Options.Repos[repoName] = repo; (~L1020). This runs for "Scan > GitHub Owners" and for "Add New GitHub Owner".
The comparison state lives on the object: SimilarRepoDiffs and the requested/applied comparison tokens. The replacement has empty diffs and SimilarReposPending == false. Neither scan calls RefreshPage/UpdateSimilarRepos afterwards; they only call UpdateClonedStatus(). So after a rescan, until the user re-clicks the repo in the left list:
- Compare File view:
FindDiff returns null, so ShowComparedFile shows the pending message ("Comparing repositories...") indefinitely, with nothing actually running.
- Compare Repo view: an empty file list.
- Similar Repos: an empty table.
- Propagate popup: offers no targets.
The new object also resets LastFetchTime to DateTime.MinValue, so every rescanned clone is fetched on the next tick. That adds to the burst described in #448.
Repro
In a scratch copy of the test project, using new ProjectDirector() with XDG dirs redirected and the private methods driven by reflection:
- Create two local repos with origins
https://github.com/acme/a and https://github.com/acme/b, both containing shared.txt.
- Run Scan Dev Dir, then
SwitchPage("acme/a"), then wait for the comparison and select the compared repo and file.
- Run Scan Dev Dir again.
before scan: diff found=True
after scan: same object=False pending=False diff found=False siblings=0 lastFetch=01/01/0001 00:00:00
Suggested fix / acceptance criteria
- In both scans, when
Options.Repos already contains the key, update the existing object in place: RemotePath, LocalPath, OwnerName and RepoName. That keeps its comparison and LastFetchTime.
- At a minimum, call
RefreshPage() when a scan finishes.
- Acceptance: rescanning (Dev Dir or GitHub Owners) while a repo or file comparison is open either keeps it displayed or shows a real pending state that resolves.
This is distinct from #438. Its open fix, PR #473, preserves LocalPath but still assigns a new object, so it doesn't address this; the two would fit naturally in one change.
What's wrong
Both scans replace each
GitRepositoryobject inOptions.Reposinstead of updating the one already there:ScanDevDirectoryForOwnersAndRepos:Options.Repos[repoFullName] = gitHubRepo;(ProjectDirector/ProjectDirector.cs~L1188)SyncGitHubRepoInfoForOwner:Options.Repos[repoName] = repo;(~L1020). This runs for "Scan > GitHub Owners" and for "Add New GitHub Owner".The comparison state lives on the object:
SimilarRepoDiffsand the requested/applied comparison tokens. The replacement has empty diffs andSimilarReposPending == false. Neither scan callsRefreshPage/UpdateSimilarReposafterwards; they only callUpdateClonedStatus(). So after a rescan, until the user re-clicks the repo in the left list:FindDiffreturns null, soShowComparedFileshows the pending message ("Comparing repositories...") indefinitely, with nothing actually running.The new object also resets
LastFetchTimetoDateTime.MinValue, so every rescanned clone is fetched on the next tick. That adds to the burst described in #448.Repro
In a scratch copy of the test project, using
new ProjectDirector()with XDG dirs redirected and the private methods driven by reflection:https://github.com/acme/aandhttps://github.com/acme/b, both containingshared.txt.SwitchPage("acme/a"), then wait for the comparison and select the compared repo and file.Suggested fix / acceptance criteria
Options.Reposalready contains the key, update the existing object in place:RemotePath,LocalPath,OwnerNameandRepoName. That keeps its comparison andLastFetchTime.RefreshPage()when a scan finishes.This is distinct from #438. Its open fix, PR #473, preserves
LocalPathbut still assigns a new object, so it doesn't address this; the two would fit naturally in one change.