Skip to content

Create or update local git config when user changes Che Theia git settings  #21115

Description

@l0rd

Is your enhancement related to a problem? Please describe

If the user changes git user and git email in Che Theia settings.json and restarts the workspace he still has this message in the status bar:

image

Moreover the gitconfig ConfigMap expected by the DevWorkspace operator is not created so if using git from the command line the email and name will be missing and the user won't be able to commit:

image

Describe the solution you'd like

When a user changes the git user name or git user email settings in Che-Theia, if the gitconfig ConfigMap
- doesn't exist: create one with the content matching the one in Theia settings.json
- exist: update the content with the new changes but don't delete other gitconfig settings

  • Theia user preferences should be persisted in a configmap (that's already the case, the CM is workspace-preferences-configmap)
  • At Theia startup copy git user name and email from Theia user preferences to local git config. But only if they don't exist yet (for example if local git config file doesn't exist or if it exist or it doesn't include user.email or user.name). Note that /etc/gitconfig/ may exist and have different values but Theia preference and local git config have higher priority.
  • If user sets or updates Theia preferences the values should be copied to local git config if previous values matched. That means that if theia preferences and gitconfig had the same values than they should be kept in sync, if they had different values they should not be sync.
  • If local git config is updated (manually by the user), Theia user preferences should not be changed.
  • If local git config is created, Theia preferences should not be changed.

Note that local git config is the file under $PROJECT_SOURCE/.git/config

Metadata

Metadata

Assignees

Labels

area/pluginskind/enhancementA feature request - must adhere to the feature request template.severity/P1Has a major impact to usage or development of the system.sprint/current

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions