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
041cd4a2
Commit
041cd4a2
authored
Mar 07, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2028 from libgit2/options-names
Rename options structures
parents
5a6de908
aa17c3c6
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
184 additions
and
159 deletions
+184
-159
examples/network/clone.c
+1
-1
include/git2/checkout.h
+14
-14
include/git2/clone.h
+3
-3
include/git2/merge.h
+2
-2
include/git2/revert.h
+10
-10
src/checkout.c
+14
-14
src/checkout.h
+1
-1
src/clone.c
+2
-2
src/reset.c
+1
-1
src/revert.c
+12
-12
src/stash.c
+1
-1
tests/checkout/binaryunicode.c
+1
-1
tests/checkout/conflict.c
+17
-17
tests/checkout/crlf.c
+37
-12
tests/checkout/head.c
+1
-1
tests/checkout/index.c
+23
-23
tests/checkout/tree.c
+18
-18
tests/checkout/typechange.c
+2
-2
tests/clone/nonetwork.c
+1
-1
tests/diff/rename.c
+3
-3
tests/index/names.c
+3
-3
tests/index/reuc.c
+3
-3
tests/merge/merge_helpers.c
+1
-1
tests/merge/workdir/trivial.c
+1
-1
tests/online/clone.c
+2
-2
tests/revert/workdir.c
+6
-6
tests/structinit/structinit.c
+4
-4
No files found.
examples/network/clone.c
View file @
041cd4a2
...
...
@@ -62,7 +62,7 @@ int do_clone(git_repository *repo, int argc, char **argv)
progress_data
pd
=
{{
0
}};
git_repository
*
cloned_repo
=
NULL
;
git_clone_options
clone_opts
=
GIT_CLONE_OPTIONS_INIT
;
git_checkout_opt
s
checkout_opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
checkout_opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
const
char
*
url
=
argv
[
1
];
const
char
*
path
=
argv
[
2
];
int
error
;
...
...
include/git2/checkout.h
View file @
041cd4a2
...
...
@@ -225,12 +225,12 @@ typedef void (*git_checkout_progress_cb)(
/**
* Checkout options structure
*
* Zero out for defaults. Initialize with `GIT_CHECKOUT_OPTS_INIT` macro to
* Zero out for defaults. Initialize with `GIT_CHECKOUT_OPT
ION
S_INIT` macro to
* correctly set the `version` field. E.g.
*
* git_checkout_opt
s opts = GIT_CHECKOUT_OPT
S_INIT;
* git_checkout_opt
ions opts = GIT_CHECKOUT_OPTION
S_INIT;
*/
typedef
struct
git_checkout_opts
{
typedef
struct
git_checkout_opt
ion
s
{
unsigned
int
version
;
unsigned
int
checkout_strategy
;
/** default will be a dry run */
...
...
@@ -261,22 +261,22 @@ typedef struct git_checkout_opts {
const
char
*
ancestor_label
;
/** the name of the common ancestor side of conflicts */
const
char
*
our_label
;
/** the name of the "our" side of conflicts */
const
char
*
their_label
;
/** the name of the "their" side of conflicts */
}
git_checkout_opts
;
}
git_checkout_opt
ion
s
;
#define GIT_CHECKOUT_OPTS_VERSION 1
#define GIT_CHECKOUT_OPT
S_INIT {GIT_CHECKOUT_OPT
S_VERSION}
#define GIT_CHECKOUT_OPT
ION
S_VERSION 1
#define GIT_CHECKOUT_OPT
IONS_INIT {GIT_CHECKOUT_OPTION
S_VERSION}
/**
* Initializes a `git_checkout_opts` with default values. Equivalent to
* creating an instance with GIT_CHECKOUT_OPTS_INIT.
* Initializes a `git_checkout_opt
ion
s` with default values. Equivalent to
* creating an instance with GIT_CHECKOUT_OPT
ION
S_INIT.
*
* @param opts the `git_checkout_opts` instance to initialize.
* @param opts the `git_checkout_opt
ion
s` instance to initialize.
* @param version the version of the struct; you should pass
* `GIT_CHECKOUT_OPTS_VERSION` here.
* `GIT_CHECKOUT_OPT
ION
S_VERSION` here.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN
(
int
)
git_checkout_init_opts
(
git_checkout_opts
*
opts
,
git_checkout_opt
ion
s
*
opts
,
int
version
);
/**
...
...
@@ -291,7 +291,7 @@ GIT_EXTERN(int) git_checkout_init_opts(
*/
GIT_EXTERN
(
int
)
git_checkout_head
(
git_repository
*
repo
,
const
git_checkout_opts
*
opts
);
const
git_checkout_opt
ion
s
*
opts
);
/**
* Updates files in the working tree to match the content of the index.
...
...
@@ -305,7 +305,7 @@ GIT_EXTERN(int) git_checkout_head(
GIT_EXTERN
(
int
)
git_checkout_index
(
git_repository
*
repo
,
git_index
*
index
,
const
git_checkout_opts
*
opts
);
const
git_checkout_opt
ion
s
*
opts
);
/**
* Updates files in the index and working tree to match the content of the
...
...
@@ -321,7 +321,7 @@ GIT_EXTERN(int) git_checkout_index(
GIT_EXTERN
(
int
)
git_checkout_tree
(
git_repository
*
repo
,
const
git_object
*
treeish
,
const
git_checkout_opts
*
opts
);
const
git_checkout_opt
ion
s
*
opts
);
/** @} */
GIT_END_DECL
...
...
include/git2/clone.h
View file @
041cd4a2
...
...
@@ -52,7 +52,7 @@ GIT_BEGIN_DECL
typedef
struct
git_clone_options
{
unsigned
int
version
;
git_checkout_opts
checkout_opts
;
git_checkout_opt
ion
s
checkout_opts
;
git_remote_callbacks
remote_callbacks
;
int
bare
;
...
...
@@ -63,7 +63,7 @@ typedef struct git_clone_options {
}
git_clone_options
;
#define GIT_CLONE_OPTIONS_VERSION 1
#define GIT_CLONE_OPTIONS_INIT {GIT_CLONE_OPTIONS_VERSION, {GIT_CHECKOUT_OPTS_VERSION, GIT_CHECKOUT_SAFE_CREATE}, GIT_REMOTE_CALLBACKS_INIT}
#define GIT_CLONE_OPTIONS_INIT {GIT_CLONE_OPTIONS_VERSION, {GIT_CHECKOUT_OPT
ION
S_VERSION, GIT_CHECKOUT_SAFE_CREATE}, GIT_REMOTE_CALLBACKS_INIT}
/**
* Initializes a `git_clone_options` with default values. Equivalent to
...
...
@@ -120,7 +120,7 @@ GIT_EXTERN(int) git_clone(
GIT_EXTERN
(
int
)
git_clone_into
(
git_repository
*
repo
,
git_remote
*
remote
,
const
git_checkout_opts
*
co_opts
,
const
git_checkout_opt
ion
s
*
co_opts
,
const
char
*
branch
,
const
git_signature
*
signature
);
...
...
include/git2/merge.h
View file @
041cd4a2
...
...
@@ -150,11 +150,11 @@ typedef struct {
git_merge_tree_opts
merge_tree_opts
;
/** Options for writing the merge result to the working directory. */
git_checkout_opts
checkout_opts
;
git_checkout_opt
ion
s
checkout_opts
;
}
git_merge_opts
;
#define GIT_MERGE_OPTS_VERSION 1
#define GIT_MERGE_OPTS_INIT {GIT_MERGE_OPTS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTS_INIT}
#define GIT_MERGE_OPTS_INIT {GIT_MERGE_OPTS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPT
ION
S_INIT}
/**
* Initializes a `git_merge_opts` with default values. Equivalent to creating
...
...
include/git2/revert.h
View file @
041cd4a2
...
...
@@ -27,23 +27,23 @@ typedef struct {
unsigned
int
mainline
;
git_merge_tree_opts
merge_tree_opts
;
git_checkout_opts
checkout_opts
;
}
git_revert_opts
;
git_checkout_opt
ion
s
checkout_opts
;
}
git_revert_opt
ion
s
;
#define GIT_REVERT_OPTS_VERSION 1
#define GIT_REVERT_OPT
S_INIT {GIT_REVERT_OPTS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPT
S_INIT}
#define GIT_REVERT_OPT
ION
S_VERSION 1
#define GIT_REVERT_OPT
IONS_INIT {GIT_REVERT_OPTIONS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTION
S_INIT}
/**
* Initializes a `git_revert_opts` with default values. Equivalent to
* creating an instance with GIT_REVERT_OPTS_INIT.
* Initializes a `git_revert_opt
ion
s` with default values. Equivalent to
* creating an instance with GIT_REVERT_OPT
ION
S_INIT.
*
* @param opts the `git_revert_opts` instance to initialize.
* @param opts the `git_revert_opt
ion
s` instance to initialize.
* @param version the version of the struct; you should pass
* `GIT_REVERT_OPTS_VERSION` here.
* `GIT_REVERT_OPT
ION
S_VERSION` here.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN
(
int
)
git_revert_init_opts
(
git_revert_opts
*
opts
,
git_revert_opt
ion
s
*
opts
,
int
version
);
/**
...
...
@@ -80,7 +80,7 @@ int git_revert_commit(
GIT_EXTERN
(
int
)
git_revert
(
git_repository
*
repo
,
git_commit
*
commit
,
const
git_revert_opts
*
given_opts
);
const
git_revert_opt
ion
s
*
given_opts
);
/** @} */
GIT_END_DECL
...
...
src/checkout.c
View file @
041cd4a2
...
...
@@ -47,7 +47,7 @@ enum {
typedef
struct
{
git_repository
*
repo
;
git_diff
*
diff
;
git_checkout_opts
opts
;
git_checkout_opt
ion
s
opts
;
bool
opts_free_baseline
;
char
*
pfx
;
git_index
*
index
;
...
...
@@ -1144,7 +1144,7 @@ static int blob_content_to_file(
const
char
*
path
,
const
char
*
hint_path
,
mode_t
entry_filemode
,
git_checkout_opts
*
opts
)
git_checkout_opt
ion
s
*
opts
)
{
int
error
=
0
;
mode_t
file_mode
=
opts
->
file_mode
?
opts
->
file_mode
:
entry_filemode
;
...
...
@@ -1856,7 +1856,7 @@ static void checkout_data_clear(checkout_data *data)
static
int
checkout_data_init
(
checkout_data
*
data
,
git_iterator
*
target
,
const
git_checkout_opts
*
proposed
)
const
git_checkout_opt
ion
s
*
proposed
)
{
int
error
=
0
;
git_repository
*
repo
=
git_iterator_owner
(
target
);
...
...
@@ -1875,12 +1875,12 @@ static int checkout_data_init(
data
->
repo
=
repo
;
GITERR_CHECK_VERSION
(
proposed
,
GIT_CHECKOUT_OPT
S_VERSION
,
"git_checkout_opt
s"
);
proposed
,
GIT_CHECKOUT_OPT
IONS_VERSION
,
"git_checkout_option
s"
);
if
(
!
proposed
)
GIT_INIT_STRUCTURE
(
&
data
->
opts
,
GIT_CHECKOUT_OPTS_VERSION
);
GIT_INIT_STRUCTURE
(
&
data
->
opts
,
GIT_CHECKOUT_OPT
ION
S_VERSION
);
else
memmove
(
&
data
->
opts
,
proposed
,
sizeof
(
git_checkout_opts
));
memmove
(
&
data
->
opts
,
proposed
,
sizeof
(
git_checkout_opt
ion
s
));
if
(
!
data
->
opts
.
target_directory
)
data
->
opts
.
target_directory
=
git_repository_workdir
(
repo
);
...
...
@@ -2000,7 +2000,7 @@ cleanup:
int
git_checkout_iterator
(
git_iterator
*
target
,
const
git_checkout_opts
*
opts
)
const
git_checkout_opt
ion
s
*
opts
)
{
int
error
=
0
;
git_iterator
*
baseline
=
NULL
,
*
workdir
=
NULL
;
...
...
@@ -2106,7 +2106,7 @@ cleanup:
int
git_checkout_index
(
git_repository
*
repo
,
git_index
*
index
,
const
git_checkout_opts
*
opts
)
const
git_checkout_opt
ion
s
*
opts
)
{
int
error
;
git_iterator
*
index_i
;
...
...
@@ -2141,7 +2141,7 @@ int git_checkout_index(
int
git_checkout_tree
(
git_repository
*
repo
,
const
git_object
*
treeish
,
const
git_checkout_opts
*
opts
)
const
git_checkout_opt
ion
s
*
opts
)
{
int
error
;
git_tree
*
tree
=
NULL
;
...
...
@@ -2189,19 +2189,19 @@ int git_checkout_tree(
int
git_checkout_head
(
git_repository
*
repo
,
const
git_checkout_opts
*
opts
)
const
git_checkout_opt
ion
s
*
opts
)
{
assert
(
repo
);
return
git_checkout_tree
(
repo
,
NULL
,
opts
);
}
int
git_checkout_init_opts
(
git_checkout_opts
*
opts
,
int
version
)
int
git_checkout_init_opts
(
git_checkout_opt
ion
s
*
opts
,
int
version
)
{
if
(
version
!=
GIT_CHECKOUT_OPTS_VERSION
)
{
giterr_set
(
GITERR_INVALID
,
"Invalid version %d for git_checkout_opts"
,
version
);
if
(
version
!=
GIT_CHECKOUT_OPT
ION
S_VERSION
)
{
giterr_set
(
GITERR_INVALID
,
"Invalid version %d for git_checkout_opt
ion
s"
,
version
);
return
-
1
;
}
else
{
git_checkout_opt
s
o
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
o
=
GIT_CHECKOUT_OPTION
S_INIT
;
memcpy
(
opts
,
&
o
,
sizeof
(
o
));
return
0
;
}
...
...
src/checkout.h
View file @
041cd4a2
...
...
@@ -19,6 +19,6 @@
*/
extern
int
git_checkout_iterator
(
git_iterator
*
target
,
const
git_checkout_opts
*
opts
);
const
git_checkout_opt
ion
s
*
opts
);
#endif
src/clone.c
View file @
041cd4a2
...
...
@@ -322,7 +322,7 @@ on_error:
static
bool
should_checkout
(
git_repository
*
repo
,
bool
is_bare
,
const
git_checkout_opts
*
opts
)
const
git_checkout_opt
ion
s
*
opts
)
{
if
(
is_bare
)
return
false
;
...
...
@@ -336,7 +336,7 @@ static bool should_checkout(
return
!
git_repository_head_unborn
(
repo
);
}
int
git_clone_into
(
git_repository
*
repo
,
git_remote
*
remote
,
const
git_checkout_opts
*
co_opts
,
const
char
*
branch
,
const
git_signature
*
signature
)
int
git_clone_into
(
git_repository
*
repo
,
git_remote
*
remote
,
const
git_checkout_opt
ion
s
*
co_opts
,
const
char
*
branch
,
const
git_signature
*
signature
)
{
int
error
=
0
,
old_fetchhead
;
git_strarray
refspecs
;
...
...
src/reset.c
View file @
041cd4a2
...
...
@@ -102,7 +102,7 @@ int git_reset(
git_index
*
index
=
NULL
;
git_tree
*
tree
=
NULL
;
int
error
=
0
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_buf
log_message_buf
=
GIT_BUF_INIT
;
assert
(
repo
&&
target
);
...
...
src/revert.c
View file @
041cd4a2
...
...
@@ -67,8 +67,8 @@ cleanup:
static
int
revert_normalize_opts
(
git_repository
*
repo
,
git_revert_opts
*
opts
,
const
git_revert_opts
*
given
,
git_revert_opt
ion
s
*
opts
,
const
git_revert_opt
ion
s
*
given
,
const
char
*
their_label
)
{
int
error
=
0
;
...
...
@@ -78,10 +78,10 @@ static int revert_normalize_opts(
GIT_UNUSED
(
repo
);
if
(
given
!=
NULL
)
memcpy
(
opts
,
given
,
sizeof
(
git_revert_opts
));
memcpy
(
opts
,
given
,
sizeof
(
git_revert_opt
ion
s
));
else
{
git_revert_opt
s
default_opts
=
GIT_REVERT_OPT
S_INIT
;
memcpy
(
opts
,
&
default_opts
,
sizeof
(
git_revert_opts
));
git_revert_opt
ions
default_opts
=
GIT_REVERT_OPTION
S_INIT
;
memcpy
(
opts
,
&
default_opts
,
sizeof
(
git_revert_opt
ion
s
));
}
if
(
!
opts
->
checkout_opts
.
checkout_strategy
)
...
...
@@ -166,9 +166,9 @@ done:
int
git_revert
(
git_repository
*
repo
,
git_commit
*
commit
,
const
git_revert_opts
*
given_opts
)
const
git_revert_opt
ion
s
*
given_opts
)
{
git_revert_opts
opts
;
git_revert_opt
ion
s
opts
;
git_reference
*
our_ref
=
NULL
;
git_commit
*
our_commit
=
NULL
;
char
commit_oidstr
[
GIT_OID_HEXSZ
+
1
];
...
...
@@ -179,7 +179,7 @@ int git_revert(
assert
(
repo
&&
commit
);
GITERR_CHECK_VERSION
(
given_opts
,
GIT_REVERT_OPT
S_VERSION
,
"git_revert_opt
s"
);
GITERR_CHECK_VERSION
(
given_opts
,
GIT_REVERT_OPT
IONS_VERSION
,
"git_revert_option
s"
);
if
((
error
=
git_repository__ensure_not_bare
(
repo
,
"revert"
))
<
0
)
return
error
;
...
...
@@ -219,13 +219,13 @@ done:
return
error
;
}
int
git_revert_init_opts
(
git_revert_opts
*
opts
,
int
version
)
int
git_revert_init_opts
(
git_revert_opt
ion
s
*
opts
,
int
version
)
{
if
(
version
!=
GIT_REVERT_OPTS_VERSION
)
{
giterr_set
(
GITERR_INVALID
,
"Invalid version %d for git_revert_opts"
,
version
);
if
(
version
!=
GIT_REVERT_OPT
ION
S_VERSION
)
{
giterr_set
(
GITERR_INVALID
,
"Invalid version %d for git_revert_opt
ion
s"
,
version
);
return
-
1
;
}
else
{
git_revert_opt
s
o
=
GIT_REVERT_OPT
S_INIT
;
git_revert_opt
ions
o
=
GIT_REVERT_OPTION
S_INIT
;
memcpy
(
opts
,
&
o
,
sizeof
(
o
));
return
0
;
}
...
...
src/stash.c
View file @
041cd4a2
...
...
@@ -468,7 +468,7 @@ static int reset_index_and_workdir(
bool
remove_untracked
,
bool
remove_ignored
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
...
...
tests/checkout/binaryunicode.c
View file @
041cd4a2
...
...
@@ -21,7 +21,7 @@ static void execute_test(void)
git_oid
oid
,
check
;
git_commit
*
commit
;
git_tree
*
tree
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_git_pass
(
git_reference_name_to_id
(
&
oid
,
g_repo
,
"refs/heads/branch1"
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
g_repo
,
&
oid
));
...
...
tests/checkout/conflict.c
View file @
041cd4a2
...
...
@@ -207,7 +207,7 @@ static void ensure_workdir_link(const char *path, const char *target)
void
test_checkout_conflict__ignored
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
|=
GIT_CHECKOUT_SKIP_UNMERGED
;
...
...
@@ -221,7 +221,7 @@ void test_checkout_conflict__ignored(void)
void
test_checkout_conflict__ours
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
|=
GIT_CHECKOUT_USE_OURS
;
...
...
@@ -234,7 +234,7 @@ void test_checkout_conflict__ours(void)
void
test_checkout_conflict__theirs
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
|=
GIT_CHECKOUT_USE_THEIRS
;
...
...
@@ -248,7 +248,7 @@ void test_checkout_conflict__theirs(void)
void
test_checkout_conflict__diff3
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
create_conflicting_index
();
...
...
@@ -259,7 +259,7 @@ void test_checkout_conflict__diff3(void)
void
test_checkout_conflict__automerge
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0100644
,
AUTOMERGEABLE_ANCESTOR_OID
,
1
,
"automergeable.txt"
},
...
...
@@ -277,7 +277,7 @@ void test_checkout_conflict__automerge(void)
void
test_checkout_conflict__directory_file
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0100644
,
CONFLICTING_ANCESTOR_OID
,
1
,
"df-1"
},
...
...
@@ -316,7 +316,7 @@ void test_checkout_conflict__directory_file(void)
void
test_checkout_conflict__directory_file_with_custom_labels
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0100644
,
CONFLICTING_ANCESTOR_OID
,
1
,
"df-1"
},
...
...
@@ -357,7 +357,7 @@ void test_checkout_conflict__directory_file_with_custom_labels(void)
void
test_checkout_conflict__link_file
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0100644
,
CONFLICTING_ANCESTOR_OID
,
1
,
"link-1"
},
...
...
@@ -393,7 +393,7 @@ void test_checkout_conflict__link_file(void)
void
test_checkout_conflict__links
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0120000
,
LINK_ANCESTOR_OID
,
1
,
"link-1"
},
...
...
@@ -418,7 +418,7 @@ void test_checkout_conflict__links(void)
void
test_checkout_conflict__add_add
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0100644
,
CONFLICTING_OURS_OID
,
2
,
"conflicting.txt"
},
...
...
@@ -438,7 +438,7 @@ void test_checkout_conflict__add_add(void)
void
test_checkout_conflict__mode_change
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0100644
,
CONFLICTING_ANCESTOR_OID
,
1
,
"executable-1"
},
...
...
@@ -495,7 +495,7 @@ void test_checkout_conflict__mode_change(void)
void
test_checkout_conflict__renames
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0100644
,
"68c6c84b091926c7d90aa6a79b2bc3bb6adccd8e"
,
0
,
"0a-no-change.txt"
},
...
...
@@ -680,7 +680,7 @@ void test_checkout_conflict__renames(void)
void
test_checkout_conflict__rename_keep_ours
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0100644
,
"68c6c84b091926c7d90aa6a79b2bc3bb6adccd8e"
,
0
,
"0a-no-change.txt"
},
...
...
@@ -847,7 +847,7 @@ void test_checkout_conflict__rename_keep_ours(void)
void
test_checkout_conflict__name_mangled_file_exists_in_workdir
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0100644
,
"b42712cfe99a1a500b2a51fe984e0b8a7702ba11"
,
1
,
"test-one-side-one.txt"
},
...
...
@@ -987,7 +987,7 @@ void test_checkout_conflict__name_mangled_file_exists_in_workdir(void)
void
test_checkout_conflict__update_only
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
checkout_index_entry
checkout_index_entries
[]
=
{
{
0100644
,
AUTOMERGEABLE_ANCESTOR_OID
,
1
,
"automergeable.txt"
},
...
...
@@ -1032,7 +1032,7 @@ void test_checkout_conflict__update_only(void)
void
test_checkout_conflict__path_filters
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
char
*
paths
[]
=
{
"conflicting-1.txt"
,
"conflicting-3.txt"
};
git_strarray
patharray
=
{
0
};
...
...
@@ -1089,7 +1089,7 @@ static void collect_progress(
void
test_checkout_conflict__report_progress
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_vector
paths
=
GIT_VECTOR_INIT
;
char
*
path
;
size_t
i
;
...
...
tests/checkout/crlf.c
View file @
041cd4a2
...
...
@@ -18,11 +18,24 @@ void test_checkout_crlf__cleanup(void)
cl_git_sandbox_cleanup
();
}
void
test_checkout_crlf__detect_crlf_autocrlf_false
(
void
)
{
git_checkout_options
opts
=
GIT_CHECKOUT_OPTIONS_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_repo_set_bool
(
g_repo
,
"core.autocrlf"
,
false
);
git_checkout_head
(
g_repo
,
&
opts
);
check_file_contents
(
"./crlf/all-lf"
,
ALL_LF_TEXT_RAW
);
check_file_contents
(
"./crlf/all-crlf"
,
ALL_CRLF_TEXT_RAW
);
}
void
test_checkout_crlf__autocrlf_false_index_size_is_unfiltered_size
(
void
)
{
git_index
*
index
;
const
git_index_entry
*
entry
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_repo_set_bool
(
g_repo
,
"core.autocrlf"
,
false
);
...
...
@@ -42,7 +55,7 @@ void test_checkout_crlf__autocrlf_false_index_size_is_unfiltered_size(void)
void
test_checkout_crlf__detect_crlf_autocrlf_true
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_repo_set_bool
(
g_repo
,
"core.autocrlf"
,
true
);
...
...
@@ -59,7 +72,7 @@ void test_checkout_crlf__detect_crlf_autocrlf_true(void)
void
test_checkout_crlf__more_lf_autocrlf_true
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_repo_set_bool
(
g_repo
,
"core.autocrlf"
,
true
);
...
...
@@ -74,7 +87,7 @@ void test_checkout_crlf__more_lf_autocrlf_true(void)
void
test_checkout_crlf__more_crlf_autocrlf_true
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_repo_set_bool
(
g_repo
,
"core.autocrlf"
,
true
);
...
...
@@ -87,11 +100,23 @@ void test_checkout_crlf__more_crlf_autocrlf_true(void)
check_file_contents
(
"./crlf/more-crlf"
,
MORE_CRLF_TEXT_AS_CRLF
);
}
void
test_checkout_crlf__all_crlf_autocrlf_true
(
void
)
{
git_checkout_options
opts
=
GIT_CHECKOUT_OPTIONS_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_repo_set_bool
(
g_repo
,
"core.autocrlf"
,
true
);
git_checkout_head
(
g_repo
,
&
opts
);
check_file_contents
(
"./crlf/all-crlf"
,
ALL_CRLF_TEXT_RAW
);
}
void
test_checkout_crlf__autocrlf_true_index_size_is_filtered_size
(
void
)
{
git_index
*
index
;
const
git_index_entry
*
entry
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_repo_set_bool
(
g_repo
,
"core.autocrlf"
,
true
);
...
...
@@ -117,7 +142,7 @@ void test_checkout_crlf__with_ident(void)
{
git_index
*
index
;
git_blob
*
blob
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_git_mkfile
(
"crlf/.gitattributes"
,
...
...
@@ -207,7 +232,7 @@ void test_checkout_crlf__with_ident(void)
void
test_checkout_crlf__autocrlf_false_no_attrs
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_repo_set_bool
(
g_repo
,
"core.autocrlf"
,
false
);
...
...
@@ -220,7 +245,7 @@ void test_checkout_crlf__autocrlf_false_no_attrs(void)
void
test_checkout_crlf__autocrlf_true_no_attrs
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_repo_set_bool
(
g_repo
,
"core.autocrlf"
,
true
);
...
...
@@ -238,7 +263,7 @@ void test_checkout_crlf__autocrlf_true_no_attrs(void)
void
test_checkout_crlf__autocrlf_input_no_attrs
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_repo_set_string
(
g_repo
,
"core.autocrlf"
,
"input"
);
...
...
@@ -251,7 +276,7 @@ void test_checkout_crlf__autocrlf_input_no_attrs(void)
void
test_checkout_crlf__autocrlf_false_text_auto_attr
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_git_mkfile
(
"./crlf/.gitattributes"
,
"* text=auto
\n
"
);
...
...
@@ -266,7 +291,7 @@ void test_checkout_crlf__autocrlf_false_text_auto_attr(void)
void
test_checkout_crlf__autocrlf_true_text_auto_attr
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_git_mkfile
(
"./crlf/.gitattributes"
,
"* text=auto
\n
"
);
...
...
@@ -286,7 +311,7 @@ void test_checkout_crlf__autocrlf_true_text_auto_attr(void)
void
test_checkout_crlf__autocrlf_input_text_auto_attr
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
cl_git_mkfile
(
"./crlf/.gitattributes"
,
"* text=auto
\n
"
);
...
...
tests/checkout/head.c
View file @
041cd4a2
...
...
@@ -25,7 +25,7 @@ void test_checkout_head__unborn_head_returns_GIT_EUNBORNBRANCH(void)
void
test_checkout_head__with_index_only_tree
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_index
*
index
;
/* let's start by getting things into a known state */
...
...
tests/checkout/index.c
View file @
041cd4a2
...
...
@@ -43,7 +43,7 @@ void test_checkout_index__cannot_checkout_a_bare_repository(void)
void
test_checkout_index__can_create_missing_files
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_assert_equal_i
(
false
,
git_path_isfile
(
"./testrepo/README"
));
cl_assert_equal_i
(
false
,
git_path_isfile
(
"./testrepo/branch_file.txt"
));
...
...
@@ -60,7 +60,7 @@ void test_checkout_index__can_create_missing_files(void)
void
test_checkout_index__can_remove_untracked_files
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_futils_mkdir
(
"./testrepo/dir/subdir/subsubdir"
,
NULL
,
0755
,
GIT_MKDIR_PATH
);
cl_git_mkfile
(
"./testrepo/dir/one"
,
"one
\n
"
);
...
...
@@ -78,7 +78,7 @@ void test_checkout_index__can_remove_untracked_files(void)
void
test_checkout_index__honor_the_specified_pathspecs
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
char
*
entries
[]
=
{
"*.txt"
};
opts
.
paths
.
strings
=
entries
;
...
...
@@ -99,7 +99,7 @@ void test_checkout_index__honor_the_specified_pathspecs(void)
void
test_checkout_index__honor_the_gitattributes_directives
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
const
char
*
attributes
=
"branch_file.txt text eol=crlf
\n
"
"new.txt text eol=lf
\n
"
;
...
...
@@ -119,7 +119,7 @@ void test_checkout_index__honor_the_gitattributes_directives(void)
void
test_checkout_index__honor_coreautocrlf_setting_set_to_true
(
void
)
{
#ifdef GIT_WIN32
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
const
char
*
expected_readme_text
=
"hey there
\r\n
"
;
cl_git_pass
(
p_unlink
(
"./testrepo/.gitattributes"
));
...
...
@@ -135,7 +135,7 @@ void test_checkout_index__honor_coreautocrlf_setting_set_to_true(void)
void
test_checkout_index__honor_coresymlinks_setting_set_to_true
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_repo_set_bool
(
g_repo
,
"core.symlinks"
,
true
);
...
...
@@ -161,7 +161,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_true(void)
void
test_checkout_index__honor_coresymlinks_setting_set_to_false
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_repo_set_bool
(
g_repo
,
"core.symlinks"
,
false
);
...
...
@@ -174,7 +174,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_false(void)
void
test_checkout_index__donot_overwrite_modified_file_by_default
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_git_mkfile
(
"./testrepo/new.txt"
,
"This isn't what's stored!"
);
...
...
@@ -190,7 +190,7 @@ void test_checkout_index__donot_overwrite_modified_file_by_default(void)
void
test_checkout_index__can_overwrite_modified_file
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_git_mkfile
(
"./testrepo/new.txt"
,
"This isn't what's stored!"
);
...
...
@@ -203,7 +203,7 @@ void test_checkout_index__can_overwrite_modified_file(void)
void
test_checkout_index__options_disable_filters
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_git_mkfile
(
"./testrepo/.gitattributes"
,
"*.txt text eol=crlf
\n
"
);
...
...
@@ -224,7 +224,7 @@ void test_checkout_index__options_disable_filters(void)
void
test_checkout_index__options_dir_modes
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
stat
st
;
git_oid
oid
;
git_commit
*
commit
;
...
...
@@ -258,7 +258,7 @@ void test_checkout_index__options_dir_modes(void)
void
test_checkout_index__options_override_file_modes
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
stat
st
;
if
(
!
cl_is_chmod_supported
())
...
...
@@ -275,7 +275,7 @@ void test_checkout_index__options_override_file_modes(void)
void
test_checkout_index__options_open_flags
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_git_mkfile
(
"./testrepo/new.txt"
,
"hi
\n
"
);
...
...
@@ -315,7 +315,7 @@ static int test_checkout_notify_cb(
void
test_checkout_index__can_notify_of_skipped_files
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
struct
notify_data
data
;
cl_git_mkfile
(
"./testrepo/new.txt"
,
"This isn't what's stored!"
);
...
...
@@ -360,7 +360,7 @@ static int dont_notify_cb(
void
test_checkout_index__wont_notify_of_expected_line_ending_changes
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_git_pass
(
p_unlink
(
"./testrepo/.gitattributes"
));
cl_repo_set_bool
(
g_repo
,
"core.autocrlf"
,
true
);
...
...
@@ -385,7 +385,7 @@ static void checkout_progress_counter(
void
test_checkout_index__calls_progress_callback
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
int
calls
=
0
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
...
...
@@ -398,7 +398,7 @@ void test_checkout_index__calls_progress_callback(void)
void
test_checkout_index__can_overcome_name_clashes
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_index
*
index
;
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
...
...
@@ -440,7 +440,7 @@ void test_checkout_index__can_overcome_name_clashes(void)
void
test_checkout_index__validates_struct_version
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
const
git_error
*
err
;
opts
.
version
=
1024
;
...
...
@@ -459,7 +459,7 @@ void test_checkout_index__validates_struct_version(void)
void
test_checkout_index__can_update_prefixed_files
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_assert_equal_i
(
false
,
git_path_isfile
(
"./testrepo/README"
));
cl_assert_equal_i
(
false
,
git_path_isfile
(
"./testrepo/branch_file.txt"
));
...
...
@@ -502,7 +502,7 @@ void test_checkout_index__can_checkout_a_newly_initialized_repository(void)
void
test_checkout_index__issue_1397
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
test_checkout_index__cleanup
();
...
...
@@ -519,7 +519,7 @@ void test_checkout_index__issue_1397(void)
void
test_checkout_index__target_directory
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
checkout_counts
cts
;
memset
(
&
cts
,
0
,
sizeof
(
cts
));
...
...
@@ -551,7 +551,7 @@ void test_checkout_index__target_directory(void)
void
test_checkout_index__target_directory_from_bare
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_index
*
index
;
git_object
*
head
=
NULL
;
checkout_counts
cts
;
...
...
@@ -600,7 +600,7 @@ void test_checkout_index__target_directory_from_bare(void)
void
test_checkout_index__can_get_repo_from_index
(
void
)
{
git_index
*
index
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
cl_assert_equal_i
(
false
,
git_path_isfile
(
"./testrepo/README"
));
cl_assert_equal_i
(
false
,
git_path_isfile
(
"./testrepo/branch_file.txt"
));
...
...
tests/checkout/tree.c
View file @
041cd4a2
...
...
@@ -7,14 +7,14 @@
#include "fileops.h"
static
git_repository
*
g_repo
;
static
git_checkout_opts
g_opts
;
static
git_checkout_opt
ion
s
g_opts
;
static
git_object
*
g_object
;
void
test_checkout_tree__initialize
(
void
)
{
g_repo
=
cl_git_sandbox_init
(
"testrepo"
);
GIT_INIT_STRUCTURE
(
&
g_opts
,
GIT_CHECKOUT_OPTS_VERSION
);
GIT_INIT_STRUCTURE
(
&
g_opts
,
GIT_CHECKOUT_OPT
ION
S_VERSION
);
g_opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE_CREATE
;
}
...
...
@@ -128,7 +128,7 @@ void test_checkout_tree__doesnt_write_unrequested_files_to_worktree(void)
git_oid
chomped_oid
;
git_commit
*
p_master_commit
;
git_commit
*
p_chomped_commit
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid_fromstr
(
&
master_oid
,
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750"
);
git_oid_fromstr
(
&
chomped_oid
,
"e90810b8df3e80c413d903f631643c716887138d"
);
...
...
@@ -148,7 +148,7 @@ void test_checkout_tree__doesnt_write_unrequested_files_to_worktree(void)
void
test_checkout_tree__can_switch_branches
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid
oid
;
git_object
*
obj
=
NULL
;
...
...
@@ -202,7 +202,7 @@ void test_checkout_tree__can_switch_branches(void)
void
test_checkout_tree__can_remove_untracked
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_REMOVE_UNTRACKED
;
...
...
@@ -216,7 +216,7 @@ void test_checkout_tree__can_remove_untracked(void)
void
test_checkout_tree__can_remove_ignored
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
int
ignored
=
0
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_REMOVE_IGNORED
;
...
...
@@ -239,7 +239,7 @@ static int checkout_tree_with_blob_ignored_in_workdir(int strategy, bool isdir)
{
git_oid
oid
;
git_object
*
obj
=
NULL
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
int
ignored
=
0
,
error
;
assert_on_branch
(
g_repo
,
"master"
);
...
...
@@ -344,7 +344,7 @@ void test_checkout_tree__can_overwrite_ignored_folder_by_default(void)
void
test_checkout_tree__can_update_only
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid
oid
;
git_object
*
obj
=
NULL
;
...
...
@@ -554,7 +554,7 @@ void test_checkout_tree__checking_out_a_conflicting_content_change_returns_EMERG
void
test_checkout_tree__donot_update_deleted_file_by_default
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid
old_id
,
new_id
;
git_commit
*
old_commit
=
NULL
,
*
new_commit
=
NULL
;
git_index
*
index
=
NULL
;
...
...
@@ -622,7 +622,7 @@ static int checkout_cancel_cb(
void
test_checkout_tree__can_cancel_checkout_from_notify
(
void
)
{
struct
checkout_cancel_at
ca
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid
oid
;
git_object
*
obj
=
NULL
;
...
...
@@ -674,7 +674,7 @@ void test_checkout_tree__can_cancel_checkout_from_notify(void)
void
test_checkout_tree__can_checkout_with_last_workdir_item_missing
(
void
)
{
git_index
*
index
=
NULL
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid
tree_id
,
commit_id
;
git_tree
*
tree
=
NULL
;
git_commit
*
commit
=
NULL
;
...
...
@@ -710,7 +710,7 @@ void test_checkout_tree__can_checkout_with_last_workdir_item_missing(void)
void
test_checkout_tree__issue_1397
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
const
char
*
partial_oid
=
"8a7ef04"
;
git_object
*
tree
=
NULL
;
...
...
@@ -733,7 +733,7 @@ void test_checkout_tree__issue_1397(void)
void
test_checkout_tree__can_write_to_empty_dirs
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid
oid
;
git_object
*
obj
=
NULL
;
...
...
@@ -759,7 +759,7 @@ void test_checkout_tree__can_write_to_empty_dirs(void)
void
test_checkout_tree__fails_when_dir_in_use
(
void
)
{
#ifdef GIT_WIN32
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid
oid
;
git_object
*
obj
=
NULL
;
...
...
@@ -792,7 +792,7 @@ void test_checkout_tree__fails_when_dir_in_use(void)
void
test_checkout_tree__can_continue_when_dir_in_use
(
void
)
{
#ifdef GIT_WIN32
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid
oid
;
git_object
*
obj
=
NULL
;
...
...
@@ -825,7 +825,7 @@ void test_checkout_tree__can_continue_when_dir_in_use(void)
void
test_checkout_tree__target_directory_from_bare
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid
oid
;
checkout_counts
cts
;
memset
(
&
cts
,
0
,
sizeof
(
cts
));
...
...
@@ -910,7 +910,7 @@ static void create_conflict(void)
void
test_checkout_tree__fails_when_conflicts_exist_in_index
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_oid
oid
;
git_object
*
obj
=
NULL
;
...
...
@@ -930,7 +930,7 @@ void test_checkout_tree__filemode_preserved_in_index(void)
{
git_oid
executable_oid
;
git_commit
*
commit
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_index
*
index
;
const
git_index_entry
*
entry
;
...
...
tests/checkout/typechange.c
View file @
041cd4a2
...
...
@@ -107,7 +107,7 @@ void test_checkout_typechange__checkout_typechanges_safe(void)
{
int
i
;
git_object
*
obj
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
for
(
i
=
0
;
g_typechange_oids
[
i
]
!=
NULL
;
++
i
)
{
cl_git_pass
(
git_revparse_single
(
&
obj
,
g_repo
,
g_typechange_oids
[
i
]));
...
...
@@ -194,7 +194,7 @@ void test_checkout_typechange__checkout_with_conflicts(void)
{
int
i
;
git_object
*
obj
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
notify_counts
cts
=
{
0
};
opts
.
notify_flags
=
...
...
tests/clone/nonetwork.c
View file @
041cd4a2
...
...
@@ -14,7 +14,7 @@ static git_remote* g_remote;
void
test_clone_nonetwork__initialize
(
void
)
{
git_checkout_opt
s
dummy_opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
dummy_opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_remote_callbacks
dummy_callbacks
=
GIT_REMOTE_CALLBACKS_INIT
;
g_repo
=
NULL
;
...
...
tests/diff/rename.c
View file @
041cd4a2
...
...
@@ -929,7 +929,7 @@ void test_diff_rename__rejected_match_can_match_others(void)
git_reference
*
head
,
*
selfsimilar
;
git_index
*
index
;
git_tree
*
tree
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_diff
*
diff
;
git_diff_options
diffopts
=
GIT_DIFF_OPTIONS_INIT
;
git_diff_find_options
findopts
=
GIT_DIFF_FIND_OPTIONS_INIT
;
...
...
@@ -1016,7 +1016,7 @@ void test_diff_rename__rejected_match_can_match_others_two(void)
git_reference
*
head
,
*
selfsimilar
;
git_index
*
index
;
git_tree
*
tree
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_diff
*
diff
;
git_diff_options
diffopts
=
GIT_DIFF_OPTIONS_INIT
;
git_diff_find_options
findopts
=
GIT_DIFF_FIND_OPTIONS_INIT
;
...
...
@@ -1072,7 +1072,7 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
git_reference
*
head
,
*
selfsimilar
;
git_index
*
index
;
git_tree
*
tree
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_diff
*
diff
;
git_diff_options
diffopts
=
GIT_DIFF_OPTIONS_INIT
;
git_diff_find_options
findopts
=
GIT_DIFF_FIND_OPTIONS_INIT
;
...
...
tests/index/names.c
View file @
041cd4a2
...
...
@@ -112,7 +112,7 @@ void test_index_names__cleaned_on_checkout_tree(void)
{
git_oid
oid
;
git_object
*
obj
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_UPDATE_ONLY
;
...
...
@@ -127,7 +127,7 @@ void test_index_names__cleaned_on_checkout_tree(void)
void
test_index_names__cleaned_on_checkout_head
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_UPDATE_ONLY
;
...
...
@@ -138,7 +138,7 @@ void test_index_names__cleaned_on_checkout_head(void)
void
test_index_names__retained_on_checkout_index
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_UPDATE_ONLY
;
...
...
tests/index/reuc.c
View file @
041cd4a2
...
...
@@ -336,7 +336,7 @@ void test_index_reuc__cleaned_on_checkout_tree(void)
{
git_oid
oid
;
git_object
*
obj
;
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_UPDATE_ONLY
;
...
...
@@ -351,7 +351,7 @@ void test_index_reuc__cleaned_on_checkout_tree(void)
void
test_index_reuc__cleaned_on_checkout_head
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_UPDATE_ONLY
;
...
...
@@ -362,7 +362,7 @@ void test_index_reuc__cleaned_on_checkout_head(void)
void
test_index_reuc__retained_on_checkout_index
(
void
)
{
git_checkout_opt
s
opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
|
GIT_CHECKOUT_UPDATE_ONLY
;
...
...
tests/merge/merge_helpers.c
View file @
041cd4a2
...
...
@@ -83,7 +83,7 @@ int merge_branches(git_merge_result **result, git_repository *repo, const char *
{
git_reference
*
head_ref
,
*
theirs_ref
;
git_merge_head
*
theirs_head
;
git_checkout_opt
s
head_checkout_opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
head_checkout_opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
head_checkout_opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
...
...
tests/merge/workdir/trivial.c
View file @
041cd4a2
...
...
@@ -31,7 +31,7 @@ void test_merge_workdir_trivial__cleanup(void)
static
int
merge_trivial
(
const
char
*
ours
,
const
char
*
theirs
)
{
git_buf
branch_buf
=
GIT_BUF_INIT
;
git_checkout_opt
s
checkout_opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
checkout_opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_reference
*
our_ref
,
*
their_ref
;
git_merge_head
*
their_heads
[
1
];
git_merge_opts
opts
=
GIT_MERGE_OPTS_INIT
;
...
...
tests/online/clone.c
View file @
041cd4a2
...
...
@@ -18,7 +18,7 @@ static git_clone_options g_options;
void
test_online_clone__initialize
(
void
)
{
git_checkout_opt
s
dummy_opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
dummy_opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_remote_callbacks
dummy_callbacks
=
GIT_REMOTE_CALLBACKS_INIT
;
g_repo
=
NULL
;
...
...
@@ -130,7 +130,7 @@ void test_online_clone__clone_into(void)
git_buf
path
=
GIT_BUF_INIT
;
git_remote
*
remote
;
git_reference
*
head
;
git_checkout_opt
s
checkout_opts
=
GIT_CHECKOUT_OPT
S_INIT
;
git_checkout_opt
ions
checkout_opts
=
GIT_CHECKOUT_OPTION
S_INIT
;
git_remote_callbacks
callbacks
=
GIT_REMOTE_CALLBACKS_INIT
;
bool
checkout_progress_cb_was_called
=
false
,
...
...
tests/revert/workdir.c
View file @
041cd4a2
...
...
@@ -347,7 +347,7 @@ void test_revert_workdir__conflict_use_ours(void)
{
git_commit
*
head
,
*
commit
;
git_oid
head_oid
,
revert_oid
;
git_revert_opt
s
opts
=
GIT_REVERT_OPT
S_INIT
;
git_revert_opt
ions
opts
=
GIT_REVERT_OPTION
S_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"caf99de3a49827117bb66721010eac461b06a80c"
,
0
,
"file1.txt"
},
...
...
@@ -387,7 +387,7 @@ void test_revert_workdir__rename_1_of_2(void)
{
git_commit
*
head
,
*
commit
;
git_oid
head_oid
,
revert_oid
;
git_revert_opt
s
opts
=
GIT_REVERT_OPT
S_INIT
;
git_revert_opt
ions
opts
=
GIT_REVERT_OPTION
S_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"747726e021bc5f44b86de60e3032fd6f9f1b8383"
,
0
,
"file1.txt"
},
...
...
@@ -421,7 +421,7 @@ void test_revert_workdir__rename(void)
{
git_commit
*
head
,
*
commit
;
git_oid
head_oid
,
revert_oid
;
git_revert_opt
s
opts
=
GIT_REVERT_OPT
S_INIT
;
git_revert_opt
ions
opts
=
GIT_REVERT_OPTION
S_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"55acf326a69f0aab7a974ec53ffa55a50bcac14e"
,
1
,
"file4.txt"
},
...
...
@@ -480,7 +480,7 @@ void test_revert_workdir__nonmerge_fails_mainline_specified(void)
{
git_reference
*
head
;
git_commit
*
commit
;
git_revert_opt
s
opts
=
GIT_REVERT_OPT
S_INIT
;
git_revert_opt
ions
opts
=
GIT_REVERT_OPTION
S_INIT
;
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_reference_peel
((
git_object
**
)
&
commit
,
head
,
GIT_OBJ_COMMIT
));
...
...
@@ -518,7 +518,7 @@ void test_revert_workdir__merge_first_parent(void)
{
git_commit
*
head
;
git_oid
head_oid
;
git_revert_opt
s
opts
=
GIT_REVERT_OPT
S_INIT
;
git_revert_opt
ions
opts
=
GIT_REVERT_OPTION
S_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"296a6d3be1dff05c5d1f631d2459389fa7b619eb"
,
0
,
"file-mainline.txt"
},
...
...
@@ -543,7 +543,7 @@ void test_revert_workdir__merge_second_parent(void)
{
git_commit
*
head
;
git_oid
head_oid
;
git_revert_opt
s
opts
=
GIT_REVERT_OPT
S_INIT
;
git_revert_opt
ions
opts
=
GIT_REVERT_OPTION
S_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"33c6fd981c49a2abf2971482089350bfc5cda8ea"
,
0
,
"file-branch.txt"
},
...
...
tests/structinit/structinit.c
View file @
041cd4a2
...
...
@@ -47,8 +47,8 @@ void test_structinit_structinit__compare(void)
/* checkout */
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
git_checkout_opt
s
,
GIT_CHECKOUT_OPT
S_VERSION
,
\
GIT_CHECKOUT_OPTS_INIT
,
git_checkout_init_opts
);
git_checkout_opt
ions
,
GIT_CHECKOUT_OPTION
S_VERSION
,
\
GIT_CHECKOUT_OPT
ION
S_INIT
,
git_checkout_init_opts
);
/* clone */
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
...
...
@@ -92,8 +92,8 @@ void test_structinit_structinit__compare(void)
/* revert */
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
git_revert_opt
s
,
GIT_REVERT_OPT
S_VERSION
,
\
GIT_REVERT_OPTS_INIT
,
git_revert_init_opts
);
git_revert_opt
ions
,
GIT_REVERT_OPTION
S_VERSION
,
\
GIT_REVERT_OPT
ION
S_INIT
,
git_revert_init_opts
);
/* status */
CHECK_MACRO_FUNC_INIT_EQUAL
(
\
...
...
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