ExportXMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Normal
    • 3.0.0rc1
    • Affects Version/s: None
    • Component/s: Plugins API
    • None

      PluginSourceGit.sync() raises AttributeError in its branch-resolution fallback because it accesses repo.branches.local, but the GitRepository abstraction exposes no branches attribute.

      The fallback path (HEAD unset and no main branch) uses repo.branches.local. GitRepository only offered an Any-typed get_branches() passthrough to the raw pygit2 Branches object, so:

      • the wrong attribute crashed at runtime instead of resolving a branch;
      • because the return type was Any, ty could not catch the mistake statically.

      Possible solution

      • Replace get_branches() -> Any with a typed, backend-agnostic branch API on GitRepository: local_branches() -> list[str] and create_tracking_branch(name, commit_id, upstream).
      • Migrate both call sites (plugin3/plugin.py fallback, git/ops.py switch-branch) off the raw pygit2 object; ops.py no longer touches repo._repo.
      • Add a regression test that drives sync() into the fallback state and fails on the pre-fix code.

            Assignee:
            Zas
            Reporter:
            Zas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Version Package
                3.0.0rc1