Skip to content

Latest commit

 

History

History
199 lines (152 loc) · 5.51 KB

File metadata and controls

199 lines (152 loc) · 5.51 KB
layout default
menu_item api
title Worktree
description Version 0.26.1
return_to
API Documentation Index
/api/
sections
add list lookup openFromRepository #isLocked #isPrunable #lock #name #path #prune #unlock #validate PRUNE
#add
#list
#lookup
#openFromRepository
#isLocked
#isPrunable
#lock
#name
#path
#prune
#unlock
#validate
#PRUNE

Worktree.add AsyncExperimental

Worktree.add(repo, name, path, opts).then(function(worktree) {
  // Use worktree
});
Parameters Type
repo Repository Repository to create working tree for
name String Name of the working tree
path String Path to create working tree at
opts WorktreeAddOptions Options to modify default behavior. May be NULL
Returns
Worktree

Worktree.list AsyncExperimental

Worktree.list(repo).then(function(strarray) {
  // Use strarray
});
Parameters Type
repo Repository the repo to use when listing working trees
Returns
Strarray

Worktree.lookup AsyncExperimental

Worktree.lookup(repo, name).then(function(worktree) {
  // Use worktree
});
Parameters Type
repo Repository The repository containing worktrees
name String Name of the working tree to look up
Returns
Worktree

Worktree.openFromRepository AsyncExperimental

Worktree.openFromRepository(repo).then(function(worktree) {
  // Use worktree
});
Parameters Type
repo Repository Repository to look up worktree for
Returns
Worktree

Worktree#isLocked SyncExperimental

var result = worktree.isLocked(reason);

| Parameters | Type | | --- | --- | --- | | reason | Buf | Buffer to store reason in. If NULL no reason is stored. |

Returns
Number 0 when the working tree not locked, a value greater
than zero if it is locked, less than zero if there was an
error

Worktree#isPrunable SyncExperimental

var result = worktree.isPrunable(opts);

| Parameters | Type | | --- | --- | --- | | opts | WorktreePruneOptions | |

Returns
Number

Worktree#lock SyncExperimental

var result = worktree.lock(reason);

| Parameters | Type | | --- | --- | --- | | reason | String | Reason why the working tree is being locked |

Returns
Number 0 on success, non-zero otherwise

Worktree#name SyncExperimental

var string = worktree.name();
Returns
String

Worktree#path SyncExperimental

var string = worktree.path();
Returns
String

Worktree#prune SyncExperimental

var result = worktree.prune(opts);

| Parameters | Type | | --- | --- | --- | | opts | WorktreePruneOptions | Specifies which checks to override. See git_worktree_is_prunable. May be NULL |

Returns
Number 0 or an error code

Worktree#unlock SyncExperimental

var result = worktree.unlock();
Returns
Number 0 on success, 1 if worktree was not locked, error-code
otherwise

Worktree#validate SyncExperimental

var result = worktree.validate();
Returns
Number 0 when worktree is valid, error-code otherwise

Worktree.PRUNE ENUM

| Flag | Value | | --- | --- | --- | | Worktree.PRUNE.GIT_WORKTREE_PRUNE_VALID | 1 | | Worktree.PRUNE.GIT_WORKTREE_PRUNE_LOCKED | 2 | | Worktree.PRUNE.GIT_WORKTREE_PRUNE_WORKING_TREE | 4 |