Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
c868981f
Commit
c868981f
authored
Jan 06, 2015
by
David Calavera
Committed by
Edward Thomson
Jan 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add extern function to initialize submodule update options.
parent
6a6c24e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
3 deletions
+30
-3
include/git2/submodule.h
+18
-3
src/submodule.c
+7
-0
tests/structinit/structinit.c
+5
-0
No files found.
include/git2/submodule.h
View file @
c868981f
...
...
@@ -110,9 +110,10 @@ typedef enum {
/**
* Submodule update options structure
*
* Use the GIT_SUBMODULE_UPDATE_OPTIONS_INIT to get the default settings, like this:
* Use the GIT_SUBMODULE_UPDATE_OPTIONS_INIT to get the default settings,
* like this:
*
*
git_submodule_update_options opts = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
*
git_submodule_update_options opts = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
*/
typedef
struct
git_submodule_update_options
{
unsigned
int
version
;
...
...
@@ -149,7 +150,21 @@ typedef struct git_submodule_update_options {
}
git_submodule_update_options
;
#define GIT_SUBMODULE_UPDATE_OPTIONS_VERSION 1
#define GIT_SUBMODULE_UPDATE_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION, {GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE}, GIT_REMOTE_CALLBACKS_INIT, GIT_CHECKOUT_SAFE_CREATE}
#define GIT_SUBMODULE_UPDATE_OPTIONS_INIT \
{ GIT_CHECKOUT_OPTIONS_VERSION, \
{ GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE}, \
GIT_REMOTE_CALLBACKS_INIT, GIT_CHECKOUT_SAFE_CREATE }
/**
* Initializes a `git_submodule_update_options` with default values.
* Equivalent to creating an instance with GIT_SUBMODULE_UPDATE_OPTIONS_INIT.
*
* @param opts The `git_submodule_update_options` instance to initialize.
* @param version Version of struct; pass `GIT_SUBMODULE_UPDATE_OPTIONS_VERSION`
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN
(
int
)
git_submodule_update_init_options
(
git_submodule_update_options
*
opts
,
unsigned
int
version
);
/**
* Update a submodule. This will clone a missing submodule and
...
...
src/submodule.c
View file @
c868981f
...
...
@@ -898,6 +898,13 @@ static int git_submodule_update_repo_init_cb(
return
submodule_repo_create
(
out
,
sm
->
repo
,
path
);
}
int
git_submodule_update_init_options
(
git_submodule_update_options
*
opts
,
unsigned
int
version
)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE
(
opts
,
version
,
git_submodule_update_options
,
GIT_SUBMODULE_UPDATE_OPTIONS_INIT
);
return
0
;
}
int
git_submodule_update
(
git_submodule
*
sm
,
int
init
,
git_submodule_update_options
*
_update_options
)
{
int
error
;
...
...
tests/structinit/structinit.c
View file @
c868981f
...
...
@@ -125,4 +125,9 @@ void test_structinit_structinit__compare(void)
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
git_refdb_backend
,
GIT_REFDB_BACKEND_VERSION
,
\
GIT_REFDB_BACKEND_INIT
,
git_refdb_init_backend
);
/* submodule update */
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
git_submodule_update_options
,
GIT_SUBMODULE_UPDATE_OPTIONS_VERSION
,
\
GIT_SUBMODULE_UPDATE_OPTIONS_INIT
,
git_submodule_update_init_options
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment