mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-02 17:42:31 +00:00
git_checkout_opts -> git_checkout_options
This commit is contained in:
parent
8e52472037
commit
6affd71f33
@ -62,7 +62,7 @@ int do_clone(git_repository *repo, int argc, char **argv)
|
|||||||
progress_data pd = {{0}};
|
progress_data pd = {{0}};
|
||||||
git_repository *cloned_repo = NULL;
|
git_repository *cloned_repo = NULL;
|
||||||
git_clone_options clone_opts = GIT_CLONE_OPTIONS_INIT;
|
git_clone_options clone_opts = GIT_CLONE_OPTIONS_INIT;
|
||||||
git_checkout_opts checkout_opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
const char *url = argv[1];
|
const char *url = argv[1];
|
||||||
const char *path = argv[2];
|
const char *path = argv[2];
|
||||||
int error;
|
int error;
|
||||||
|
@ -225,12 +225,12 @@ typedef void (*git_checkout_progress_cb)(
|
|||||||
/**
|
/**
|
||||||
* Checkout options structure
|
* Checkout options structure
|
||||||
*
|
*
|
||||||
* Zero out for defaults. Initialize with `GIT_CHECKOUT_OPTS_INIT` macro to
|
* Zero out for defaults. Initialize with `GIT_CHECKOUT_OPTIONS_INIT` macro to
|
||||||
* correctly set the `version` field. E.g.
|
* correctly set the `version` field. E.g.
|
||||||
*
|
*
|
||||||
* git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
* git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
*/
|
*/
|
||||||
typedef struct git_checkout_opts {
|
typedef struct git_checkout_options {
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
|
|
||||||
unsigned int checkout_strategy; /** default will be a dry run */
|
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 *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 *our_label; /** the name of the "our" side of conflicts */
|
||||||
const char *their_label; /** the name of the "their" side of conflicts */
|
const char *their_label; /** the name of the "their" side of conflicts */
|
||||||
} git_checkout_opts;
|
} git_checkout_options;
|
||||||
|
|
||||||
#define GIT_CHECKOUT_OPTS_VERSION 1
|
#define GIT_CHECKOUT_OPTIONS_VERSION 1
|
||||||
#define GIT_CHECKOUT_OPTS_INIT {GIT_CHECKOUT_OPTS_VERSION}
|
#define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a `git_checkout_opts` with default values. Equivalent to
|
* Initializes a `git_checkout_options` with default values. Equivalent to
|
||||||
* creating an instance with GIT_CHECKOUT_OPTS_INIT.
|
* creating an instance with GIT_CHECKOUT_OPTIONS_INIT.
|
||||||
*
|
*
|
||||||
* @param opts the `git_checkout_opts` instance to initialize.
|
* @param opts the `git_checkout_options` instance to initialize.
|
||||||
* @param version the version of the struct; you should pass
|
* @param version the version of the struct; you should pass
|
||||||
* `GIT_CHECKOUT_OPTS_VERSION` here.
|
* `GIT_CHECKOUT_OPTIONS_VERSION` here.
|
||||||
* @return Zero on success; -1 on failure.
|
* @return Zero on success; -1 on failure.
|
||||||
*/
|
*/
|
||||||
GIT_EXTERN(int) git_checkout_init_opts(
|
GIT_EXTERN(int) git_checkout_init_opts(
|
||||||
git_checkout_opts* opts,
|
git_checkout_options* opts,
|
||||||
int version);
|
int version);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -291,7 +291,7 @@ GIT_EXTERN(int) git_checkout_init_opts(
|
|||||||
*/
|
*/
|
||||||
GIT_EXTERN(int) git_checkout_head(
|
GIT_EXTERN(int) git_checkout_head(
|
||||||
git_repository *repo,
|
git_repository *repo,
|
||||||
const git_checkout_opts *opts);
|
const git_checkout_options *opts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates files in the working tree to match the content of the index.
|
* 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_EXTERN(int) git_checkout_index(
|
||||||
git_repository *repo,
|
git_repository *repo,
|
||||||
git_index *index,
|
git_index *index,
|
||||||
const git_checkout_opts *opts);
|
const git_checkout_options *opts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates files in the index and working tree to match the content of the
|
* 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_EXTERN(int) git_checkout_tree(
|
||||||
git_repository *repo,
|
git_repository *repo,
|
||||||
const git_object *treeish,
|
const git_object *treeish,
|
||||||
const git_checkout_opts *opts);
|
const git_checkout_options *opts);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
GIT_END_DECL
|
GIT_END_DECL
|
||||||
|
@ -52,7 +52,7 @@ GIT_BEGIN_DECL
|
|||||||
typedef struct git_clone_options {
|
typedef struct git_clone_options {
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
|
|
||||||
git_checkout_opts checkout_opts;
|
git_checkout_options checkout_opts;
|
||||||
git_remote_callbacks remote_callbacks;
|
git_remote_callbacks remote_callbacks;
|
||||||
|
|
||||||
int bare;
|
int bare;
|
||||||
@ -63,7 +63,7 @@ typedef struct git_clone_options {
|
|||||||
} git_clone_options;
|
} git_clone_options;
|
||||||
|
|
||||||
#define GIT_CLONE_OPTIONS_VERSION 1
|
#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_OPTIONS_VERSION, GIT_CHECKOUT_SAFE_CREATE}, GIT_REMOTE_CALLBACKS_INIT}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a `git_clone_options` with default values. Equivalent to
|
* 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_EXTERN(int) git_clone_into(
|
||||||
git_repository *repo,
|
git_repository *repo,
|
||||||
git_remote *remote,
|
git_remote *remote,
|
||||||
const git_checkout_opts *co_opts,
|
const git_checkout_options *co_opts,
|
||||||
const char *branch,
|
const char *branch,
|
||||||
const git_signature *signature);
|
const git_signature *signature);
|
||||||
|
|
||||||
|
@ -150,11 +150,11 @@ typedef struct {
|
|||||||
git_merge_tree_opts merge_tree_opts;
|
git_merge_tree_opts merge_tree_opts;
|
||||||
|
|
||||||
/** Options for writing the merge result to the working directory. */
|
/** Options for writing the merge result to the working directory. */
|
||||||
git_checkout_opts checkout_opts;
|
git_checkout_options checkout_opts;
|
||||||
} git_merge_opts;
|
} git_merge_opts;
|
||||||
|
|
||||||
#define GIT_MERGE_OPTS_VERSION 1
|
#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_OPTIONS_INIT}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a `git_merge_opts` with default values. Equivalent to creating
|
* Initializes a `git_merge_opts` with default values. Equivalent to creating
|
||||||
|
@ -27,11 +27,11 @@ typedef struct {
|
|||||||
unsigned int mainline;
|
unsigned int mainline;
|
||||||
|
|
||||||
git_merge_tree_opts merge_tree_opts;
|
git_merge_tree_opts merge_tree_opts;
|
||||||
git_checkout_opts checkout_opts;
|
git_checkout_options checkout_opts;
|
||||||
} git_revert_opts;
|
} git_revert_opts;
|
||||||
|
|
||||||
#define GIT_REVERT_OPTS_VERSION 1
|
#define GIT_REVERT_OPTS_VERSION 1
|
||||||
#define GIT_REVERT_OPTS_INIT {GIT_REVERT_OPTS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTS_INIT}
|
#define GIT_REVERT_OPTS_INIT {GIT_REVERT_OPTS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a `git_revert_opts` with default values. Equivalent to
|
* Initializes a `git_revert_opts` with default values. Equivalent to
|
||||||
|
@ -47,7 +47,7 @@ enum {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
git_repository *repo;
|
git_repository *repo;
|
||||||
git_diff *diff;
|
git_diff *diff;
|
||||||
git_checkout_opts opts;
|
git_checkout_options opts;
|
||||||
bool opts_free_baseline;
|
bool opts_free_baseline;
|
||||||
char *pfx;
|
char *pfx;
|
||||||
git_index *index;
|
git_index *index;
|
||||||
@ -1144,7 +1144,7 @@ static int blob_content_to_file(
|
|||||||
const char *path,
|
const char *path,
|
||||||
const char * hint_path,
|
const char * hint_path,
|
||||||
mode_t entry_filemode,
|
mode_t entry_filemode,
|
||||||
git_checkout_opts *opts)
|
git_checkout_options *opts)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
mode_t file_mode = opts->file_mode ? opts->file_mode : entry_filemode;
|
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(
|
static int checkout_data_init(
|
||||||
checkout_data *data,
|
checkout_data *data,
|
||||||
git_iterator *target,
|
git_iterator *target,
|
||||||
const git_checkout_opts *proposed)
|
const git_checkout_options *proposed)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
git_repository *repo = git_iterator_owner(target);
|
git_repository *repo = git_iterator_owner(target);
|
||||||
@ -1875,12 +1875,12 @@ static int checkout_data_init(
|
|||||||
data->repo = repo;
|
data->repo = repo;
|
||||||
|
|
||||||
GITERR_CHECK_VERSION(
|
GITERR_CHECK_VERSION(
|
||||||
proposed, GIT_CHECKOUT_OPTS_VERSION, "git_checkout_opts");
|
proposed, GIT_CHECKOUT_OPTIONS_VERSION, "git_checkout_options");
|
||||||
|
|
||||||
if (!proposed)
|
if (!proposed)
|
||||||
GIT_INIT_STRUCTURE(&data->opts, GIT_CHECKOUT_OPTS_VERSION);
|
GIT_INIT_STRUCTURE(&data->opts, GIT_CHECKOUT_OPTIONS_VERSION);
|
||||||
else
|
else
|
||||||
memmove(&data->opts, proposed, sizeof(git_checkout_opts));
|
memmove(&data->opts, proposed, sizeof(git_checkout_options));
|
||||||
|
|
||||||
if (!data->opts.target_directory)
|
if (!data->opts.target_directory)
|
||||||
data->opts.target_directory = git_repository_workdir(repo);
|
data->opts.target_directory = git_repository_workdir(repo);
|
||||||
@ -2000,7 +2000,7 @@ cleanup:
|
|||||||
|
|
||||||
int git_checkout_iterator(
|
int git_checkout_iterator(
|
||||||
git_iterator *target,
|
git_iterator *target,
|
||||||
const git_checkout_opts *opts)
|
const git_checkout_options *opts)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
git_iterator *baseline = NULL, *workdir = NULL;
|
git_iterator *baseline = NULL, *workdir = NULL;
|
||||||
@ -2106,7 +2106,7 @@ cleanup:
|
|||||||
int git_checkout_index(
|
int git_checkout_index(
|
||||||
git_repository *repo,
|
git_repository *repo,
|
||||||
git_index *index,
|
git_index *index,
|
||||||
const git_checkout_opts *opts)
|
const git_checkout_options *opts)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
git_iterator *index_i;
|
git_iterator *index_i;
|
||||||
@ -2141,7 +2141,7 @@ int git_checkout_index(
|
|||||||
int git_checkout_tree(
|
int git_checkout_tree(
|
||||||
git_repository *repo,
|
git_repository *repo,
|
||||||
const git_object *treeish,
|
const git_object *treeish,
|
||||||
const git_checkout_opts *opts)
|
const git_checkout_options *opts)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
git_tree *tree = NULL;
|
git_tree *tree = NULL;
|
||||||
@ -2189,19 +2189,19 @@ int git_checkout_tree(
|
|||||||
|
|
||||||
int git_checkout_head(
|
int git_checkout_head(
|
||||||
git_repository *repo,
|
git_repository *repo,
|
||||||
const git_checkout_opts *opts)
|
const git_checkout_options *opts)
|
||||||
{
|
{
|
||||||
assert(repo);
|
assert(repo);
|
||||||
return git_checkout_tree(repo, NULL, opts);
|
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_options* opts, int version)
|
||||||
{
|
{
|
||||||
if (version != GIT_CHECKOUT_OPTS_VERSION) {
|
if (version != GIT_CHECKOUT_OPTIONS_VERSION) {
|
||||||
giterr_set(GITERR_INVALID, "Invalid version %d for git_checkout_opts", version);
|
giterr_set(GITERR_INVALID, "Invalid version %d for git_checkout_options", version);
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
git_checkout_opts o = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options o = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
memcpy(opts, &o, sizeof(o));
|
memcpy(opts, &o, sizeof(o));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
extern int git_checkout_iterator(
|
extern int git_checkout_iterator(
|
||||||
git_iterator *target,
|
git_iterator *target,
|
||||||
const git_checkout_opts *opts);
|
const git_checkout_options *opts);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -322,7 +322,7 @@ on_error:
|
|||||||
static bool should_checkout(
|
static bool should_checkout(
|
||||||
git_repository *repo,
|
git_repository *repo,
|
||||||
bool is_bare,
|
bool is_bare,
|
||||||
const git_checkout_opts *opts)
|
const git_checkout_options *opts)
|
||||||
{
|
{
|
||||||
if (is_bare)
|
if (is_bare)
|
||||||
return false;
|
return false;
|
||||||
@ -336,7 +336,7 @@ static bool should_checkout(
|
|||||||
return !git_repository_head_unborn(repo);
|
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_options *co_opts, const char *branch, const git_signature *signature)
|
||||||
{
|
{
|
||||||
int error = 0, old_fetchhead;
|
int error = 0, old_fetchhead;
|
||||||
git_strarray refspecs;
|
git_strarray refspecs;
|
||||||
|
@ -102,7 +102,7 @@ int git_reset(
|
|||||||
git_index *index = NULL;
|
git_index *index = NULL;
|
||||||
git_tree *tree = NULL;
|
git_tree *tree = NULL;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_buf log_message_buf = GIT_BUF_INIT;
|
git_buf log_message_buf = GIT_BUF_INIT;
|
||||||
|
|
||||||
assert(repo && target);
|
assert(repo && target);
|
||||||
|
@ -468,7 +468,7 @@ static int reset_index_and_workdir(
|
|||||||
bool remove_untracked,
|
bool remove_untracked,
|
||||||
bool remove_ignored)
|
bool remove_ignored)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
|
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ static void execute_test(void)
|
|||||||
git_oid oid, check;
|
git_oid oid, check;
|
||||||
git_commit *commit;
|
git_commit *commit;
|
||||||
git_tree *tree;
|
git_tree *tree;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/branch1"));
|
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/branch1"));
|
||||||
cl_git_pass(git_commit_lookup(&commit, g_repo, &oid));
|
cl_git_pass(git_commit_lookup(&commit, g_repo, &oid));
|
||||||
|
@ -207,7 +207,7 @@ static void ensure_workdir_link(const char *path, const char *target)
|
|||||||
|
|
||||||
void test_checkout_conflict__ignored(void)
|
void test_checkout_conflict__ignored(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy |= GIT_CHECKOUT_SKIP_UNMERGED;
|
opts.checkout_strategy |= GIT_CHECKOUT_SKIP_UNMERGED;
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ void test_checkout_conflict__ignored(void)
|
|||||||
|
|
||||||
void test_checkout_conflict__ours(void)
|
void test_checkout_conflict__ours(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy |= GIT_CHECKOUT_USE_OURS;
|
opts.checkout_strategy |= GIT_CHECKOUT_USE_OURS;
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ void test_checkout_conflict__ours(void)
|
|||||||
|
|
||||||
void test_checkout_conflict__theirs(void)
|
void test_checkout_conflict__theirs(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy |= GIT_CHECKOUT_USE_THEIRS;
|
opts.checkout_strategy |= GIT_CHECKOUT_USE_THEIRS;
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ void test_checkout_conflict__theirs(void)
|
|||||||
|
|
||||||
void test_checkout_conflict__diff3(void)
|
void test_checkout_conflict__diff3(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
create_conflicting_index();
|
create_conflicting_index();
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ void test_checkout_conflict__diff3(void)
|
|||||||
|
|
||||||
void test_checkout_conflict__automerge(void)
|
void test_checkout_conflict__automerge(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0100644, AUTOMERGEABLE_ANCESTOR_OID, 1, "automergeable.txt" },
|
{ 0100644, AUTOMERGEABLE_ANCESTOR_OID, 1, "automergeable.txt" },
|
||||||
@ -277,7 +277,7 @@ void test_checkout_conflict__automerge(void)
|
|||||||
|
|
||||||
void test_checkout_conflict__directory_file(void)
|
void test_checkout_conflict__directory_file(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0100644, CONFLICTING_ANCESTOR_OID, 1, "df-1" },
|
{ 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)
|
void test_checkout_conflict__directory_file_with_custom_labels(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0100644, CONFLICTING_ANCESTOR_OID, 1, "df-1" },
|
{ 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)
|
void test_checkout_conflict__link_file(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0100644, CONFLICTING_ANCESTOR_OID, 1, "link-1" },
|
{ 0100644, CONFLICTING_ANCESTOR_OID, 1, "link-1" },
|
||||||
@ -393,7 +393,7 @@ void test_checkout_conflict__link_file(void)
|
|||||||
|
|
||||||
void test_checkout_conflict__links(void)
|
void test_checkout_conflict__links(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0120000, LINK_ANCESTOR_OID, 1, "link-1" },
|
{ 0120000, LINK_ANCESTOR_OID, 1, "link-1" },
|
||||||
@ -418,7 +418,7 @@ void test_checkout_conflict__links(void)
|
|||||||
|
|
||||||
void test_checkout_conflict__add_add(void)
|
void test_checkout_conflict__add_add(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0100644, CONFLICTING_OURS_OID, 2, "conflicting.txt" },
|
{ 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)
|
void test_checkout_conflict__mode_change(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0100644, CONFLICTING_ANCESTOR_OID, 1, "executable-1" },
|
{ 0100644, CONFLICTING_ANCESTOR_OID, 1, "executable-1" },
|
||||||
@ -495,7 +495,7 @@ void test_checkout_conflict__mode_change(void)
|
|||||||
|
|
||||||
void test_checkout_conflict__renames(void)
|
void test_checkout_conflict__renames(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0100644, "68c6c84b091926c7d90aa6a79b2bc3bb6adccd8e", 0, "0a-no-change.txt" },
|
{ 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)
|
void test_checkout_conflict__rename_keep_ours(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0100644, "68c6c84b091926c7d90aa6a79b2bc3bb6adccd8e", 0, "0a-no-change.txt" },
|
{ 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)
|
void test_checkout_conflict__name_mangled_file_exists_in_workdir(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 1, "test-one-side-one.txt" },
|
{ 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)
|
void test_checkout_conflict__update_only(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
struct checkout_index_entry checkout_index_entries[] = {
|
struct checkout_index_entry checkout_index_entries[] = {
|
||||||
{ 0100644, AUTOMERGEABLE_ANCESTOR_OID, 1, "automergeable.txt" },
|
{ 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)
|
void test_checkout_conflict__path_filters(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
char *paths[] = { "conflicting-1.txt", "conflicting-3.txt" };
|
char *paths[] = { "conflicting-1.txt", "conflicting-3.txt" };
|
||||||
git_strarray patharray = {0};
|
git_strarray patharray = {0};
|
||||||
|
|
||||||
@ -1089,7 +1089,7 @@ static void collect_progress(
|
|||||||
|
|
||||||
void test_checkout_conflict__report_progress(void)
|
void test_checkout_conflict__report_progress(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_vector paths = GIT_VECTOR_INIT;
|
git_vector paths = GIT_VECTOR_INIT;
|
||||||
char *path;
|
char *path;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@ -18,11 +18,24 @@ void test_checkout_crlf__cleanup(void)
|
|||||||
cl_git_sandbox_cleanup();
|
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)
|
void test_checkout_crlf__autocrlf_false_index_size_is_unfiltered_size(void)
|
||||||
{
|
{
|
||||||
git_index *index;
|
git_index *index;
|
||||||
const git_index_entry *entry;
|
const git_index_entry *entry;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_repo_set_bool(g_repo, "core.autocrlf", false);
|
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)
|
void test_checkout_crlf__detect_crlf_autocrlf_true(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_repo_set_bool(g_repo, "core.autocrlf", true);
|
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)
|
void test_checkout_crlf__more_lf_autocrlf_true(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_repo_set_bool(g_repo, "core.autocrlf", true);
|
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)
|
void test_checkout_crlf__more_crlf_autocrlf_true(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_repo_set_bool(g_repo, "core.autocrlf", true);
|
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);
|
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)
|
void test_checkout_crlf__autocrlf_true_index_size_is_filtered_size(void)
|
||||||
{
|
{
|
||||||
git_index *index;
|
git_index *index;
|
||||||
const git_index_entry *entry;
|
const git_index_entry *entry;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_repo_set_bool(g_repo, "core.autocrlf", true);
|
cl_repo_set_bool(g_repo, "core.autocrlf", true);
|
||||||
@ -117,7 +142,7 @@ void test_checkout_crlf__with_ident(void)
|
|||||||
{
|
{
|
||||||
git_index *index;
|
git_index *index;
|
||||||
git_blob *blob;
|
git_blob *blob;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_git_mkfile("crlf/.gitattributes",
|
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)
|
void test_checkout_crlf__autocrlf_false_no_attrs(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_repo_set_bool(g_repo, "core.autocrlf", false);
|
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)
|
void test_checkout_crlf__autocrlf_true_no_attrs(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_repo_set_bool(g_repo, "core.autocrlf", true);
|
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)
|
void test_checkout_crlf__autocrlf_input_no_attrs(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_repo_set_string(g_repo, "core.autocrlf", "input");
|
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)
|
void test_checkout_crlf__autocrlf_false_text_auto_attr(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_git_mkfile("./crlf/.gitattributes", "* text=auto\n");
|
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)
|
void test_checkout_crlf__autocrlf_true_text_auto_attr(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_git_mkfile("./crlf/.gitattributes", "* text=auto\n");
|
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)
|
void test_checkout_crlf__autocrlf_input_text_auto_attr(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
||||||
|
|
||||||
cl_git_mkfile("./crlf/.gitattributes", "* text=auto\n");
|
cl_git_mkfile("./crlf/.gitattributes", "* text=auto\n");
|
||||||
|
@ -25,7 +25,7 @@ void test_checkout_head__unborn_head_returns_GIT_EUNBORNBRANCH(void)
|
|||||||
|
|
||||||
void test_checkout_head__with_index_only_tree(void)
|
void test_checkout_head__with_index_only_tree(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_index *index;
|
git_index *index;
|
||||||
|
|
||||||
/* let's start by getting things into a known state */
|
/* let's start by getting things into a known state */
|
||||||
|
@ -43,7 +43,7 @@ void test_checkout_index__cannot_checkout_a_bare_repository(void)
|
|||||||
|
|
||||||
void test_checkout_index__can_create_missing_files(void)
|
void test_checkout_index__can_create_missing_files(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
|
cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
|
||||||
cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt"));
|
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)
|
void test_checkout_index__can_remove_untracked_files(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
git_futils_mkdir("./testrepo/dir/subdir/subsubdir", NULL, 0755, GIT_MKDIR_PATH);
|
git_futils_mkdir("./testrepo/dir/subdir/subsubdir", NULL, 0755, GIT_MKDIR_PATH);
|
||||||
cl_git_mkfile("./testrepo/dir/one", "one\n");
|
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)
|
void test_checkout_index__honor_the_specified_pathspecs(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
char *entries[] = { "*.txt" };
|
char *entries[] = { "*.txt" };
|
||||||
|
|
||||||
opts.paths.strings = entries;
|
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)
|
void test_checkout_index__honor_the_gitattributes_directives(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
const char *attributes =
|
const char *attributes =
|
||||||
"branch_file.txt text eol=crlf\n"
|
"branch_file.txt text eol=crlf\n"
|
||||||
"new.txt text eol=lf\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)
|
void test_checkout_index__honor_coreautocrlf_setting_set_to_true(void)
|
||||||
{
|
{
|
||||||
#ifdef GIT_WIN32
|
#ifdef GIT_WIN32
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
const char *expected_readme_text = "hey there\r\n";
|
const char *expected_readme_text = "hey there\r\n";
|
||||||
|
|
||||||
cl_git_pass(p_unlink("./testrepo/.gitattributes"));
|
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)
|
void test_checkout_index__honor_coresymlinks_setting_set_to_true(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_repo_set_bool(g_repo, "core.symlinks", true);
|
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)
|
void test_checkout_index__honor_coresymlinks_setting_set_to_false(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_repo_set_bool(g_repo, "core.symlinks", false);
|
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)
|
void test_checkout_index__donot_overwrite_modified_file_by_default(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_git_mkfile("./testrepo/new.txt", "This isn't what's stored!");
|
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)
|
void test_checkout_index__can_overwrite_modified_file(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_git_mkfile("./testrepo/new.txt", "This isn't what's stored!");
|
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)
|
void test_checkout_index__options_disable_filters(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_git_mkfile("./testrepo/.gitattributes", "*.txt text eol=crlf\n");
|
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)
|
void test_checkout_index__options_dir_modes(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_commit *commit;
|
git_commit *commit;
|
||||||
@ -258,7 +258,7 @@ void test_checkout_index__options_dir_modes(void)
|
|||||||
|
|
||||||
void test_checkout_index__options_override_file_modes(void)
|
void test_checkout_index__options_override_file_modes(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (!cl_is_chmod_supported())
|
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)
|
void test_checkout_index__options_open_flags(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_git_mkfile("./testrepo/new.txt", "hi\n");
|
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)
|
void test_checkout_index__can_notify_of_skipped_files(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
struct notify_data data;
|
struct notify_data data;
|
||||||
|
|
||||||
cl_git_mkfile("./testrepo/new.txt", "This isn't what's stored!");
|
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)
|
void test_checkout_index__wont_notify_of_expected_line_ending_changes(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_git_pass(p_unlink("./testrepo/.gitattributes"));
|
cl_git_pass(p_unlink("./testrepo/.gitattributes"));
|
||||||
cl_repo_set_bool(g_repo, "core.autocrlf", true);
|
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)
|
void test_checkout_index__calls_progress_callback(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
int calls = 0;
|
int calls = 0;
|
||||||
|
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
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)
|
void test_checkout_index__can_overcome_name_clashes(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_index *index;
|
git_index *index;
|
||||||
|
|
||||||
cl_git_pass(git_repository_index(&index, g_repo));
|
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)
|
void test_checkout_index__validates_struct_version(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
const git_error *err;
|
const git_error *err;
|
||||||
|
|
||||||
opts.version = 1024;
|
opts.version = 1024;
|
||||||
@ -459,7 +459,7 @@ void test_checkout_index__validates_struct_version(void)
|
|||||||
|
|
||||||
void test_checkout_index__can_update_prefixed_files(void)
|
void test_checkout_index__can_update_prefixed_files(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
|
cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
|
||||||
cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt"));
|
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)
|
void test_checkout_index__issue_1397(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
test_checkout_index__cleanup();
|
test_checkout_index__cleanup();
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ void test_checkout_index__issue_1397(void)
|
|||||||
|
|
||||||
void test_checkout_index__target_directory(void)
|
void test_checkout_index__target_directory(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
checkout_counts cts;
|
checkout_counts cts;
|
||||||
memset(&cts, 0, sizeof(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)
|
void test_checkout_index__target_directory_from_bare(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_index *index;
|
git_index *index;
|
||||||
git_object *head = NULL;
|
git_object *head = NULL;
|
||||||
checkout_counts cts;
|
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)
|
void test_checkout_index__can_get_repo_from_index(void)
|
||||||
{
|
{
|
||||||
git_index *index;
|
git_index *index;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
|
cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
|
||||||
cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt"));
|
cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt"));
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
#include "fileops.h"
|
#include "fileops.h"
|
||||||
|
|
||||||
static git_repository *g_repo;
|
static git_repository *g_repo;
|
||||||
static git_checkout_opts g_opts;
|
static git_checkout_options g_opts;
|
||||||
static git_object *g_object;
|
static git_object *g_object;
|
||||||
|
|
||||||
void test_checkout_tree__initialize(void)
|
void test_checkout_tree__initialize(void)
|
||||||
{
|
{
|
||||||
g_repo = cl_git_sandbox_init("testrepo");
|
g_repo = cl_git_sandbox_init("testrepo");
|
||||||
|
|
||||||
GIT_INIT_STRUCTURE(&g_opts, GIT_CHECKOUT_OPTS_VERSION);
|
GIT_INIT_STRUCTURE(&g_opts, GIT_CHECKOUT_OPTIONS_VERSION);
|
||||||
g_opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
|
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_oid chomped_oid;
|
||||||
git_commit* p_master_commit;
|
git_commit* p_master_commit;
|
||||||
git_commit* p_chomped_commit;
|
git_commit* p_chomped_commit;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
git_oid_fromstr(&master_oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
git_oid_fromstr(&master_oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
||||||
git_oid_fromstr(&chomped_oid, "e90810b8df3e80c413d903f631643c716887138d");
|
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)
|
void test_checkout_tree__can_switch_branches(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_object *obj = NULL;
|
git_object *obj = NULL;
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ void test_checkout_tree__can_switch_branches(void)
|
|||||||
|
|
||||||
void test_checkout_tree__can_remove_untracked(void)
|
void test_checkout_tree__can_remove_untracked(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_REMOVE_UNTRACKED;
|
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)
|
void test_checkout_tree__can_remove_ignored(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
int ignored = 0;
|
int ignored = 0;
|
||||||
|
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_REMOVE_IGNORED;
|
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_oid oid;
|
||||||
git_object *obj = NULL;
|
git_object *obj = NULL;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
int ignored = 0, error;
|
int ignored = 0, error;
|
||||||
|
|
||||||
assert_on_branch(g_repo, "master");
|
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)
|
void test_checkout_tree__can_update_only(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_object *obj = NULL;
|
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)
|
void test_checkout_tree__donot_update_deleted_file_by_default(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_oid old_id, new_id;
|
git_oid old_id, new_id;
|
||||||
git_commit *old_commit = NULL, *new_commit = NULL;
|
git_commit *old_commit = NULL, *new_commit = NULL;
|
||||||
git_index *index = NULL;
|
git_index *index = NULL;
|
||||||
@ -622,7 +622,7 @@ static int checkout_cancel_cb(
|
|||||||
void test_checkout_tree__can_cancel_checkout_from_notify(void)
|
void test_checkout_tree__can_cancel_checkout_from_notify(void)
|
||||||
{
|
{
|
||||||
struct checkout_cancel_at ca;
|
struct checkout_cancel_at ca;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_object *obj = NULL;
|
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)
|
void test_checkout_tree__can_checkout_with_last_workdir_item_missing(void)
|
||||||
{
|
{
|
||||||
git_index *index = NULL;
|
git_index *index = NULL;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_oid tree_id, commit_id;
|
git_oid tree_id, commit_id;
|
||||||
git_tree *tree = NULL;
|
git_tree *tree = NULL;
|
||||||
git_commit *commit = 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)
|
void test_checkout_tree__issue_1397(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
const char *partial_oid = "8a7ef04";
|
const char *partial_oid = "8a7ef04";
|
||||||
git_object *tree = NULL;
|
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)
|
void test_checkout_tree__can_write_to_empty_dirs(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_object *obj = NULL;
|
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)
|
void test_checkout_tree__fails_when_dir_in_use(void)
|
||||||
{
|
{
|
||||||
#ifdef GIT_WIN32
|
#ifdef GIT_WIN32
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_object *obj = NULL;
|
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)
|
void test_checkout_tree__can_continue_when_dir_in_use(void)
|
||||||
{
|
{
|
||||||
#ifdef GIT_WIN32
|
#ifdef GIT_WIN32
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_object *obj = NULL;
|
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)
|
void test_checkout_tree__target_directory_from_bare(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
checkout_counts cts;
|
checkout_counts cts;
|
||||||
memset(&cts, 0, sizeof(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)
|
void test_checkout_tree__fails_when_conflicts_exist_in_index(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_object *obj = NULL;
|
git_object *obj = NULL;
|
||||||
|
|
||||||
@ -930,7 +930,7 @@ void test_checkout_tree__filemode_preserved_in_index(void)
|
|||||||
{
|
{
|
||||||
git_oid executable_oid;
|
git_oid executable_oid;
|
||||||
git_commit *commit;
|
git_commit *commit;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_index *index;
|
git_index *index;
|
||||||
const git_index_entry *entry;
|
const git_index_entry *entry;
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void test_checkout_typechange__checkout_typechanges_safe(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
git_object *obj;
|
git_object *obj;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
for (i = 0; g_typechange_oids[i] != NULL; ++i) {
|
for (i = 0; g_typechange_oids[i] != NULL; ++i) {
|
||||||
cl_git_pass(git_revparse_single(&obj, g_repo, g_typechange_oids[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;
|
int i;
|
||||||
git_object *obj;
|
git_object *obj;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
notify_counts cts = {0};
|
notify_counts cts = {0};
|
||||||
|
|
||||||
opts.notify_flags =
|
opts.notify_flags =
|
||||||
|
@ -14,7 +14,7 @@ static git_remote* g_remote;
|
|||||||
|
|
||||||
void test_clone_nonetwork__initialize(void)
|
void test_clone_nonetwork__initialize(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts dummy_opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options dummy_opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_remote_callbacks dummy_callbacks = GIT_REMOTE_CALLBACKS_INIT;
|
git_remote_callbacks dummy_callbacks = GIT_REMOTE_CALLBACKS_INIT;
|
||||||
|
|
||||||
g_repo = NULL;
|
g_repo = NULL;
|
||||||
|
@ -929,7 +929,7 @@ void test_diff_rename__rejected_match_can_match_others(void)
|
|||||||
git_reference *head, *selfsimilar;
|
git_reference *head, *selfsimilar;
|
||||||
git_index *index;
|
git_index *index;
|
||||||
git_tree *tree;
|
git_tree *tree;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_diff *diff;
|
git_diff *diff;
|
||||||
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
|
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
|
||||||
git_diff_find_options findopts = GIT_DIFF_FIND_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_reference *head, *selfsimilar;
|
||||||
git_index *index;
|
git_index *index;
|
||||||
git_tree *tree;
|
git_tree *tree;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_diff *diff;
|
git_diff *diff;
|
||||||
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
|
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
|
||||||
git_diff_find_options findopts = GIT_DIFF_FIND_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_reference *head, *selfsimilar;
|
||||||
git_index *index;
|
git_index *index;
|
||||||
git_tree *tree;
|
git_tree *tree;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_diff *diff;
|
git_diff *diff;
|
||||||
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
|
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
|
||||||
git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
|
git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
|
||||||
|
@ -112,7 +112,7 @@ void test_index_names__cleaned_on_checkout_tree(void)
|
|||||||
{
|
{
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_object *obj;
|
git_object *obj;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
|
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)
|
void test_index_names__cleaned_on_checkout_head(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
|
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)
|
void test_index_names__retained_on_checkout_index(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ void test_index_reuc__cleaned_on_checkout_tree(void)
|
|||||||
{
|
{
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
git_object *obj;
|
git_object *obj;
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
|
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)
|
void test_index_reuc__cleaned_on_checkout_head(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
|
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)
|
void test_index_reuc__retained_on_checkout_index(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
|
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ int merge_branches(git_merge_result **result, git_repository *repo, const char *
|
|||||||
{
|
{
|
||||||
git_reference *head_ref, *theirs_ref;
|
git_reference *head_ref, *theirs_ref;
|
||||||
git_merge_head *theirs_head;
|
git_merge_head *theirs_head;
|
||||||
git_checkout_opts head_checkout_opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options head_checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
|
|
||||||
head_checkout_opts.checkout_strategy = GIT_CHECKOUT_FORCE;
|
head_checkout_opts.checkout_strategy = GIT_CHECKOUT_FORCE;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ void test_merge_workdir_trivial__cleanup(void)
|
|||||||
static int merge_trivial(const char *ours, const char *theirs)
|
static int merge_trivial(const char *ours, const char *theirs)
|
||||||
{
|
{
|
||||||
git_buf branch_buf = GIT_BUF_INIT;
|
git_buf branch_buf = GIT_BUF_INIT;
|
||||||
git_checkout_opts checkout_opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_reference *our_ref, *their_ref;
|
git_reference *our_ref, *their_ref;
|
||||||
git_merge_head *their_heads[1];
|
git_merge_head *their_heads[1];
|
||||||
git_merge_opts opts = GIT_MERGE_OPTS_INIT;
|
git_merge_opts opts = GIT_MERGE_OPTS_INIT;
|
||||||
|
@ -18,7 +18,7 @@ static git_clone_options g_options;
|
|||||||
|
|
||||||
void test_online_clone__initialize(void)
|
void test_online_clone__initialize(void)
|
||||||
{
|
{
|
||||||
git_checkout_opts dummy_opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options dummy_opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_remote_callbacks dummy_callbacks = GIT_REMOTE_CALLBACKS_INIT;
|
git_remote_callbacks dummy_callbacks = GIT_REMOTE_CALLBACKS_INIT;
|
||||||
|
|
||||||
g_repo = NULL;
|
g_repo = NULL;
|
||||||
@ -130,7 +130,7 @@ void test_online_clone__clone_into(void)
|
|||||||
git_buf path = GIT_BUF_INIT;
|
git_buf path = GIT_BUF_INIT;
|
||||||
git_remote *remote;
|
git_remote *remote;
|
||||||
git_reference *head;
|
git_reference *head;
|
||||||
git_checkout_opts checkout_opts = GIT_CHECKOUT_OPTS_INIT;
|
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||||
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
|
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
|
||||||
|
|
||||||
bool checkout_progress_cb_was_called = false,
|
bool checkout_progress_cb_was_called = false,
|
||||||
|
@ -47,8 +47,8 @@ void test_structinit_structinit__compare(void)
|
|||||||
|
|
||||||
/* checkout */
|
/* checkout */
|
||||||
CHECK_MACRO_FUNC_INIT_EQUAL( \
|
CHECK_MACRO_FUNC_INIT_EQUAL( \
|
||||||
git_checkout_opts, GIT_CHECKOUT_OPTS_VERSION, \
|
git_checkout_options, GIT_CHECKOUT_OPTIONS_VERSION, \
|
||||||
GIT_CHECKOUT_OPTS_INIT, git_checkout_init_opts);
|
GIT_CHECKOUT_OPTIONS_INIT, git_checkout_init_opts);
|
||||||
|
|
||||||
/* clone */
|
/* clone */
|
||||||
CHECK_MACRO_FUNC_INIT_EQUAL( \
|
CHECK_MACRO_FUNC_INIT_EQUAL( \
|
||||||
|
Loading…
Reference in New Issue
Block a user