The SVN hooks seem to use my name rather than the name of the git committer

I have created the pre-revprop-change.bat file which has fixed the name in the svn commit but not the pre and post commit hooks.

Is there a way to explain to svn that the user committing is not me?

Hi Steve,

I’m afraid I don’t follow you here, could you please explain the issue in a bit more detail? You have created the pre-revprop-change hook in SVN repository and now the revisions author name is being set correctly, but what about the pre and post commit hooks?

Hi,

Sorry, I should have been more clear.

We have pre and post commit hooks in svn that check for valid commit messages, updates 3rd party software etc. and determines whether the user has write access to the changed directories.

I set up the mirror and followed this guide:

https://subgit.com/documentation/remote-book.html#pre_revprop_change_hook

But it seems that when we commit to git and subgit mirrors the commit to svn the svn hooks think that the user is me, regardless of who is making the commit. This is causing issues as I do not have write access to many parts of the code and people are unable to commit because of this.

Hi Steve,

I think I understand what the problem is here, the matter is how SubGit deals with authors: at the first step SubGit connects to SVN and sends a new revision with the author name set to the SVN user name that is set in SubGit configuration for the SVN connection – I believe, it is your SVN username in your case. After the new revision is created, SubGit connects to SVN once more and sets correct revision author name according to the provided authors mapping. The hooks are being triggered during the revision creation and at that time there’s your user name, so the hooks are behaving accordingly.
I’m afraid little that we can do with it as there are some limitations in SVN that don’t allow setting correct author name in a single transaction. A possible workaround is to set username-password pair for every user committing to the mirrored Git repository; otherwise it should be handled somehow in hooks themselves.

Ah okay.

Does SubGit use the name/password setting from the [auth “default”] section of the config file to connect to svn in these cases?

SubGit uses name and password from the configuration file as the first option if they’re set there. Here is the order in which SubGit tries to find authentication data to login to SVN:

  • if the userName and password options are set in [auth] section of the SubGit configuration file, SubGit will use them to access the SVN repository;
  • if those options are not set, but the password file ( subgit/passwd by default) is filled out with SVN usernames and passwords, SubGit will use those users;
  • if neither userName and password , not password file are set, SubGit will try to use SSL client certificate for authentication;
  • if none of the above is set, SubGit will use SSH key file;
  • if even the SSH key configuration option is not set, SubGit will try to user credential helper;
  • if the path to the credential helper is not set, SubGit will try to find usable SVN authentication data in SVN configuration directory;
  • if none of the above is found, SubGit will report an authentication error and stop the translation process.

It’s not possible to set several username/password pairs in the configuration file, so if you intend to use more than one credentials pair, you would need to remove username/password from the configuration file and set the credentials in passwords file:

https://subgit.com/documentation/auth-book.html#passwords_file