Skip to content

Repo list never shows which clones are dirty or behind their remote (GitRepository.UpdateStatus is never called) #479

Description

@matt-edmondson

What's missing

GitRepository already has IsDirty, IsOutOfDate and UpdateStatus() (ProjectDirector/GitRepository.cs:95-103). Three things are missing:

  • Nothing calls UpdateStatus(). A grep of the app and the tests finds no caller, so IsDirty is always false.
  • IsOutOfDate is hard-coded to false. It sits next to the TODO // work out if the repository is behind the remote.
  • ShowRepos has no status indicators. It (ProjectDirector.cs:963-986) draws only the "cloned" dot.

There is also a side effect: IsDirty, IsOutOfDate and IsCloned are public getters with no [JsonIgnore]. They are written into the options JSON on every save, even though they are runtime state.

Why it matters

The app fetches every repository in the background every 60 seconds and offers "Pull All". Even so, it never tells the user which repositories have incoming commits or uncommitted work. Today the only way to find out is to select each repository in turn, or to wait for a pull prompt.

Suggested implementation

  • When to refresh: call UpdateStatus() when the FetchRepo background task finishes (ProjectDirector.cs:~444), and again after pull and commit operations.
  • Computing IsOutOfDate: in UpdateStatus(), use git rev-list --count HEAD..@{u}, or the equivalent through the existing git wrapper. Treat "no upstream" as false.
  • Display: draw a "dirty" indicator and a "behind" indicator next to each repository in ShowRepos, alongside the cloned dot.
  • Persistence: mark IsDirty, IsOutOfDate and IsCloned [JsonIgnore].

Acceptance criteria

  • After a background fetch brings in new upstream commits, that repository shows as behind in the list.
  • A working tree with uncommitted edits shows as dirty.
  • A repository with no upstream branch is never shown as behind.
  • The saved options file no longer contains IsDirty, IsOutOfDate or IsCloned.

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