Skip to content

Re-running a scan wipes the open comparison: the file view shows "Comparing repositories..." forever and Similar Repos goes empty #476

Description

@matt-edmondson

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:

  1. Create two local repos with origins https://github.com/acme/a and https://github.com/acme/b, both containing shared.txt.
  2. Run Scan Dev Dir, then SwitchPage("acme/a"), then wait for the comparison and select the compared repo and file.
  3. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions