Loading
perf(mr): skip fetch in checkout when MR head is already local
Description
- perf(mr): skip fetch in checkout when MR head is already local
Merge Request head SHA is already known from the API request. If the local branch head matches it, or the commit is present and the branch can be recreated from it, we skip fetching.
Related Issues
Resolves #8535 (closed)
How has this been tested?
- Checkout current branch with "old" glab:
glab mr checkout https://gitlab.com/gitlab-org/cli/-/merge_requests/3864 - Compile the new one:
make build - Checkout main branch:
git checkout main - Run the new tool to try to checkout the same MR again:
./bin/glab mr checkout https://gitlab.com/gitlab-org/cli/-/merge_requests/3864
You should expect this output:
Branch "brodock/mr-checkout-smart-fetch" already at merge request head, skipping fetch.
Switched to branch 'brodock/mr-checkout-smart-fetch'Screenshots (if appropriate):
Edited by Gabriel Mazzetto