Skip to content

Harden pr_finish() against subkeys created by VS Code / Positron / GitHub Pull Requests extension #2113

Open
@jennybc

Description

@jennybc

The GitHub Pull Requests extension does some funny business with branches that it perceives to be PR-related. I haven't delved into the details re: whether it's temporarily changing branch names or shimming some git command or some other third thing.

But whatever malarkey it is, it causes pr_finish() to fail like so:

✔ Switching back to default branch ("main").
✔ Pulling changes from "origin/main".
✔ Deleting local "switch-r-pkg-testing-shortcut" branch.
Error in libgit2::git_branch_delete : 
  could not find key 'branch.switch-r-pkg-testing-shortcut.github-pr-owner-number' to delete

What the heck is this?

branch.switch-r-pkg-testing-shortcut.github-pr-owner-number
                                    ^^^^^^^^^^^^^^^^^^^^^^^

The extension seems to assume that it will be mediating all of your git(hub) work and it can do something like this, which then breaks other tools.

Not sure if it's my / usethis's problem to solve but it's conceivable it would be worth detecting that suffix and trimming it off if this problem persists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gitgit, GitHub, and CI in general

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions