ek9_git_add
Reports stagedPaths and stagedPathCount (what this call staged), then indexAfter and indexAfterCount (everything now staged) and a summary line.
When to use it
'Stage these files for the next commit' - one call with paths:[...] or all:true; the first step of stage, commit, push. Staging copies the CURRENT content, so edits made afterwards need staging again.
When not to use it
- recording the staged changes - use
ek9_git_commit(its paths:[...] stages and commits in one call). - seeing what is staged, modified or untracked - use
ek9_git_status. - undoing a mis-stage - use
ek9_git_restoremode:'unstage'.
Details
stagedPaths / stagedPathCount are what THIS call staged; indexAfter / indexAfterCount are the whole index afterwards, so one call can never be read as having staged the earlier entries. At least one of paths / all is required; a path outside the workspace, a path git cannot find, or a non-git workspace is refused with the route in nextStep.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
all | boolean | Stage every change including deletions (git add -A). Default false. | |
paths | array of string | Workspace-relative paths to stage. |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
Named path into existing index
Request
{
"paths" : [ "new.txt" ]
}
Response
{
"all" : false,
"indexAfter" : [ "new.txt", "tracked.txt" ],
"indexAfterCount" : 2,
"meta" : {
"serverMs" : "<timing>"
},
"stagedPathCount" : 1,
"stagedPaths" : [ "new.txt" ],
"status" : "staged",
"summary" : "Staged 1 path; the index now holds 2 paths",
"written" : true
}