Bug 384608 - Git Config: Adding an invalid entry breaks the configuration
Summary: Git Config: Adding an invalid entry breaks the configuration
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-09 09:22 EDT by Edwin Kempin CLA
Modified: 2012-07-09 09:22 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Edwin Kempin CLA 2012-07-09 09:22:44 EDT
1. in the preferences go to 'Team' > 'Git' > 'Configuration'
2. open 'User Settings' tab
3. click on 'Add Entry...'
4. provide 'core.test[0]' as key and any value
5. click on 'Apply'
6. try to do some actions on this repository or open the same page in preferences again

Result:
A popup with the following error message is displayed: "Cannot read file ...\.gitconfig"

Stacktrace:
java.lang.RuntimeException: java.io.IOException: User config file ...\.gitconfig invalid org.eclipse.jgit.errors.ConfigInvalidException: Cannot read file ...\.gitconfig
	at org.eclipse.jgit.storage.file.FileRepository.getConfig(FileRepository.java:320)
	at org.eclipse.jgit.storage.file.FileRepository.getConfig(FileRepository.java:98)
	at org.eclipse.egit.ui.internal.preferences.GlobalConfigurationPreferencePage.createConfigurationEditor(GlobalConfigurationPreferencePage.java:300)
	at org.eclipse.egit.ui.internal.preferences.GlobalConfigurationPreferencePage.showRepositoryConfiguration(GlobalConfigurationPreferencePage.java:291)
	at org.eclipse.egit.ui.internal.preferences.GlobalConfigurationPreferencePage.createContents(GlobalConfigurationPreferencePage.java:167)
	at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:232)
	at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1501)
	at org.eclipse.jface.preference.PreferenceDialog$14.run(PreferenceDialog.java:1258)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
...

Expected:
1. Egit shouldn't allow to enter such invalid keys that break the configuration (it already checks for other things, e.g. that '.' is contained in the key')
2. If the configuration is invalid, maybe it should be still possible to open it in a normal text editor so that the user can fix it. Ideally EGit would provide some details about which entries in the configuration are invalid.