Skip to content

Infer git remote from config when updating

Kev Kloss requested to merge kkloss-infer-git-remote-from-config into main

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

  1. Check out this branch
  2. Close any IDE you have open (in case it runs git fetch for you automatically)
  3. Run GDK_SELF_UPDATE=0 gdk update
  4. Run cd gitlab
  5. Run git status
  6. See a status like Your branch is up to date with 'origin/master'.

Impacted categories

The following categories relate to this merge request:

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 the CHANGELOG.md.

Merge request reports

Loading