commit log accounts not linking to drupal users

konsumer - October 30, 2008 - 09:58
Project:Version Control API
Version:6.x-1.0-beta5
Component:API module
Category:bug report
Priority:normal
Assigned:CorniI
Status:closed
Description

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.)

#1

jpetso - October 30, 2008 - 13:18

Version 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...

#2

jpetso - December 15, 2008 - 18:29
Version:5.x-1.2» 5.x-2.x-dev

Still not solved in 5.x-2.0, sorry.

#3

konsumer - January 12, 2009 - 17:39

I 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?

#4

sdboyer - January 12, 2009 - 17:47

First 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.

#5

jpetso - January 12, 2009 - 18:31

Much 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.

#6

neptunix - March 5, 2009 - 20:28

Had the same problem with svn. Resolved by hacking versioncontrol.pages.inc

#7

jpetso - March 14, 2009 - 19:19

@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.

#8

jpetso - March 14, 2009 - 19:27
Version:5.x-2.x-dev» 6.x-1.0-beta5

Moving 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).

#9

jpetso - April 3, 2009 - 15:49

I think this should be a backend-specific API function, like versioncontrol_is_valid_username($repository, $username) respectively versioncontrol_[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?

#10

CorniI - April 3, 2009 - 15:55
Assigned to:Anonymous» CorniI

it's me :)

#11

CorniI - April 3, 2009 - 18:38
Status:active» needs review

here'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.

AttachmentSize
0001-implement-a-username-check-for-the-backend.patch 2.73 KB

#12

CorniI - April 3, 2009 - 18:48

patch was crap, another try...

AttachmentSize
0001-implement-a-username-check-for-the-backend.patch 1.84 KB

#13

jpetso - April 3, 2009 - 19:03
Status:needs review» needs work

Looks 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?)

#14

CorniI - April 3, 2009 - 19:39
Status:needs work» needs review

ok
i still have to practise with git-format-patch, now i offer you two patches...

AttachmentSize
0001-implement-a-username-check-for-the-backend.patch 1.84 KB
0002-fakevcs-and-codestyle.patch 2.23 KB

#15

jpetso - April 3, 2009 - 22:11
Status:needs review» fixed

I 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 :)

#16

jpetso - April 3, 2009 - 22:12

Note: 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.

#17

System Message - April 17, 2009 - 22:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.