be able to configure the name of the remote per user property
elonderin opened this issue · 4 comments
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
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?
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.
There is a chance there are multi remotes being set in config file.
Options we have here are
- Having a way to config target remote "subsection" that we want to get
- Having the same solution as NativeGitProvider by using
git ls-remote --get-url
command ? - Just use
<useNativeGit>true</useNativeGit>
cause it's using commandgit ls-remote --get-url
to get remote url now already. - 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.
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.