layout
default
menu_item
api
title
Submodule
description
Version 0.19.0
return_to
API Documentation Index
/api/
sections
addSetup
foreach
lookup
resolveUrl
setBranch
setFetchRecurseSubmodules
setIgnore
setUpdate
setUrl
status
updateInitOptions
#addFinalize
#addToIndex
#branch
#fetchRecurseSubmodules
#free
#headId
#ignore
#indexId
#init
#location
#name
#open
#owner
#path
#reload
#repoInit
#sync
#update
#updateStrategy
#url
#wdId
IGNORE
RECURSE
STATUS
UPDATE
#addSetup
#foreach
#lookup
#resolveUrl
#setBranch
#setFetchRecurseSubmodules
#setIgnore
#setUpdate
#setUrl
#status
#updateInitOptions
#addFinalize
#addToIndex
#branch
#fetchRecurseSubmodules
#free
#headId
#ignore
#indexId
#init
#location
#name
#open
#owner
#path
#reload
#repoInit
#sync
#update
#updateStrategy
#url
#wdId
#IGNORE
#RECURSE
#STATUS
#UPDATE
Submodule . addSetup ( repo , url , path , use_gitlink ) . then ( function ( submodule ) {
// Use submodule
} ) ;
Parameters
Type
repo
Repository
The repository in which you want to create the submodule
url
String
URL for the submodule's remote
path
String
Path at which the submodule should be created
use_gitlink
Number
Should workdir contain a gitlink to the repo in .git/modules vs. repo directly in workdir.
Returns
Submodule
The newly created submodule ready to open for clone
Submodule . foreach ( repo , callback , payload ) . then ( function ( result ) {
// Use result
} ) ;
Parameters
Type
repo
Repository
The repository
callback
SubmoduleCb
Function to be called with the name of each submodule. Return a non-zero value to terminate the iteration.
payload
Void
Extra data to pass to callback
Returns
Number
0 on success, -1 on error, or non-zero return value of callback
Submodule . lookup ( repo , name ) . then ( function ( submodule ) {
// Use submodule
} ) ;
Parameters
Type
repo
Repository
The parent repository
name
String
The name of or path to the submodule; trailing slashes okay
Returns
Submodule
Output ptr to submodule; pass NULL to just get return code
Submodule. resolveUrl Async
Submodule . resolveUrl ( repo , url ) . then ( function ( buf ) {
// Use buf
} ) ;
Parameters
Type
repo
Repository
Pointer to repository object
url
String
Relative url
Returns
Buf
buffer to store the absolute submodule url in
var result = Submodule . setBranch ( repo , name , branch ) ;
Parameters
Type
repo
Repository
the repository to affect
name
String
the name of the submodule to configure
branch
String
Branch that should be used for the submodule
Returns
Number
0 on success,
<
0 on failure
Submodule. setFetchRecurseSubmodules Sync
var result = Submodule . setFetchRecurseSubmodules ( repo , name , fetch_recurse_submodules ) ;
Parameters
Type
repo
Repository
the repository to affect
name
String
the submodule to configure
fetch_recurse_submodules
Number
Boolean value
Returns
Number
old value for fetchRecurseSubmodules
Submodule. setIgnore Async
Submodule . setIgnore ( repo , name , ignore ) . then ( function ( result ) {
// Use result
} ) ;
Parameters
Type
repo
Repository
the repository to affect
name
String
the name of the submdule
ignore
Number
The new value for the ignore rule
Returns
Number
0 or an error code
Submodule. setUpdate Async
Submodule . setUpdate ( repo , name , update ) . then ( function ( result ) {
// Use result
} ) ;
Parameters
Type
repo
Repository
the repository to affect
name
String
the name of the submodule to configure
update
Number
The new value to use
Returns
Number
0 or an error code
Submodule . setUrl ( repo , name , url ) . then ( function ( result ) {
// Use result
} ) ;
Parameters
Type
repo
Repository
the repository to affect
name
String
the name of the submodule to configure
url
String
URL that should be used for the submodule
Returns
Number
0 on success,
<
0 on failure
Submodule . status ( repo , name , ignore ) . then ( function ( result ) {
// Use result
} ) ;
Parameters
Type
repo
Repository
the repository in which to look
name
String
name of the submodule
ignore
Number
the ignore rules to follow
Returns
Number
Combination of GIT_SUBMODULE_STATUS flags
Submodule. updateInitOptions Sync
var result = Submodule . updateInitOptions ( opts , version ) ;
Parameters
Type
opts
SubmoduleUpdateOptions
The git_submodule_update_options instance to initialize.
version
Number
Version of struct; pass GIT_SUBMODULE_UPDATE_OPTIONS_VERSION
Returns
Number
Zero on success; -1 on failure.
Submodule# addFinalize Async
submodule . addFinalize ( ) . then ( function ( result ) {
// Use result
} ) ;
Submodule# addToIndex Async
submodule . addToIndex ( write_index ) . then ( function ( result ) {
// Use result
} ) ;
| Parameters | Type |
| --- | --- | --- |
| write_index | Number | Boolean if this should immediately write the index file. If you pass this as false, you will have to get the git_index and explicitly call git_index_write() on it to save the change. |
Returns
Number
0 on success,
<
0 on failure
var string = submodule . branch ( ) ;
Submodule# fetchRecurseSubmodules Sync
var result = submodule . fetchRecurseSubmodules ( ) ;
Returns
Number
0 if fetchRecurseSubmodules is false, 1 if true
var oid = submodule . headId ( ) ;
var result = submodule . ignore ( ) ;
Returns
Number
The current git_submodule_ignore_t valyue what will be used for
var oid = submodule . indexId ( ) ;
submodule . init ( overwrite ) . then ( function ( result ) {
// Use result
} ) ;
| Parameters | Type |
| --- | --- | --- |
| overwrite | Number | By default, existing entries will not be overwritten, but setting this to true forces them to be updated. |
Returns
Number
0 on success,
<
0 on failure.
submodule . location ( ) . then ( function ( result ) {
// Use result
} ) ;
Returns
Number
Combination of first four GIT_SUBMODULE_STATUS flags
var string = submodule . name ( ) ;
submodule . open ( ) . then ( function ( repository ) {
// Use repository
} ) ;
var repository = submodule . owner ( ) ;
var string = submodule . path ( ) ;
var result = submodule . reload ( force ) ;
| Parameters | Type |
| --- | --- | --- |
| force | Number | Force reload even if the data doesn't seem out of date |
Returns
Number
0 on success,
<
0 on error
submodule . repoInit ( use_gitlink ) . then ( function ( repository ) {
// Use repository
} ) ;
| Parameters | Type |
| --- | --- | --- |
| use_gitlink | Number | Should the workdir contain a gitlink to the repo in .git/modules vs. repo directly in workdir. |
submodule . sync ( ) . then ( function ( result ) {
// Use result
} ) ;
submodule . update ( init , options ) . then ( function ( number ) {
// Use number
} ) ;
Updates a submodule
| Parameters | Type |
| --- | --- | --- |
| init | Number | Setting this to 1 will initialize submodule before updating |
| options | SubmoduleUpdateOptions | Submodule update settings |
Returns
Number
0 on success, any non-zero return value from a callback
Submodule# updateStrategy Sync
var result = submodule . updateStrategy ( ) ;
Returns
Number
The current git_submodule_update_t value that will be used
var string = submodule . url ( ) ;
var oid = submodule . wdId ( ) ;
| Flag | Value |
| --- | --- | --- |
| Submodule.IGNORE. UNSPECIFIED | -1 |
| Submodule.IGNORE. NONE | 1 |
| Submodule.IGNORE. UNTRACKED | 2 |
| Submodule.IGNORE. DIRTY | 3 |
| Submodule.IGNORE. ALL | 4 |
| Flag | Value |
| --- | --- | --- |
| Submodule.RECURSE. NO | 0 |
| Submodule.RECURSE. YES | 1 |
| Submodule.RECURSE. ONDEMAND | 2 |
| Flag | Value |
| --- | --- | --- |
| Submodule.STATUS. IN_HEAD | 1 |
| Submodule.STATUS. IN_INDEX | 2 |
| Submodule.STATUS. IN_CONFIG | 4 |
| Submodule.STATUS. IN_WD | 8 |
| Submodule.STATUS. INDEX_ADDED | 16 |
| Submodule.STATUS. INDEX_DELETED | 32 |
| Submodule.STATUS. INDEX_MODIFIED | 64 |
| Submodule.STATUS. WD_UNINITIALIZED | 128 |
| Submodule.STATUS. WD_ADDED | 256 |
| Submodule.STATUS. WD_DELETED | 512 |
| Submodule.STATUS. WD_MODIFIED | 1024 |
| Submodule.STATUS. WD_INDEX_MODIFIED | 2048 |
| Submodule.STATUS. WD_WD_MODIFIED | 4096 |
| Submodule.STATUS. WD_UNTRACKED | 8192 |
| Flag | Value |
| --- | --- | --- |
| Submodule.UPDATE. CHECKOUT | 1 |
| Submodule.UPDATE. REBASE | 2 |
| Submodule.UPDATE. MERGE | 3 |
| Submodule.UPDATE. NONE | 4 |
| Submodule.UPDATE. DEFAULT | 0 |