Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Fix: Allow for override of repo using OWNER/REPO #678

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

zemzale
Copy link
Collaborator

@zemzale zemzale commented Apr 8, 2021

Description
When using flags/commands that override the repo, but don't supply
hostname, we allways fallback to gitlab.com. This is a problem for
commands like mr checkout 12 -R OWNER/REPO that should use API host
self-hosted, but actually use gitlab.com.

Now we override default host, from the base repo, if one is found.
Environment values still override repo host.

Related Issue
Resolves #383

How Has This Been Tested?
Locally tried to checkout mr using mr checkout 12 -R ONWER/REPO, on self hosted instance and everything worked.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)

When using flags/commands that override the repo, but don't supply
hostname, we allways fallback to `gitlab.com`. This is a problem for
commands like `mr checkout 12 -R OWNER/REPO` that should use API host
`self-hosted`, but actually use `gitlab.com`.

Now we override default host, from the base repo, if one is found.
Environment values still override repo host.
@codecov
Copy link

codecov bot commented Apr 8, 2021

Codecov Report

Merging #678 (7e9e9e8) into trunk (fe2d5e9) will decrease coverage by 0.00%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##            trunk     #678      +/-   ##
==========================================
- Coverage   59.98%   59.98%   -0.01%     
==========================================
  Files          90       90              
  Lines        6438     6442       +4     
==========================================
+ Hits         3862     3864       +2     
- Misses       2213     2214       +1     
- Partials      363      364       +1     
Impacted Files Coverage Δ
cmd/glab/main.go 41.17% <33.33%> (+0.43%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe2d5e9...7e9e9e8. Read the comment docs.

@zemzale zemzale marked this pull request as ready for review April 8, 2021 07:53
@zemzale zemzale requested a review from profclems April 8, 2021 07:53
Copy link
Owner

@profclems profclems left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.
Thanks for working on it @zemzale...

I don't know if there are users who rely on the previous behaviour which is actually, a bug. For such users, this will be a breaking change

@profclems profclems added the Fix This fixes a bug or incorrect documentation label Apr 8, 2021
@zemzale zemzale merged commit 88b415b into profclems:trunk Apr 9, 2021
profclems added a commit that referenced this pull request Apr 30, 2021
This allows overriding the default protocol of the hostname if a fully qualified url is provided when using the `GITLAB_HOST` environment variable.
For example, if the GITLAB_HOST=http://my.glinstance.org, then the host will be set to my.glinstance.org and the protocol become http, unlike before when the protocol was ignored and only the hostname was considered.

This is a follow-up for #678
and #667
profclems added a commit to olearycrew/glab that referenced this pull request Jun 12, 2021
This allows overriding the default protocol of the hostname if a fully qualified url is provided when using the `GITLAB_HOST` environment variable.
For example, if the GITLAB_HOST=http://my.glinstance.org, then the host will be set to my.glinstance.org and the protocol become http, unlike before when the protocol was ignored and only the hostname was considered.

This is a follow-up for profclems#678
and profclems#667
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fix This fixes a bug or incorrect documentation size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't checkout branch on gitlab.alpinelinux.org
2 participants