use origin as remote for newly checkout merge request

Checklist

  • I'm using the latest version of the extension (Run glab --version)
    • Extension version: 1.48.0
  • Operating system and version: Debian 12
  • Gitlab.com or self-managed instance? both
  • GitLab version (if self-managed) 17.2 (Use the version endpoint, like this: gitlab.my-company.com/api/v4/version)
  • I have performed glab auth status to check for authentication issues

Summary

branch remove is not set to any remote preset

Environment

  • OS: Linux 6.1.0-0.deb11.5-amd64 x86_64
  • SHELL: /bin/bash
  • TERM: xterm-256color
  • GLAB: Current glab version: 1.48.0

Other:

Steps to reproduce

  • check out any new merge request locally like glab mr checkout 12345

What is the current bug behavior?

the remote in the .git/gitconf is

[branch "branch-name"]
	remote = git@instsance.com:group-name/repo-name.git
	merge = refs/heads/branch-name

when running a git command like

git rev-list --left-right --count HEAD...@'{u}'

you get error like

fatal: upstream branch 'refs/heads/branch-name' not stored as a remote-tracking branch

What is the expected correct behavior?

respect the origin setting in the remote origin session in gitconfig, set remote to origin or others


[remote "origin"]
	url = ssh://git@instsance.com:group-name/repo-name.git
	fetch = +refs/heads/*:refs/remotes/origin/*
	fetch = +refs/merge-requests/*/head:refs/pullreqs/*
	glab-resolved = base
	glab-resolved = head

[branch "branch-name"]
	remote = origin
	merge = refs/heads/branch-name
git rev-list --left-right --count HEAD...@'{u}'
## should sucessfully return something like
## 0       9

Relevant logs and/or screenshots

Possible fixes

Edited by braineo