Search code examples
gitgit-cvs

git-cvsserver pserver username propagation


For some specific workflow issues at my company, I need to allow some users work with CVS, while main repository is under git.

I've chosen git-cvsserver as implementation for this task.

I set up git repository, enabled it for gitcvs and setup a pserver simulation on xinetd. Everything works fine, I can work with this repository from cvs client, authenticating against passwd file I created through pserver emulation.

My problem is that commits that I make through CVS are shown under user who runs xinetd, not under user I authenticate against passwd.

i.e. I commit to CVS as user 'foo', I successfully authenticate through pserver, but when I look at git history of commits for this repo, i see that commit has been made by user 'root'.

I looked through source of git-cvsserver (http://git.kernel.org/?p=git/git.git;a=blob;f=git-cvsserver.perl) and it seems that CVS login is used only for authentication, not for actual committing. Records in SQLite database contain 'root' username too, not 'foo'

Do you have any ideas how I can propagate CVS login to git username?

xref at git mailing list: http://thread.gmane.org/gmane.comp.version-control.git/169182


Solution

  • I have no specific experience with it, but git-cvsserver almost certainly invokes git-commit to do the actual work. You can get git-commit to use anything you want for the author and committer by setting environment variables like GIT_COMMITTER_EMAIL and GIT_AUTHOR_EMAIL (also ..._NAME and ..._DATE and ..._IDENT). If you have the authentication information available you could simply set it in $ENV before the actual commit. If git-cvsserver doesn't clean its environment you could actually set those from the authentication information in a wrapper before invoking it (just in case of any commit).