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
ac9f9231
Commit
ac9f9231
authored
Jan 03, 2014
by
Russell Belfer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2022 from KTXSoftware/development
submodule branch option + little VS2013 fix
parents
5f5e4465
10311979
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
1 deletions
+30
-1
include/git2/submodule.h
+8
-0
src/config_file.c
+1
-1
src/submodule.c
+20
-0
src/submodule.h
+1
-0
No files found.
include/git2/submodule.h
View file @
ac9f9231
...
@@ -284,6 +284,14 @@ GIT_EXTERN(const char *) git_submodule_path(git_submodule *submodule);
...
@@ -284,6 +284,14 @@ GIT_EXTERN(const char *) git_submodule_path(git_submodule *submodule);
GIT_EXTERN
(
const
char
*
)
git_submodule_url
(
git_submodule
*
submodule
);
GIT_EXTERN
(
const
char
*
)
git_submodule_url
(
git_submodule
*
submodule
);
/**
/**
* Get the branch for the submodule.
*
* @param submodule Pointer to submodule object
* @return Pointer to the submodule branch
*/
GIT_EXTERN
(
const
char
*
)
git_submodule_branch
(
git_submodule
*
submodule
);
/**
* Set the URL for the submodule.
* Set the URL for the submodule.
*
*
* This sets the URL in memory for the submodule. This will be used for
* This sets the URL in memory for the submodule. This will be used for
...
...
src/config_file.c
View file @
ac9f9231
...
@@ -213,7 +213,7 @@ static int config_refresh(git_config_backend *cfg)
...
@@ -213,7 +213,7 @@ static int config_refresh(git_config_backend *cfg)
int
res
=
0
,
updated
=
0
,
any_updated
=
0
;
int
res
=
0
,
updated
=
0
,
any_updated
=
0
;
diskfile_backend
*
b
=
(
diskfile_backend
*
)
cfg
;
diskfile_backend
*
b
=
(
diskfile_backend
*
)
cfg
;
git_strmap
*
old_values
;
git_strmap
*
old_values
;
struct
reader
*
reader
;
struct
reader
*
reader
=
NULL
;
uint32_t
i
;
uint32_t
i
;
for
(
i
=
0
;
i
<
git_array_size
(
b
->
readers
);
i
++
)
{
for
(
i
=
0
;
i
<
git_array_size
(
b
->
readers
);
i
++
)
{
...
...
src/submodule.c
View file @
ac9f9231
...
@@ -472,6 +472,10 @@ int git_submodule_save(git_submodule *submodule)
...
@@ -472,6 +472,10 @@ int git_submodule_save(git_submodule *submodule)
(
error
=
git_config_file_set_string
(
mods
,
key
.
ptr
,
submodule
->
url
))
<
0
)
(
error
=
git_config_file_set_string
(
mods
,
key
.
ptr
,
submodule
->
url
))
<
0
)
goto
cleanup
;
goto
cleanup
;
if
((
error
=
submodule_config_key_trunc_puts
(
&
key
,
"branch"
))
<
0
||
(
error
=
git_config_file_set_string
(
mods
,
key
.
ptr
,
submodule
->
branch
))
<
0
)
goto
cleanup
;
if
(
!
(
error
=
submodule_config_key_trunc_puts
(
&
key
,
"update"
))
&&
if
(
!
(
error
=
submodule_config_key_trunc_puts
(
&
key
,
"update"
))
&&
(
val
=
git_submodule_update_to_str
(
submodule
->
update
))
!=
NULL
)
(
val
=
git_submodule_update_to_str
(
submodule
->
update
))
!=
NULL
)
error
=
git_config_file_set_string
(
mods
,
key
.
ptr
,
val
);
error
=
git_config_file_set_string
(
mods
,
key
.
ptr
,
val
);
...
@@ -528,6 +532,12 @@ const char *git_submodule_url(git_submodule *submodule)
...
@@ -528,6 +532,12 @@ const char *git_submodule_url(git_submodule *submodule)
return
submodule
->
url
;
return
submodule
->
url
;
}
}
const
char
*
git_submodule_branch
(
git_submodule
*
submodule
)
{
assert
(
submodule
);
return
submodule
->
branch
;
}
int
git_submodule_set_url
(
git_submodule
*
submodule
,
const
char
*
url
)
int
git_submodule_set_url
(
git_submodule
*
submodule
,
const
char
*
url
)
{
{
assert
(
submodule
&&
url
);
assert
(
submodule
&&
url
);
...
@@ -992,6 +1002,7 @@ static git_submodule *submodule_alloc(git_repository *repo, const char *name)
...
@@ -992,6 +1002,7 @@ static git_submodule *submodule_alloc(git_repository *repo, const char *name)
sm
->
update
=
sm
->
update_default
=
GIT_SUBMODULE_UPDATE_CHECKOUT
;
sm
->
update
=
sm
->
update_default
=
GIT_SUBMODULE_UPDATE_CHECKOUT
;
sm
->
fetch_recurse
=
GIT_SUBMODULE_RECURSE_YES
;
sm
->
fetch_recurse
=
GIT_SUBMODULE_RECURSE_YES
;
sm
->
repo
=
repo
;
sm
->
repo
=
repo
;
sm
->
branch
=
NULL
;
return
sm
;
return
sm
;
}
}
...
@@ -1190,6 +1201,15 @@ static int submodule_load_from_config(
...
@@ -1190,6 +1201,15 @@ static int submodule_load_from_config(
goto
done
;
goto
done
;
}
}
}
}
else
if
(
strcasecmp
(
property
,
"branch"
)
==
0
)
{
git__free
(
sm
->
branch
);
sm
->
branch
=
NULL
;
if
(
value
!=
NULL
&&
(
sm
->
branch
=
git__strdup
(
value
))
==
NULL
)
{
error
=
-
1
;
goto
done
;
}
}
else
if
(
strcasecmp
(
property
,
"update"
)
==
0
)
{
else
if
(
strcasecmp
(
property
,
"update"
)
==
0
)
{
if
((
error
=
git_submodule_parse_update
(
&
sm
->
update
,
value
))
<
0
)
if
((
error
=
git_submodule_parse_update
(
&
sm
->
update
,
value
))
<
0
)
goto
done
;
goto
done
;
...
...
src/submodule.h
View file @
ac9f9231
...
@@ -81,6 +81,7 @@ struct git_submodule {
...
@@ -81,6 +81,7 @@ struct git_submodule {
char
*
name
;
char
*
name
;
char
*
path
;
/* important: may just point to "name" string */
char
*
path
;
/* important: may just point to "name" string */
char
*
url
;
char
*
url
;
char
*
branch
;
git_submodule_update_t
update
;
git_submodule_update_t
update
;
git_submodule_update_t
update_default
;
git_submodule_update_t
update_default
;
git_submodule_ignore_t
ignore
;
git_submodule_ignore_t
ignore
;
...
...
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