Skip to content

Reuse the resolved GitHub repository path after a redirect - #1776

Open
be-student wants to merge 2 commits into
VirtusLab:developfrom
be-student:codex/1211-reuse-renamed-repository-path
Open

Reuse the resolved GitHub repository path after a redirect#1776
be-student wants to merge 2 commits into
VirtusLab:developfrom
be-student:codex/1211-reuse-renamed-repository-path

Conversation

@be-student

Copy link
Copy Markdown
Contributor

Fixes #1211.

After a renamed repository redirects the first mutation, later REST API calls still use the old repository path and incur another redirect. Retain the resolved organization/repository path in the GitHub API instance after the redirected request succeeds, and reuse it through the shared repository request helper.

Regression tests cover repository renames and organization transfers, the exact redirect/request sequence, subsequent PATCH/POST/GET calls, preserved mutation data, and isolation between API instances. Document the behavior and regenerate the command help and man page. Git remotes remain user-configured; GitLab's separate moved-project error (#1212) is outside this change.

Validation: the new cases fail before the fix; all 48 tests in the GitHub API, PR creation, and retargeting modules pass through tox. The two regressions also pass after adjusting mock inspection for supported older Python versions. Tox formatting, isort, mypy, generated-help consistency, Sphinx HTML/man, and repository static checks pass. Optional remark link checking was skipped because remark is unavailable; flake8/vulture are left to CI per AGENTS.md.

Comment thread docs/source/cli/github.rst Outdated

Create, check out and manage GitHub PRs while keeping them reflected in branch layout file.

If GitHub redirects a REST API mutation after a repository rename, git-machete resolves its new location.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an implementation detail, I'd skip it from the docs TBH

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In case a GitHub repository has been renamed, all but first non-GET requests should be be directed towards the renamed repo

2 participants