Infer git remote from config when updating
What does this merge request do and why?
This MR fixes a bug where after gdk update
, the local gitlab
repository would end up in a state like Your branch is ahead of 'gitlab/master' by X commits
. We fix it by inferring the remote name from git config
in lib/gdk/project/git_worktree.rb
.
The reason for this is that we’re fetching and pulling from GDK.config.repositories.gitlab
(default https://gitlab.com/gitlab-org/gitlab.git
) but that is an unnamed remote, so e.g. origin/master
in the local repository would not be updated to origin/master
, so the local HEAD
would be ahead of origin/master
, just because we did not update the origin/master
ref locally.
See this Slack thread (internal) for the investigation.
How to set up and validate locally
- Check out this branch
- Close any IDE you have open (in case it runs
git fetch
for you automatically) - Run
GDK_SELF_UPDATE=0 gdk update
- Run
cd gitlab
- Run
git status
- See a status like
Your branch is up to date with 'origin/master'.
Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Merge request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise an issue to follow-up. -
Documentation added/updated, if needed. -
Announcement added, if change is notable. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.