Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git: improve remote detection #24

Closed
wants to merge 1 commit into from

Conversation

Ma27
Copy link

@Ma27 Ma27 commented Jul 19, 2023

The previous version had a few issues I got bitten by:

  • it's on gitea/gitlab/github not necessary to have .git as suffix for a remote, i.e.

    git@github.com:org/repo
    

    is perfectly fine and because I wasn't that, all of my remotes were dismissed by this plugin.

  • For forked repos I usually adhere to the convention to name my own fork's remote origin while the original repo's origin is called upstream[1]. This also means that if an issue is referenced in a file, it refers to the upstream's issue tracker.

    Accordingly I patched this part to prefer the upstream remote over the origin remote (if it exists).

    This is just a very bare-bone setup missing a few more important things:

    • on github at least you can also specify owner#issuename for issues in forks. This is still completely ignored.

    • the prefer remote X over Y should be at least configurable, perhaps it should be possible to do this on a per-project level.

    For me, the current state is good-enough to use and I figured I'd
    contribute my changes back here even though the patch is not perfect,
    perhaps they're useful as a base to improve this nice plugin.

[1] https://docs.github.com/en/get-started/quickstart/fork-a-repo

@Ma27 Ma27 force-pushed the improve-git-remote-detection branch from 23b2274 to 40b474e Compare July 20, 2023 21:16
@chrishrb
Copy link
Owner

first of all: sorry for the late feedback!

And yea, i know that the current implementation is not perfect but this is, as you say, very bare-bone. If I have the time (or you?) we have to implement it with the improvements you mentioned. Without that I don‘t think its ready to be merged! (Also some tests would be nice here 😄 )

The previous version had a few issues I got bitten by:

* it's on gitea/gitlab/github not necessary to have `.git` as suffix for
  a remote, i.e.

      git@github.com:org/repo

  is perfectly fine and because I wasn't that, all of my remotes were
  dismissed by this plugin.

* For forked repos I usually adhere to the convention to name my own
  fork's remote `origin` while the original repo's origin is called
  `upstream`[1]. This also means that if an issue is referenced in a
  file, it refers to the upstream's issue tracker.

  Accordingly I patched this part to prefer the upstream remote over the
  origin remote (if it exists).

  This is just a very bare-bone setup missing a few more important
  things:

  * on github at least you can also specify owner#issuename for issues
    in forks. This is still completely ignored.

  * the prefer remote X over Y should be at least configurable, perhaps
    it should be possible to do this on a per-project level.

  For me, the current state is good-enough to use and I figured I'd
  contribute my changes back here even though the patch is not perfect,
  perhaps they're useful as a base to improve this nice plugin.

[1] https://docs.github.com/en/get-started/quickstart/fork-a-repo
@Ma27 Ma27 force-pushed the improve-git-remote-detection branch from 40b474e to 5f7535b Compare September 30, 2023 11:39
sportshead added a commit to sportshead/gx.nvim that referenced this pull request Feb 24, 2024
Supersedes chrishrb#24

- Allow optional .git for ssh remotes
- Detect owner in owner#issue format
sportshead added a commit to sportshead/gx.nvim that referenced this pull request Feb 24, 2024
Supersedes chrishrb#24

* Allow optional .git for ssh remotes
* Detect owner in owner#issue format
sportshead added a commit to sportshead/gx.nvim that referenced this pull request Apr 28, 2024
Supersedes chrishrb#24

* Allow optional .git for ssh remotes
* Detect owner in owner#issue format
@sportshead
Copy link
Contributor

Fixed by #46

@chrishrb chrishrb closed this Apr 29, 2024
@Ma27
Copy link
Author

Ma27 commented May 4, 2024

Sorry for not getting back to you, but thanks for improving this regardless! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants