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
0ab3a2ab
Commit
0ab3a2ab
authored
Nov 30, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deploy GIT_INIT_STRUCTURE
parent
c7231c45
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
20 deletions
+15
-20
src/checkout.c
+1
-3
src/common.h
+10
-0
tests-clar/checkout/checkout_util.h
+0
-5
tests-clar/checkout/index.c
+2
-3
tests-clar/checkout/tree.c
+1
-2
tests-clar/diff/blob.c
+1
-1
tests-clar/diff/diff_helpers.h
+0
-6
No files found.
src/checkout.c
View file @
0ab3a2ab
...
...
@@ -225,12 +225,10 @@ static int retrieve_symlink_caps(git_repository *repo, bool *can_symlink)
static
void
normalize_options
(
git_checkout_opts
*
normalized
,
git_checkout_opts
*
proposed
)
{
git_checkout_opts
init_opts
=
GIT_CHECKOUT_OPTS_INIT
;
assert
(
normalized
);
if
(
!
proposed
)
memmove
(
normalized
,
&
init_opts
,
sizeof
(
git_checkout_opts
)
);
GIT_INIT_STRUCTURE
(
normalized
,
GIT_CHECKOUT_OPTS_VERSION
);
else
memmove
(
normalized
,
proposed
,
sizeof
(
git_checkout_opts
));
...
...
src/common.h
View file @
0ab3a2ab
...
...
@@ -82,6 +82,16 @@ GIT_INLINE(bool) giterr__check_version(const void *structure, unsigned int expec
}
#define GITERR_CHECK_VERSION(S,V,N) if (!giterr__check_version(S,V,N)) return -1
/**
* Initialize a structure with a version.
*/
GIT_INLINE
(
void
)
git__init_structure
(
void
*
structure
,
size_t
len
,
unsigned
int
version
)
{
memset
(
structure
,
0
,
len
);
*
((
int
*
)
structure
)
=
version
;
}
#define GIT_INIT_STRUCTURE(S,V) git__init_structure(S, sizeof(*S), V)
/* NOTE: other giterr functions are in the public errors.h header file */
#include "util.h"
...
...
tests-clar/checkout/checkout_util.h
deleted
100644 → 0
View file @
c7231c45
GIT_INLINE
(
void
)
reset_checkout_opts
(
git_checkout_opts
*
opts
)
{
git_checkout_opts
init_opts
=
GIT_CHECKOUT_OPTS_INIT
;
memmove
(
opts
,
&
init_opts
,
sizeof
(
git_checkout_opts
));
}
tests-clar/checkout/index.c
View file @
0ab3a2ab
...
...
@@ -2,7 +2,6 @@
#include "git2/checkout.h"
#include "repository.h"
#include "checkout_util.h"
static
git_repository
*
g_repo
;
static
git_checkout_opts
g_opts
;
...
...
@@ -26,7 +25,7 @@ void test_checkout_index__initialize(void)
{
git_tree
*
tree
;
reset_checkout_opts
(
&
g_opts
);
GIT_INIT_STRUCTURE
(
&
g_opts
,
GIT_CHECKOUT_OPTS_VERSION
);
g_opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
;
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
...
...
@@ -67,7 +66,7 @@ void test_checkout_index__cannot_checkout_a_bare_repository(void)
{
test_checkout_index__cleanup
();
reset_checkout_opts
(
&
g_opts
);
GIT_INIT_STRUCTURE
(
&
g_opts
,
GIT_CHECKOUT_OPTS_VERSION
);
g_repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
cl_git_fail
(
git_checkout_index
(
g_repo
,
NULL
,
NULL
));
...
...
tests-clar/checkout/tree.c
View file @
0ab3a2ab
...
...
@@ -2,7 +2,6 @@
#include "git2/checkout.h"
#include "repository.h"
#include "checkout_util.h"
static
git_repository
*
g_repo
;
static
git_checkout_opts
g_opts
;
...
...
@@ -12,7 +11,7 @@ void test_checkout_tree__initialize(void)
{
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
reset_checkout_opts
(
&
g_opts
);
GIT_INIT_STRUCTURE
(
&
g_opts
,
GIT_CHECKOUT_OPTS_VERSION
);
g_opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
;
}
...
...
tests-clar/diff/blob.c
View file @
0ab3a2ab
...
...
@@ -12,7 +12,7 @@ void test_diff_blob__initialize(void)
g_repo
=
cl_git_sandbox_init
(
"attr"
);
reset_diff_opts
(
&
opts
);
GIT_INIT_STRUCTURE
(
&
opts
,
GIT_DIFF_OPTIONS_VERSION
);
opts
.
context_lines
=
1
;
opts
.
interhunk_lines
=
0
;
...
...
tests-clar/diff/diff_helpers.h
View file @
0ab3a2ab
...
...
@@ -49,9 +49,3 @@ extern int diff_foreach_via_iterator(
extern
void
diff_print
(
FILE
*
fp
,
git_diff_list
*
diff
);
GIT_INLINE
(
void
)
reset_diff_opts
(
git_diff_options
*
opts
)
{
git_diff_options
init
=
GIT_DIFF_OPTIONS_INIT
;
memmove
(
opts
,
&
init
,
sizeof
(
init
));
}
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