I can't seem to get my git accounts to sync to a drupal account.
Here is an example commit log:
Commit cf4c450d53c7077a57cbd6e759df1a0d1463da61 by David Konsumer at 23:26 in Drupal 5 Base: (154 lines added, 0 lines removed)
master: /
* asset_source/borders.svg (added)
Added asset for making rounded corners/shadows in base theme
As you can see, the user is "David Konsumer" the user account used to submit it was "konsumer", and I am tying to link it to the drupal account "konsumer".
I created a link from konsumer to konsumer, and that didn't show my commit logs, so I attempted to link to "David Konsumer" and I get:
The specified Git username is invalid.
I'm not sure where to submit the issue (is this a Git sub-module) issue, or if I am even using the module correctly (is this a support issue? I'm not sure.)
Comments
Comment #1
jpetso commentedVersion Control API seems to be responsible for that: in versioncontrol.pages.inc, versioncontrol_account_edit_form_validate(), it restricts user name registrations to alphanumeric characters only. That makes a lot of sense for CVS and SVN, but might not be such a good idea when considering arbitrary (email-display-name-based) user names like in Git. I wonder how to best delegate that decision to the backends, hm...
Comment #2
jpetso commentedStill not solved in 5.x-2.0, sorry.
Comment #3
konsumer commentedI am currently working on a stand-alone Git read/write class. I have implemented a basic manager for git repos (much like ViewGit) in Drupal module, using email to cross-link users. It works really well, but I would like for it to be a part of the Version control API. Any help that anyone can provide would be much appreciated. What is needed to combine these efforts with the other Git/VCS stuff?
Comment #4
sdboyer commentedFirst step, I'd say, is looking at the git vcs project, since that's where such things would live. Write operations aren't much supported at the moment, though; it's something that I VERY much want to work on in the future, but there are steps between here and there.
Comment #5
jpetso commentedMuch of the git backend's code might be obsolete though when it's updated to the 5.x-2.x API, it doesn't need to be that complex anymore. Also, a git interface class might help implementing the git backend's repository browsing support (get_item(), get_directory_contents(), get_file_copy() & Co.). Repoview should even be able to display the basic repository contents without having the existing git log parser ported as a prerequisite.
This belongs in a separate issue though, I would think that the git backend's issue queue would be the best place to continue this discussion, it's just a bit off-topic in here.
Comment #6
neptunix commentedHad the same problem with svn. Resolved by hacking versioncontrol.pages.inc
Comment #7
jpetso commented@neptunix: Aren't SVN usernames required to be lowercased and stuff? Anyways, seems like it's high time to split this check off into an optional backend function.
Comment #8
jpetso commentedMoving to 6.x-1.x, won't be backported to 5.x-* (at least not by myself, and any patch should target the current version first).
Comment #9
jpetso commentedI think this should be a backend-specific API function, like
versioncontrol_is_valid_username($repository, $username)respectivelyversioncontrol_[backend]_is_valid_username($repository, $username). versioncontrol.pages.inc should then just use that function to check whether it should set an error or not....any takers?
Comment #10
CorniI commentedit's me :)
Comment #11
CorniI commentedhere's a patch adding the usage of a new api call, is_invalid_username($repo, $username) for cheking if a username is ok for a specific backend.
Comment #12
CorniI commentedpatch was crap, another try...
Comment #13
jpetso commentedLooks great! The only thing I forgot to mention in IRC (sorry) is that backend-implementable API functions should be documented in the FakeVCS backend by provding apidox for the function, and a short example implementation. (The ereg() version from versioncontrol.pages.inc would be totally sufficient... apart from PHP suggesting preg_match() instead, maybe we should switch to that one altogether?)
Comment #14
CorniI commentedok
i still have to practise with git-format-patch, now i offer you two patches...
Comment #15
jpetso commentedI added a lot more to your patch (felt like solving the whole problem area surrounding this issue), fixed a bug in the patch and a bug that existed previously, and committed all of it in commit #192592. Thanks for getting involved, I'm glad this is fixed now :)
Comment #16
jpetso commentedNote: Of course, other backends with different needs than CVS still need to implement stuff (versioncontrol_[vcs]_is_account_username_valid() and versioncontrol_[vcs]_account_username_suggestion()) if they want to improve the current situation. Both are documented in versioncontrol_fakevcs.module.