The warp10-ext-git
extension adds functions to interact with Git repositories.
The repositories the functions can interact with must reside in a directory configured in your Warp 10 configuration under key git.root
. This directory can contain symbolic links pointing to the actual repositories.
The functions provided by this extension do not aim at implementing all the features of Git, instead they are meant to simply allow a Warp 10 instance to store, load and list files maintained in a Git repository.
The functions rely on the capability mechanism introduced in Warp 10 2.7.2, so make sure you run a compatible version of Warp 10 before installing this extension.
The extension must first be declared in the configuration:
warpscript.extension.git = io.warp10.ext.git.GitWarpScriptExtension
Then the root directory where the extension expects to find the repository must be configured:
git.root = /path/to/git/root
Restart your Warp 10 instance, the extension will be loaded and its functions available.
Access rights are governed by token capabilities. The following capabilities are defined:
Capability | Token attribute | Description |
---|---|---|
git.repo |
.cap:git.repo |
The name of the repository the token grants access to. This is the name of the link or directory present in the directory pointed to by git.root . |
git.name |
.cap:git.name |
The name which will appear in commit messages for operations which modify a repository. If unset, warp10-ext-git will be used. |
git.email |
.cap:git.email |
The email address appearing in commit messages. If unset contact@senx.io will be used. |
git.subdir |
.cap:git.subdir |
Subdirectory of git.repo that this token grants access to, the rest of the repository will be invisible. Paths provided to or returned by functions are relative to this subdirectory. |
git.ro |
.cap:git.ro |
If this attribute is present, whatever the associated value, access to the repository is read only. |
In order to use the functions from this extension, you must first add the capabilities from a token to your execution environment via the CAPADD
function:
'TOKEN_WITH_CAPABILITIES' CAPADD
then the GIT*
functions can be used and interact with the repository for which capabilities are available.
The extension adds the following functions to the WarpScript language. The detailed documentation for each is available in dedicated pages.
Store some content in a file in a repository.
Remove files from a repository.
Retrieve data from a file in a repository.
Find files matching a regular expression in a repository.
Adds a tag to a repository.