| layout |
default |
| menu_item |
api |
| title |
Filter |
| description |
Version 0.19.0 |
| return_to |
| API Documentation Index |
/api/ |
|
| sections |
| listContains |
listLength |
load |
unregister |
#applyToBlob |
#applyToData |
#applyToFile |
#free |
#lookup |
#register |
FLAG |
MODE |
Instance Variables |
#listContains |
#listLength |
#load |
#unregister |
#applyToBlob |
#applyToData |
#applyToFile |
#free |
#lookup |
#register |
#FLAG |
#MODE |
#ivars |
|
var filter = new Filter();
var result = Filter.listContains(filters, name);
| Parameters |
Type |
|
| filters |
FilterList |
A loaded git_filter_list (or NULL) |
| name |
String |
The name of the filter to query |
| Returns |
|
| Number |
1 if the filter is in the list, 0 otherwise |
var result = Filter.listLength(fl);
| Returns |
|
| Number |
The number of filters in the list |
Filter.load(repo, blob, path, mode, flags).then(function(filterList) {
// Use filterList
});
| Parameters |
Type |
|
| repo |
Repository |
Repository object that contains path |
| blob |
Blob |
The blob to which the filter will be applied (if known) |
| path |
String |
Relative path of the file to be filtered |
| mode |
Number |
Filtering direction (WT->ODB or ODB->WT) |
| flags |
Number |
Combination of git_filter_flag_t flags |
| Returns |
|
| FilterList |
Output newly created git_filter_list (or NULL) |
var result = Filter.unregister(name);
| Parameters |
Type |
|
| name |
String |
The name under which the filter was registered |
| Returns |
|
| Number |
0 on success, error code |
| < |
|
| 0 on failure |
|
filter.applyToBlob(blob).then(function(buf) {
// Use buf
});
| Parameters | Type |
| --- | --- | --- |
| blob | Blob | the blob to filter |
| Returns |
|
| Buf |
buffer into which to store the filtered file |
filter.applyToData(in).then(function(buf) {
// Use buf
});
| Parameters | Type |
| --- | --- | --- |
| in | Buf | Buffer containing the data to filter |
| Returns |
|
| Buf |
Buffer to store the result of the filtering |
filter.applyToFile(repo, path).then(function(buf) {
// Use buf
});
| Parameters | Type |
| --- | --- | --- |
| repo | Repository | the repository in which to perform the filtering |
| path | String | the path of the file to filter, a relative path will be taken as relative to the workdir |
| Returns |
|
| Buf |
buffer into which to store the filtered file |
var filter = filter.lookup(name);
| Parameters | Type |
| --- | --- | --- |
| name | String | The name of the filter |
var result = filter.register(name, priority);
| Parameters | Type |
| --- | --- | --- |
| name | String | A name by which the filter can be referenced. Attempting to register with an in-use name will return GIT_EEXISTS. |
| priority | Number | The priority for filter application |
| Returns |
|
| Number |
0 on successful registry, error code |
| < |
|
| 0 on failure |
|
| Flag | Value |
| --- | --- | --- |
| Filter.FLAG.DEFAULT | 0 |
| Filter.FLAG.ALLOW_UNSAFE | 1 |
| Flag | Value |
| --- | --- | --- |
| Filter.MODE.TO_WORKTREE | 0 |
| Filter.MODE.SMUDGE | 0 |
| Filter.MODE.TO_ODB | 1 |
| Filter.MODE.CLEAN | 1 |
| Variable |
Type |
Description |
| apply |
FilterApplyFn |
|
| attributes |
String |
|
| check |
FilterCheckFn |
|
| cleanup |
FilterCleanupFn |
|
| initialize |
FilterInitFn |
|
| shutdown |
FilterShutdownFn |
|
| version |
Number |
|