-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent pruning remotes with branches available locally #11266
Conversation
Co-Authored-By: Markus Olsson <634063+niik@users.noreply.github.com>
… some unit tests!
The work here should be done, but @niik found an issue with desktop/app/src/lib/git/for-each-ref.ts Lines 100 to 106 in 510087a
I'll leave this as a draft until that is fixed, @niik is working on it! ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few small requests here but overall this looks great!
Co-Authored-By: Markus Olsson <634063+niik@users.noreply.github.com>
Co-Authored-By: Markus Olsson <634063+niik@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨ Thanks for picking this up!
Description
When a pull request from a fork is checked out, a remote prefixed with
github-desktop-
is added locally for the PR's branch. To prevent a clutter of remotes, the app will periodically prune old remotes from forks that are, apparently, not used anymore: if all PRs from a given remote have been closed, that remote will be removed.However, it's possible that one of those remotes doesn't have any open PR, but branches from them are still available locally. In that case, the remote should be preserved.
This PR makes sure remotes from forked repos are not removed if a branch is available locally. It also adds some unit tests for the function in charge of deciding which remotes must be pruned.
It's important to know that local branches from merged PRs are also removed if they haven't been checked out in more than 2 weeks.
Release notes
Notes: [Fixed] Remotes referencing forked repos would be removed even when branches from them were available locally