Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 371472

Summary: Attempt to add a new entry to git configuration that already exists overwrites
Product: [ECD] Orion Reporter: Malgorzata Janczarska <malgorzata.tomczyk>
Component: GitAssignee: Tomasz Zarna <tomasz.zarna>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Szymon.Brandys
Version: 0.4   
Target Milestone: 0.5 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Malgorzata Janczarska CLA 2012-02-14 05:19:55 EST
1. Got to git repository configuration page
2. Click New Configuration Entry
3. Input an entry with a key that already exists
4. Input a value that is different from current value for this entry
5. Hit OK
Result:
1. Operation is successful
2. Previous entry is overwritten
Should be:
1. Operation is not successful
2. System presents info that entry key already exists and has a different value
3. System proposes to overwrite the entry with the new value
Comment 1 Tomasz Zarna CLA 2012-02-14 05:36:17 EST
This is by design, it's how git config works. I agree we could do better then that, though.

How does 409 (Conflict) returned from the server in that case sound to you? Will you be able to handle the response in the client?
Comment 2 Malgorzata Janczarska CLA 2012-02-14 05:54:22 EST
(In reply to comment #1)
> How does 409 (Conflict) returned from the server in that case sound to you?
> Will you be able to handle the response in the client?

Not bad, but I would like to have a flag "force" as well that would ignore this error if set to "true". This way we could do scenario as follows:
1. Try to add an entry with "force=false"
2. 409 returns
3. We display information about a conflict and ask if user wants to overwrite
4. If user says "yes" we retry with "force" flag set to true.

I know we can achieve this with trying to edit, but if the force scenario is default for git it could be useful to have it for tests or other implementations.
Comment 3 Tomasz Zarna CLA 2012-02-14 07:07:28 EST
The flag is not needed. Just send PUT (update) request instead of the original POST (create).
Comment 4 Tomasz Zarna CLA 2012-03-16 09:36:38 EDT
Fixed with 3d9b22cf1918d021c318b6d5911273e99a482032