Bug 347351 - commit fails when no git user/email are configured
Summary: commit fails when no git user/email are configured
Status: RESOLVED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: git (show other bugs)
Version: git master
Platform: Other Linux
: NOR grave
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2015-05-06 22:20 UTC by Milian Wolff
Modified: 2016-12-13 08:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Milian Wolff 2015-05-06 22:20:08 UTC
see: https://build.kde.org/job/kdevplatform%20master%20kf5-qt5/PLATFORM=Linux,compiler=gcc/55/testReport/(root)/TestSuite/test_kdevgit/

QDEBUG : GitInitTest::testCommit() kdevplatform.vcs: Execute dvcs command: "git commit -m 'Test commit' -- /tmp/kdevGit_testdir/"
QDEBUG : GitInitTest::testCommit() kdevplatform.vcs: oops, found an error while running "git commit -m 'Test commit' -- /tmp/kdevGit_testdir/" : "UnknownError" Exit code is: 128

this is b/c the CI has no global user.email / user.name configured and then git will complain:

cd /tmp
mkdir test
cd test
git init
# now edit .git/config and add the following lines:
[user]
        email =
        name =
# now continue:
echo 42 > answer
git add answer
git commit -a -m "test"

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for <milian@localhost.localdomain>) not allowed


Reproducible: Always
Comment 1 Kevin Funk 2016-01-08 11:27:02 UTC
Is this just about the CI failure? If yes, I fixed this a while ago...

Do we need changes to handle this case in a normal KDevelop run?

(I don't think so, you already get the output in the terminal view afaik, so the user knows what's going wrong).
Comment 2 Milian Wolff 2016-01-09 15:45:52 UTC
there should be a dialog that lets the user input the mail and email, if he hasn't ever configured that and is trying to open a git project in kdevelop. just showing an error in the console is not enough, imo.
Comment 3 Kevin Funk 2016-02-02 23:22:11 UTC
Git commit 2df0558b458dae469473e117ad6045a29802359a by Kevin Funk, on behalf of Artur Puzio.
Committed on 02/02/2016 at 23:21.
Pushed by kfunk into branch '5.0'.

Git: Display dialog to configure user & name

Summary:
Added function to get git config
Added checking of `user.email` and `user.name` when committing
Added possibility to configure global git parameters
Added `QDialog` extension to choose the name and email, with possibility to save the settings as global and validation.
Used the extension to handle the lack of `user.name` or `user.email` configured when committing.
Added unit tests for readConfigOption and setConfigOption.
This fixes the [[ https://bugs.kde.org/show_bug.cgi?id=347351 | Bug 347351 ]]

Test Plan:
The new dialog works fine.
Tests pass.
FIXED-IN: 5.0

Reviewers: kfunk

Reviewed By: kfunk

Subscribers: mwolff, kdevelop-devel

Differential Revision: https://phabricator.kde.org/D852

M  +2    -0    plugins/git/CMakeLists.txt
A  +82   -0    plugins/git/gitnameemaildialog.cpp     [License: LGPL (v2+)]
A  +54   -0    plugins/git/gitnameemaildialog.h     [License: LGPL (v2+)]
A  +145  -0    plugins/git/gitnameemaildialog.ui
M  +33   -3    plugins/git/gitplugin.cpp
M  +2    -1    plugins/git/gitplugin.h
M  +2    -0    plugins/git/tests/CMakeLists.txt
M  +29   -0    plugins/git/tests/test_git.cpp
M  +1    -0    plugins/git/tests/test_git.h

http://commits.kde.org/kdevplatform/2df0558b458dae469473e117ad6045a29802359a