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
9cd42358
Commit
9cd42358
authored
Nov 20, 2012
by
Russell Belfer
Committed by
Ben Straub
Nov 27, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API updates for submodule.h
parent
793c4385
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
27 deletions
+27
-27
include/git2/submodule.h
+3
-3
src/diff.c
+2
-2
src/diff_output.c
+2
-2
src/submodule.c
+8
-8
tests-clar/submodule/lookup.c
+12
-12
No files found.
include/git2/submodule.h
View file @
9cd42358
...
@@ -318,7 +318,7 @@ GIT_EXTERN(int) git_submodule_set_url(git_submodule *submodule, const char *url)
...
@@ -318,7 +318,7 @@ GIT_EXTERN(int) git_submodule_set_url(git_submodule *submodule, const char *url)
* @param submodule Pointer to submodule object
* @param submodule Pointer to submodule object
* @return Pointer to git_oid or NULL if submodule is not in index.
* @return Pointer to git_oid or NULL if submodule is not in index.
*/
*/
GIT_EXTERN
(
const
git_oid
*
)
git_submodule_index_
o
id
(
git_submodule
*
submodule
);
GIT_EXTERN
(
const
git_oid
*
)
git_submodule_index_id
(
git_submodule
*
submodule
);
/**
/**
* Get the OID for the submodule in the current HEAD tree.
* Get the OID for the submodule in the current HEAD tree.
...
@@ -326,7 +326,7 @@ GIT_EXTERN(const git_oid *) git_submodule_index_oid(git_submodule *submodule);
...
@@ -326,7 +326,7 @@ GIT_EXTERN(const git_oid *) git_submodule_index_oid(git_submodule *submodule);
* @param submodule Pointer to submodule object
* @param submodule Pointer to submodule object
* @return Pointer to git_oid or NULL if submodule is not in the HEAD.
* @return Pointer to git_oid or NULL if submodule is not in the HEAD.
*/
*/
GIT_EXTERN
(
const
git_oid
*
)
git_submodule_head_
o
id
(
git_submodule
*
submodule
);
GIT_EXTERN
(
const
git_oid
*
)
git_submodule_head_id
(
git_submodule
*
submodule
);
/**
/**
* Get the OID for the submodule in the current working directory.
* Get the OID for the submodule in the current working directory.
...
@@ -339,7 +339,7 @@ GIT_EXTERN(const git_oid *) git_submodule_head_oid(git_submodule *submodule);
...
@@ -339,7 +339,7 @@ GIT_EXTERN(const git_oid *) git_submodule_head_oid(git_submodule *submodule);
* @param submodule Pointer to submodule object
* @param submodule Pointer to submodule object
* @return Pointer to git_oid or NULL if submodule is not checked out.
* @return Pointer to git_oid or NULL if submodule is not checked out.
*/
*/
GIT_EXTERN
(
const
git_oid
*
)
git_submodule_wd_
o
id
(
git_submodule
*
submodule
);
GIT_EXTERN
(
const
git_oid
*
)
git_submodule_wd_id
(
git_submodule
*
submodule
);
/**
/**
* Get the ignore rule for the submodule.
* Get the ignore rule for the submodule.
...
...
src/diff.c
View file @
9cd42358
...
@@ -363,7 +363,7 @@ int git_diff__oid_for_file(
...
@@ -363,7 +363,7 @@ int git_diff__oid_for_file(
const
git_oid
*
sm_oid
;
const
git_oid
*
sm_oid
;
if
(
!
git_submodule_lookup
(
&
sm
,
repo
,
path
)
&&
if
(
!
git_submodule_lookup
(
&
sm
,
repo
,
path
)
&&
(
sm_oid
=
git_submodule_wd_
o
id
(
sm
))
!=
NULL
)
(
sm_oid
=
git_submodule_wd_id
(
sm
))
!=
NULL
)
git_oid_cpy
(
oid
,
sm_oid
);
git_oid_cpy
(
oid
,
sm_oid
);
else
{
else
{
/* if submodule lookup failed probably just in an intermediate
/* if submodule lookup failed probably just in an intermediate
...
@@ -496,7 +496,7 @@ static int maybe_modified(
...
@@ -496,7 +496,7 @@ static int maybe_modified(
/* grab OID while we are here */
/* grab OID while we are here */
if
(
git_oid_iszero
(
&
nitem
->
oid
))
{
if
(
git_oid_iszero
(
&
nitem
->
oid
))
{
const
git_oid
*
sm_oid
=
git_submodule_wd_
o
id
(
sub
);
const
git_oid
*
sm_oid
=
git_submodule_wd_id
(
sub
);
if
(
sm_oid
!=
NULL
)
{
if
(
sm_oid
!=
NULL
)
{
git_oid_cpy
(
&
noid
,
sm_oid
);
git_oid_cpy
(
&
noid
,
sm_oid
);
use_noid
=
&
noid
;
use_noid
=
&
noid
;
...
...
src/diff_output.c
View file @
9cd42358
...
@@ -287,8 +287,8 @@ static int get_workdir_sm_content(
...
@@ -287,8 +287,8 @@ static int get_workdir_sm_content(
if
((
file
->
flags
&
GIT_DIFF_FILE_VALID_OID
)
==
0
)
{
if
((
file
->
flags
&
GIT_DIFF_FILE_VALID_OID
)
==
0
)
{
const
git_oid
*
sm_head
;
const
git_oid
*
sm_head
;
if
((
sm_head
=
git_submodule_wd_
o
id
(
sm
))
!=
NULL
||
if
((
sm_head
=
git_submodule_wd_id
(
sm
))
!=
NULL
||
(
sm_head
=
git_submodule_head_
o
id
(
sm
))
!=
NULL
)
(
sm_head
=
git_submodule_head_id
(
sm
))
!=
NULL
)
{
{
git_oid_cpy
(
&
file
->
oid
,
sm_head
);
git_oid_cpy
(
&
file
->
oid
,
sm_head
);
file
->
flags
|=
GIT_DIFF_FILE_VALID_OID
;
file
->
flags
|=
GIT_DIFF_FILE_VALID_OID
;
...
...
src/submodule.c
View file @
9cd42358
...
@@ -513,7 +513,7 @@ int git_submodule_set_url(git_submodule *submodule, const char *url)
...
@@ -513,7 +513,7 @@ int git_submodule_set_url(git_submodule *submodule, const char *url)
return
0
;
return
0
;
}
}
const
git_oid
*
git_submodule_index_
o
id
(
git_submodule
*
submodule
)
const
git_oid
*
git_submodule_index_id
(
git_submodule
*
submodule
)
{
{
assert
(
submodule
);
assert
(
submodule
);
...
@@ -523,7 +523,7 @@ const git_oid *git_submodule_index_oid(git_submodule *submodule)
...
@@ -523,7 +523,7 @@ const git_oid *git_submodule_index_oid(git_submodule *submodule)
return
NULL
;
return
NULL
;
}
}
const
git_oid
*
git_submodule_head_
o
id
(
git_submodule
*
submodule
)
const
git_oid
*
git_submodule_head_id
(
git_submodule
*
submodule
)
{
{
assert
(
submodule
);
assert
(
submodule
);
...
@@ -533,7 +533,7 @@ const git_oid *git_submodule_head_oid(git_submodule *submodule)
...
@@ -533,7 +533,7 @@ const git_oid *git_submodule_head_oid(git_submodule *submodule)
return
NULL
;
return
NULL
;
}
}
const
git_oid
*
git_submodule_wd_
o
id
(
git_submodule
*
submodule
)
const
git_oid
*
git_submodule_wd_id
(
git_submodule
*
submodule
)
{
{
assert
(
submodule
);
assert
(
submodule
);
...
@@ -1389,8 +1389,8 @@ cleanup:
...
@@ -1389,8 +1389,8 @@ cleanup:
static
int
submodule_index_status
(
unsigned
int
*
status
,
git_submodule
*
sm
)
static
int
submodule_index_status
(
unsigned
int
*
status
,
git_submodule
*
sm
)
{
{
const
git_oid
*
head_oid
=
git_submodule_head_
o
id
(
sm
);
const
git_oid
*
head_oid
=
git_submodule_head_id
(
sm
);
const
git_oid
*
index_oid
=
git_submodule_index_
o
id
(
sm
);
const
git_oid
*
index_oid
=
git_submodule_index_id
(
sm
);
if
(
!
head_oid
)
{
if
(
!
head_oid
)
{
if
(
index_oid
)
if
(
index_oid
)
...
@@ -1410,7 +1410,7 @@ static int submodule_wd_status(unsigned int *status, git_submodule *sm)
...
@@ -1410,7 +1410,7 @@ static int submodule_wd_status(unsigned int *status, git_submodule *sm)
const
git_oid
*
wd_oid
,
*
index_oid
;
const
git_oid
*
wd_oid
,
*
index_oid
;
git_repository
*
sm_repo
=
NULL
;
git_repository
*
sm_repo
=
NULL
;
/* open repo now if we need it (so wd_
o
id() call won't reopen) */
/* open repo now if we need it (so wd_id() call won't reopen) */
if
((
sm
->
ignore
==
GIT_SUBMODULE_IGNORE_NONE
||
if
((
sm
->
ignore
==
GIT_SUBMODULE_IGNORE_NONE
||
sm
->
ignore
==
GIT_SUBMODULE_IGNORE_UNTRACKED
)
&&
sm
->
ignore
==
GIT_SUBMODULE_IGNORE_UNTRACKED
)
&&
(
sm
->
flags
&
GIT_SUBMODULE_STATUS_IN_WD
)
!=
0
)
(
sm
->
flags
&
GIT_SUBMODULE_STATUS_IN_WD
)
!=
0
)
...
@@ -1419,8 +1419,8 @@ static int submodule_wd_status(unsigned int *status, git_submodule *sm)
...
@@ -1419,8 +1419,8 @@ static int submodule_wd_status(unsigned int *status, git_submodule *sm)
return
error
;
return
error
;
}
}
index_oid
=
git_submodule_index_
o
id
(
sm
);
index_oid
=
git_submodule_index_id
(
sm
);
wd_oid
=
git_submodule_wd_
o
id
(
sm
);
wd_oid
=
git_submodule_wd_id
(
sm
);
if
(
!
index_oid
)
{
if
(
!
index_oid
)
{
if
(
wd_oid
)
if
(
wd_oid
)
...
...
tests-clar/submodule/lookup.c
View file @
9cd42358
...
@@ -62,9 +62,9 @@ void test_submodule_lookup__accessors(void)
...
@@ -62,9 +62,9 @@ void test_submodule_lookup__accessors(void)
cl_assert
(
git__suffixcmp
(
git_submodule_path
(
sm
),
"sm_unchanged"
)
==
0
);
cl_assert
(
git__suffixcmp
(
git_submodule_path
(
sm
),
"sm_unchanged"
)
==
0
);
cl_assert
(
git__suffixcmp
(
git_submodule_url
(
sm
),
"/submod2_target"
)
==
0
);
cl_assert
(
git__suffixcmp
(
git_submodule_url
(
sm
),
"/submod2_target"
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_index_
o
id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_index_id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_head_
o
id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_head_id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_wd_
o
id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_wd_id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_submodule_ignore
(
sm
)
==
GIT_SUBMODULE_IGNORE_NONE
);
cl_assert
(
git_submodule_ignore
(
sm
)
==
GIT_SUBMODULE_IGNORE_NONE
);
cl_assert
(
git_submodule_update
(
sm
)
==
GIT_SUBMODULE_UPDATE_CHECKOUT
);
cl_assert
(
git_submodule_update
(
sm
)
==
GIT_SUBMODULE_UPDATE_CHECKOUT
);
...
@@ -72,24 +72,24 @@ void test_submodule_lookup__accessors(void)
...
@@ -72,24 +72,24 @@ void test_submodule_lookup__accessors(void)
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"sm_changed_head"
));
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"sm_changed_head"
));
cl_assert_equal_s
(
"sm_changed_head"
,
git_submodule_name
(
sm
));
cl_assert_equal_s
(
"sm_changed_head"
,
git_submodule_name
(
sm
));
cl_assert
(
git_oid_streq
(
git_submodule_index_
o
id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_index_id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_head_
o
id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_head_id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_wd_
o
id
(
sm
),
cl_assert
(
git_oid_streq
(
git_submodule_wd_id
(
sm
),
"3d9386c507f6b093471a3e324085657a3c2b4247"
)
==
0
);
"3d9386c507f6b093471a3e324085657a3c2b4247"
)
==
0
);
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"sm_added_and_uncommited"
));
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"sm_added_and_uncommited"
));
cl_assert_equal_s
(
"sm_added_and_uncommited"
,
git_submodule_name
(
sm
));
cl_assert_equal_s
(
"sm_added_and_uncommited"
,
git_submodule_name
(
sm
));
cl_assert
(
git_oid_streq
(
git_submodule_index_
o
id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_index_id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_submodule_head_
o
id
(
sm
)
==
NULL
);
cl_assert
(
git_submodule_head_id
(
sm
)
==
NULL
);
cl_assert
(
git_oid_streq
(
git_submodule_wd_
o
id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_wd_id
(
sm
),
oid
)
==
0
);
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"sm_missing_commits"
));
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"sm_missing_commits"
));
cl_assert_equal_s
(
"sm_missing_commits"
,
git_submodule_name
(
sm
));
cl_assert_equal_s
(
"sm_missing_commits"
,
git_submodule_name
(
sm
));
cl_assert
(
git_oid_streq
(
git_submodule_index_
o
id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_index_id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_head_
o
id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_head_id
(
sm
),
oid
)
==
0
);
cl_assert
(
git_oid_streq
(
git_submodule_wd_
o
id
(
sm
),
cl_assert
(
git_oid_streq
(
git_submodule_wd_id
(
sm
),
"5e4963595a9774b90524d35a807169049de8ccad"
)
==
0
);
"5e4963595a9774b90524d35a807169049de8ccad"
)
==
0
);
}
}
...
...
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