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

Add option for remote repository URL #112

Closed
siwon opened this issue Sep 27, 2022 · 5 comments
Closed

Add option for remote repository URL #112

siwon opened this issue Sep 27, 2022 · 5 comments
Assignees
Labels
feature/request New feature or request

Comments

@siwon
Copy link

siwon commented Sep 27, 2022

Is your feature request related to a problem? Please describe.
When I use conventionnal commit with fix #issue_number, the url generated by git-cliff is pointing git-cliff repository instead of my current remote repository url.

Example :

### Features

- Use latest image orhunp/git-cliff ([#1](https://github.com/orhun/git-cliff/issues/1))

As you can see, the url is pointing to your repo instead of mine.

Describe the solution you'd like
Is it possible to add an option to specify the repo url I want to use ?
I know there is an option in the config file, but I think on option in the command line is better solution.

For example :

  --remote_repo_url <url repo> : the remote url for issue refs.

Describe alternatives you've considered
I use git-cliff inside Gitlab-CI so I use a sed command on the result to replace your repo url with mine.

PS: thanks a lot for your work !

@siwon siwon added the feature/request New feature or request label Sep 27, 2022
@FlrnFrmm
Copy link
Contributor

FlrnFrmm commented Oct 16, 2022

Tried to implement the feature with #121

Changed the name to --github_repository_url because the feature in the current form is specific to github.

@FlrnFrmm
Copy link
Contributor

Oh, and I realized I made a mistake.

I assumed (and I have honestly no clue how I got to that conclusion) that issue short links are #i and pull requests @i.
But now I've realized they are both just #i.
My problem is now, how to decide which reference is an issue and which is a pull request.
That is necessary because the routes differ: ../issues/{i} vs. ../pull/{i}.

One option would be to match against more than just #i, e.g.:

  • #i for issues
  • pr #i | pull request #i | Pull Request #i for Pull Requests

Or is there a GitHub endpoint that redirects the i to the correct origin?

@FlrnFrmm
Copy link
Contributor

Solved my problem, and realized I can use ../issues/{i} for both.
GitHub redirects correctly to issues if #i is an issue and to PRs if it is a PR.

@orhun
Copy link
Owner

orhun commented Dec 22, 2022

I had a look at this with fresh eyes and this is caused by the default config, as you mentioned:

commit_preprocessors = [
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/orhun/git-cliff/issues/${2}))"},
]

So you should be fine when you just change that line to point your own repository.

But still, it's annoying. So I pushed 8f77caf to comment this entry out.

So there is no need for overcomplicating this via #121. It is always good to refrain from adding code-hosting related things to git-cliff since it is not specifically designed to work with e.g. GitHub, GitLab, etc. These remote URLs might change any time depending on which platform you are using. git-cliff should only integrate well with git and it should be configurable based on user liking.

Hope this solves it! 🐻

@orhun
Copy link
Owner

orhun commented Dec 26, 2023

You can now achieve this with the GitHub integration.

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

No branches or pull requests

3 participants