Review Request 115232: Check that git configuration has user.email & user.name before allowing to use git.

Mikhail Krutov nekoxmachina at gmail.com
Thu Jan 23 10:39:59 UTC 2014



> On Jan. 22, 2014, 9:58 p.m., Aleix Pol Gonzalez wrote:
> > Still, I think that this check should be delayed, there's no reason to have it happening that early in the plugin execution. Also it shouldn't be blocking the execution (that is, drop waitForFinished calls).
> > 
> > What about calling a "GitPlugins::errorsFound()" instead? this way it wouldn't be blocking. I don't know if anybody is expecting to edit this from KDevelop.
> 
> Mikhail Krutov wrote:
>     >I don't know if anybody is expecting to edit this from KDevelop.
>     I didn't find a way to get the user email from within KDE code; especially if user does not have kmail/kdepim set up; thus I made an editable input-boxes.
>     Without the editing; should git be initialized to some sane default (like KUser::loginName() + @ "domain_name")?
>     
>
> 
> Andreas Pakulat wrote:
>     Maybe it should rather be investigated why initializing a repository through kdevelop and creating an initial commit does not use the users login and username as configured on the system? Standalone git does exactly what you propose if you do
>     
>     git init
>     touch foo
>     git add foo
>     git commit -m "Initial Commit"
>     
>     in a terminal. So there has to be some reason why the same sequence (I'm assuming its roughly the same) fails in KDevelop and by fixing that you're avoiding all the discussion around when to ask, what defaults to take etc. and simply leave it to git. That also means there's not going to be any confusion by users that occasionally use git from commandline and wonder why kdevelop proposes different values for these.

Actually, not 100% true:
git may fail to detect user.email if system domain is not validated:
fatal: unable to auto-detect email address (got 'neko at nekobox.(none)')

KDevelop is able to create project without user.name configuration (checked it just now, sorry, should've earlier :)) and with valid user.email configuration; but fails in situation where git is unable to detect email properly (as stated above).
This happens because, when creating project from template & using git, not only git init happens (which passes in any circumstances), but also
$git add <templatefiles>
$git commit -m "initial" 
which fails.

This is not a problem in case of create new project operation (user gets detailed error message & kdialog with error), but that is a problem in case of git commit, which fails silently from KDevelop when user does not have his git configured (for ex.: newly installed system, cloned git repo, kdevelop, no ~/.gitconfig, git unable to detect user.email).

If this should be handled by git, I see that there should be a checker before git commit (probably before other actions too) that would validate git configuration/configuration autodetect & will call gitPlugins::errorsFound() in case that git is unable to commit due to some reason. (in fact, from what I see it would be better to check not the validness of git config, cause that may change, but rather for stderr of git process to find if git finds something undesirable/wrong (e.g. print stderr into log window of kdevelop).
Would that be OK?


- Mikhail


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115232/#review48083
-----------------------------------------------------------


On Jan. 22, 2014, 9:51 p.m., Mikhail Krutov wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/115232/
> -----------------------------------------------------------
> 
> (Updated Jan. 22, 2014, 9:51 p.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdevplatform
> 
> 
> Description
> -------
> 
> https://bugs.kde.org/show_bug.cgi?id=327931
> When user did not setup git config user.email && user.name, get current KUser.fullName & prompt user to enter his email.
> 
> 
> Diffs
> -----
> 
>   plugins/git/gitplugin.h 0d50dbe 
>   plugins/git/gitplugin.cpp abd7e7f 
> 
> Diff: https://git.reviewboard.kde.org/r/115232/diff/
> 
> 
> Testing
> -------
> 
> Install kdevgit.so plugin, then run KDevelop with empty ~/.gitconfig & with valid ~/.gitconfig
> This patch has an issue that KDialog is not an active window on KDevelop start (e.g. KDevelop takes WM focus).
> 
> 
> Thanks,
> 
> Mikhail Krutov
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20140123/52fe3efc/attachment.html>


More information about the KDevelop-devel mailing list