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

be able to configure the name of the remote per user property #598

Open
elonderin opened this issue Oct 10, 2022 · 4 comments
Open

be able to configure the name of the remote per user property #598

elonderin opened this issue Oct 10, 2022 · 4 comments

Comments

@elonderin
Copy link

Describe your idea

ATM the name of the remote seems to be hard coded as origin, which causes the plugin to fail:

[ERROR] Failed to perform fetch
org.eclipse.jgit.api.errors.InvalidRemoteException: Invalid remote: origin

Expected Behavior

I personally rename my remotes to o which causes the plugin to fail.
So having a way to config this would be great, preferably as a user property, so that can be easily overridden from CLI w/o having to mod the POM

@TheSnoozer
Copy link
Collaborator

Thanks for this ticket!
Indeed the "origin" seems hard-coded (e.g. https://github.com/git-commit-id/git-commit-id-plugin-core/blob/cb3375a7ec1dfb722c1387cc1e15b73df5cd2f87/src/main/java/pl/project13/core/JGitProvider.java#L235). Interestingly the native-part of the plugin (using the actual underlying git binary) uses just ls-remote (refs https://github.com/git-commit-id/git-commit-id-plugin-core/blob/cb3375a7ec1dfb722c1387cc1e15b73df5cd2f87/src/main/java/pl/project13/core/NativeGitProvider.java#L323). So perhaps an <useNativeGit>true</useNativeGit> would do the trick?

@gary258796
Copy link

Thanks for this ticket! Indeed the "origin" seems hard-coded (e.g. https://github.com/git-commit-id/git-commit-id-plugin-core/blob/cb3375a7ec1dfb722c1387cc1e15b73df5cd2f87/src/main/java/pl/project13/core/JGitProvider.java#L235). Interestingly the native-part of the plugin (using the actual underlying git binary) uses just ls-remote (refs https://github.com/git-commit-id/git-commit-id-plugin-core/blob/cb3375a7ec1dfb722c1387cc1e15b73df5cd2f87/src/main/java/pl/project13/core/NativeGitProvider.java#L323). So perhaps an <useNativeGit>true</useNativeGit> would do the trick?

<useNativeGit>true</useNativeGit> do work in this case.

@gary258796
Copy link

gary258796 commented Oct 11, 2022

There is a chance there are multi remotes being set in config file.
Options we have here are

  1. Having a way to config target remote "subsection" that we want to get
  2. Having the same solution as NativeGitProvider by using git ls-remote --get-url command ?
  3. Just use <useNativeGit>true</useNativeGit> cause it's using command git ls-remote --get-url to get remote url now already.
  4. Get name 'remote' from section 'branch' with subSection equals current branch. And then get name 'url' from section 'remote' which subsection equals to target remote.

Screen Shot 2022-10-11 at 4 03 57 PM

Screen Shot 2022-10-11 at 4 05 57 PM

@elonderin
Copy link
Author

thx! -Dmaven.gitcommitid.nativegit=true works for me.

However, for general usage i think it would be best to give this a config element and an user property to be set via CLI only.

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

No branches or pull requests

3 participants