Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338203 - [server] Provide REST API for git commit
Summary: [server] Provide REST API for git commit
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.2   Edit
Hardware: PC All
: P2 normal (vote)
Target Milestone: 0.2   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 338200 339088
Blocks: 336116
  Show dependency tree
 
Reported: 2011-02-25 06:48 EST by Tomasz Zarna CLA
Modified: 2011-09-01 11:41 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Zarna CLA 2011-02-25 06:48:11 EST
We're going to need REST API for git commit (passing a commit message, and a boolean for "amend" or not).
Comment 1 Tomasz Zarna CLA 2011-03-04 08:50:05 EST
Partially fixed with 7cd152c9c693e5993ad02275ca3d1c0168d0dace. 

To commit all staged files, do POST on /git/commit/file/{projectId} passing {"Message"[1]:<commit message>} in body. "Amend"[2] param is not yet supported, neither is committing a single file. I'm not able to specify these using CommitCommand[3]. I'll try to work around that limitation. 

To get a file content from HEAD, call GET on /git/commit/HEAD/file/{path}. For now only "HEAD" ref is accepted, but this could be extended in the future.

[1] org.eclipse.orion.server.git.GitConstants.KEY_COMMIT_MESSAGE
[2] org.eclipse.orion.server.git.GitConstants.KEY_COMMIT_AMEND
[3] org.eclipse.jgit.api.CommitCommand
Comment 2 Tomasz Zarna CLA 2011-03-07 09:24:04 EST
(In reply to comment #1)
> "Amend"[2] param is not yet supported,

See bug 339088.

> neither is committing a single file.

See http://egit.eclipse.org/r/#change,2635.
Comment 3 Tomasz Zarna CLA 2011-03-07 11:41:52 EST
Amending can be achieved by doing POST on /git/commit/file/{projectId} and passing an extra parameter in request body: {..., "Amend":"true"}. When omitted or set to "false" a regular commit is made.

So, the last missing bit here is being able to commit a single file (provide a path to commit). I'm keeping my fingers crossed for http://egit.eclipse.org/r/#change,2635, which should be helpful here.
Comment 4 Tomasz Zarna CLA 2011-03-08 05:07:41 EST
(In reply to comment #3)
> So, the last missing bit here is being able to commit a single file (provide a
> path to commit).

The last missing part has been moved to bug 339190. Marking as fixed.