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

Bug 371062

Summary: [github] Authentication errors when attempting to edit repository
Product: [Technology] EGit Reporter: Thomas Hallgren <thomas>
Component: MylynAssignee: Kevin Sawicki <kevin>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: kevin
Version: unspecified   
Target Milestone: 1.3   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Thomas Hallgren CLA 2012-02-09 06:20:20 EST
When using the RepositoryService.editRepository() I always get a 422 response. I think it might be because the json that is sent contains all attributes of the repository and some of them is read-only?

I tested by modifying the json so that it only contained the field that I wanted to change (the description) and that worked OK.

The flow that fails is:

1. Obtain a Repository instance from GitHub
2. Change it's description
3. Call the editRepository with that instance

Ideally, I would like a method to change individual fields and/or deleting their value. Perhaps the editRepository could take a Map<String,String> instead of a repository? Deleting a field would then be done as:

repoService.editRepository(Collections.singletonMap("language", null));
Comment 1 Kevin Sawicki CLA 2012-02-09 18:11:32 EST
Are you getting an error message back and if so what is it?
Comment 2 Thomas Hallgren CLA 2012-02-09 18:23:17 EST
I got 422 back. Don't have that branch running now but IIRC, the message was "not authorized" which is bogus given the 422 "Unprocessable Entity" code. I know for sure that I was authorized since the call went through when I altered the json string in my debugger.
Comment 3 Kevin Sawicki CLA 2012-02-09 19:46:34 EST
Pushed a change to https://git.eclipse.org/r/#/c/5062/ that adds the ability to edit certain fields only
Comment 4 Kevin Sawicki CLA 2012-02-10 13:29:38 EST
I fixed this on the server side to no longer incorrectly return a 422, you should be able to now edit successfully.

Please let me know if you still see issues,  I still plan on adding the convenience edit call for the 1.3 release.
Comment 5 Kevin Sawicki CLA 2012-02-10 16:40:13 EST
Merged commit 056626f17e1fd11b80d11366d12311110ce2e2b7 to master that adds support for editing given repository fields only
Comment 6 Thomas Hallgren CLA 2012-02-22 06:15:41 EST
The change you made on the server side works well for us. Thanks.