Code Monkey home page Code Monkey logo

fugitive-gitlab.vim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fugitive-gitlab.vim's Issues

Gbrowse not working

I get this error running: Gbrowse

fugitive: Instaweb failed to start and 'origin' is not a supported remote

I added to my .vimrc

let g:fugitive_gitlab_domains = ['https://ourdomain.com']

Support non-origin remotes for commit omnicompletion

I have managed in the end to make omnicompletion to work. I have added g:gitlab_api_keys variable:

let g:fugitive_gitlab_domains = [
    \ 'https://gitlab.com',
    \ 'https://gitlab.internal.site.com'
    \ ]

let g:gitlab_api_keys = {'gitlab.com': 'somethingverysecret'}

Then I had to discover that appropriate remote for git must be origin (that's a pity, I usually use upstream as a name of my remote; but I can survive).

GBrowse open file to correct line

In other IDEs (VSCode and WebStorm), opening in GitLab will not just open the current file, but also will open it to the same line your cursor is on. It would be nice to have this in GBrowse too

Error with latest version of fugitive

Continuing from tpope/vim-fugitive#1147, I've found out that fugitive-gitlab.vim causes the error. To quote:

Error detected while processing function <SNR>150_config[4]..<SNR>177_buffer_repo:
line    1:
E605: Exception not caught: fugitive: Removed in favor of fugitive#repo()
Error detected while processing function FugitiveDetect:
line   11:
E171: Missing :endif

Write an FAQ

Self hosted gitlab often has quirks such as ssh url being different to web url.
This is solvable with git/ssh settings but needs documenting.

An FAQ would help document this.

Unable to find Gbrowse handler

When I do :GBrowse (in a file where I can see git blame properly) I get:

fugitive: no GBrowse handler installed for 'ssh://[email protected]_name.cntry:12112/project_name/repo_name.git'

My configuration(using neovim and lua, but no syntax errors) is:

    vim.g.fugitive_gitlab_domains = { ['ssh://[email protected]:12112'] = 'https://gitlab.company_name.cntry:3344' }
    vim.g.gitlab_api_keys = { ['https://gitlab.company_name.cntry:3344'] = 'newly_generated_access_key' }

Is it so that the GitLab domains are supposed to contain the project and repo names as well?

Gbrowse is creating the wrong URL

My company is self-hosting gitlab. The url on the website to a particular file is

https://[domain]/cat_projects/frida/blob/master/fridapoc.py

but :GBrowse! prints

https://[domain]/cat_projects/frida/-/blob/master/fridapoc.py

, notice the extra -.

I thought maybe it's because of the different address for ssh connections, so I tried setting:

let g:fugitive_gitlab_domains = {'ssh://[domain]:[port]/': 'https://[domain]/'}

but then I get an error:

fugitive: no GBrowse handler installed for 'ssh://git@[domain]:[port]/cat_projects/frida.git'

Do you have any idea what could be the issue?

Gbrowse fails with "fugitive: 'origin' is not a supported remote"

my vimrc looks like this

Plug 'tpope/vim-fugitive'
Plug 'shumphrey/fugitive-gitlab.vim'

let g:fugitive_gitlab_domains = ['https://gitlab-myserver.private.org']
let g:gitlab_api_keys = {'gitlab-myserver.private.org': 'my-access-token'}

and whenever I run :Gbrowse, vim responds with:

fugitive: 'origin' is not a supported remote

Is this a bug or something wrong with my config? Thank you!

About `g:fugitive_gitlab_ssh_user`

I found g:fugitive_gitlab_ssh_user from the code when looking for a way to support our private gitlab . That setting is currently undocumented. I guess you don't want to do so because the current implementation is not satisfied: It can't support multiple gitlab ssh users for different domains.

Perhaps we can deprecate all 3 variables:

  • fugitive_gitlab_domains
  • gitlab_api_keys
  • fugitive_gitlab_ssh_user

And introduce a new array of objects: fugitive_gitlab_configs:

let g:fugitive_gitlab_configs = [{
  'api_key': '...', 
  'domain': '...',
  'ssh_user': '...'
}]

Using that construction, we can have more customization per domains in future if needed. How do you think?

Add support for different git ssh users

The plugin is not working for me. I have tracked the problem down to the regex here. The problem is that my GitLab ssh user is gitlab not git. I know this is not standard and probably means that I set up GitLab incorrectly, but do you think it would be possible to update the regex? I have confirmed that changing it to ...\|git\%(lab\)\?@\|ssh://git\%(lab\)\?\|... works.

I am also running ssh on a port other than 22. Maybe it is possible to add let base = substitute(base, ':\d\{1,4}\/', '/', '') to strip the port before let base = tr(base, ':', '/')?

Add CI linting and CI file merging (Have working solution)

Do you have any interest in adding commands that lint the CI file or return a merged one? I created some commands for my own vimrc that do this. I could clean them up and I could add them to the repo.

https://docs.gitlab.com/ee/api/lint.html

let g:fugitive_gitlab_domains = ['https://gitlab.com']
let g:gitlab_api_keys = {'gitlab.com': 'xxxxxxxxxxxxxxxxxxxx'}

function! CiLint()
  echo system("jq --null-input --arg yaml \"$(<".bufname().")\" --arg branch $(git branch --show-current) '.content=$yaml|.ref=$branch' | curl --header \"Content-Type: application/json\" --header \"PRIVATE-TOKEN: ".g:gitlab_api_keys['gitlab.com']."\" \"https://cee-gitlab.com/api/v4/ci/lint\" --data @- -s | jq '.errors'")
endfunction
function! CiMerge()
    execute("%!jq --null-input --arg yaml \"$(<".bufname().")\" --arg branch $(git branch --show-current) '.content=$yaml|.ref=$branch|.include_merged_yaml=true' | curl --header \"Content-Type: application/json\" --header \"PRIVATE-TOKEN: ".g:gitlab_api_keys['gitlab.com']."\" \"https://cee-gitlab.com/api/v4/ci/lint\" --data @- -s |jq -r '.merged_yaml' ")
endfunction


command! CiLint call CiLint()
command! CiMerge call CiMerge()

Plug-vim not able to download automatically

I want to use this plug in by loading it using vim-plug. All other plugins have no problem being cloned and downloaded automatically, but with fugitive-gitlab.vim, vim-plug all of a sudden wants me to type in my Github username and password as if I was doing an http(s) clone. It seems like it can't read my ssh data for some reason.

This doesn't happen with any other plugin, so I thought it is wasn't a vim-plug issue.

Any ideas?

Get the GitLab Token from the git credentials api

The latest commits added the possibility to auto-complete issues and usernames by curling the GitLab API. This requires getting a Personal Access Token and adding it to your vimrc.

Since the user is using GitLab repositories, there might be cached credentials already. There could be a way to fetch these credentials directly if there are nothing configured in the vimrc.

Docs: https://git-scm.com/docs/gitcredentials

My POC:

$ git credential fill <<<url=$REMOTE_URL
protocol=https
host=$HOSTNAME
username=$UNAME
password=$PASSWORD

If the user has some caching configured, this information is available. Otherwise there should be a prompt for the username and password.

How to configure this in neovim/lua?

I am using neovim.

I have fugitive, and fugitive-gitlab both installed.
Lazy.nvim seems to install both successfully. I know this because I've used Fugitive for a while.

I have the following function:

function ConfigGitlab()
    vim.g.fugitive_gitlab_domains['ssh://[email protected]:121112'] = 'https://gitlab.company.com:3344'
end

But when I call this, I get:

Error detected while processing /Users/v4g4x/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /Users/v4g4x/.config/nvim/lua/core/gitlab.lua:3: attempt to index field 'fugitive_gitlab_domains' (a nil value)

Clearly, I'm not converting the vim option from Vimscript to Lua correctly.
Any help on how this may be done?

Use FugitiveRemoteUrl()

I'm going to take away fugitive#GitVersion() because when it comes to checking version numbers with a regex everybody loses. FugitiveRemoteUrl() provides a much cleaner solution. You can also use it to clean up those fugitive#repo().config() calls (which is probably going away too eventually).

Fails when username is specified in the URL

If you have multiple accounts on a server, one way to disambiguate between repositories is to include the username in the URL.

This makes :Gbrowse fail.

Works

$ git remote -v
gitlab	https://gitlab.com/somini/dotnvim.git

Doesn't work

$ git remote -v
gitlab	https://[email protected]/somini/dotnvim.git

I confirmed the same behaviour on a hosted instance, i.e. not gitlab.com.

The easy way to solve this is by stripping everything to the left of the @, but I couldn't find the exact location at a glance.

Omnicompletion not working with latest fugitive version

I'm getting the following error with latest fugitive version:

E117: Unknown function: fugitive#git_version
Error detected while processing function gitlab#omnifunc[48]..gitlab#issues[1]..<SNR>280_gitlab_project_from_repo:
line   10:
E15: Invalid expression: fugitive#git_version() =~# '^[01]\.\|^2\.[0-6]\.'

GBrowse not working for commit buffers

Apologies if my terminology is a little off here, and I'm also new to gitlab, so this might not be a "general" issue.

Background

We have github repositories merged into gitlab, and after the migration process have updated the git remote to point at gitlab instead. All of which is to say that could be the reason for this issue.

The :GBrowse command is working correctly from file views, but not from commit views

How to recreate

Workaround

Just manually add /- after MY_PROJECT seems to produce the correct URL structure (e.g. https://gitlab.com/MY_ORG/MY_SUBGROUP/MY_PROJECT/-/commit/56f016eb16ff32911c2a76825acfc7093cc48e62)

Performance degradation when using Omnifunc completion.

Hey first of all thank you for your hard work with this plug in!

I noticed that it seems to work quite well with casual GBrowseing and so without providing any credentials but as soon as I supply a let g:gitlab_api_keys = {'gitlab.com': 'glPATgoeshere'} I can noticeably see my typing lag in a git commit message window. Is this something you can replicate on your end? Having direct issues integration is a super cool feature for the work flow but it seems to create this weird side affect of prohibitively slow typing.

I have included a gif of this behaviour below. For what it's worth I experience the same issue with Rhubarb. Perhaps it's a curl thing or something on my end. In either case would be very happy to hear back and help address what may be going on.

cheers!

Gif of observed behaviour:
slow

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.