本文整理汇总了C++中cl_repo_set_bool函数的典型用法代码示例。如果您正苦于以下问题:C++ cl_repo_set_bool函数的具体用法?C++ cl_repo_set_bool怎么用?C++ cl_repo_set_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cl_repo_set_bool函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_filter_query__autocrlf_true_implies_crlf
void test_filter_query__autocrlf_true_implies_crlf(void)
{
cl_repo_set_bool(g_repo, "core.autocrlf", true);
cl_assert_equal_i(1, filter_for("not_in_gitattributes", "crlf"));
cl_assert_equal_i(1, filter_for("foo.txt", "crlf"));
cl_assert_equal_i(0, filter_for("foo.bin", "crlf"));
cl_assert_equal_i(1, filter_for("foo.lf", "crlf"));
cl_repo_set_bool(g_repo, "core.autocrlf", false);
cl_assert_equal_i(0, filter_for("not_in_gitattributes", "crlf"));
cl_assert_equal_i(1, filter_for("foo.txt", "crlf"));
cl_assert_equal_i(0, filter_for("foo.bin", "crlf"));
cl_assert_equal_i(1, filter_for("foo.lf", "crlf"));
}
开发者ID:1336,项目名称:libgit2,代码行数:14,代码来源:query.c
示例2: test_checkout_index__honor_coresymlinks_setting_set_to_true
void test_checkout_index__honor_coresymlinks_setting_set_to_true(void)
{
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
cl_repo_set_bool(g_repo, "core.symlinks", true);
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
#ifdef GIT_WIN32
check_file_contents("./testrepo/link_to_new.txt", "new.txt");
#else
{
char link_data[1024];
size_t link_size = 1024;
link_size = p_readlink("./testrepo/link_to_new.txt", link_data, link_size);
link_data[link_size] = '\0';
cl_assert_equal_i(link_size, strlen("new.txt"));
cl_assert_equal_s(link_data, "new.txt");
check_file_contents("./testrepo/link_to_new.txt", "my new file\n");
}
#endif
}
开发者ID:benqian,项目名称:repobuild,代码行数:25,代码来源:index.c
示例3: test_index_filemodes__explicit
void test_index_filemodes__explicit(void)
{
git_index *index;
/* These tests should run and work everywhere, as the filemode is
* given explicitly to git_index_add or git_index_add_frombuffer
*/
cl_repo_set_bool(g_repo, "core.filemode", false);
cl_git_pass(git_repository_index(&index, g_repo));
/* Each of these tests keeps overwriting the same file in the index. */
/* 1 - add new 0644 entry */
add_entry_and_check_mode(index, true, GIT_FILEMODE_BLOB);
/* 2 - add 0755 entry over existing 0644 */
add_entry_and_check_mode(index, true, GIT_FILEMODE_BLOB_EXECUTABLE);
/* 3 - add 0644 entry over existing 0755 */
add_entry_and_check_mode(index, true, GIT_FILEMODE_BLOB);
/* 4 - add 0755 buffer entry over existing 0644 */
add_entry_and_check_mode(index, false, GIT_FILEMODE_BLOB_EXECUTABLE);
/* 5 - add 0644 buffer entry over existing 0755 */
add_entry_and_check_mode(index, false, GIT_FILEMODE_BLOB);
git_index_free(index);
}
开发者ID:1336,项目名称:libgit2,代码行数:29,代码来源:filemodes.c
示例4: test_checkout_index__conflicts_honor_coreautocrlf
void test_checkout_index__conflicts_honor_coreautocrlf(void)
{
#ifdef GIT_WIN32
git_index *index;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
git_buf conflicting_buf = GIT_BUF_INIT;
cl_git_pass(p_unlink("./testrepo/.gitattributes"));
cl_repo_set_bool(g_repo, "core.autocrlf", true);
cl_git_pass(git_repository_index(&index, g_repo));
add_conflict(index, "conflicting.txt");
cl_git_pass(git_index_write(index));
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
cl_git_pass(git_futils_readbuffer(&conflicting_buf, "testrepo/conflicting.txt"));
cl_assert(strcmp(conflicting_buf.ptr,
"<<<<<<< ours\r\n"
"this file is changed in master and branch\r\n"
"=======\r\n"
"this file is changed in branch and master\r\n"
">>>>>>> theirs\r\n") == 0);
git_buf_free(&conflicting_buf);
git_index_free(index);
#endif
}
开发者ID:DeokjuJung,项目名称:libgit2,代码行数:29,代码来源:index.c
示例5: test_index_tests__add_issue_1397
void test_index_tests__add_issue_1397(void)
{
git_index *index;
git_repository *repo;
const git_index_entry *entry;
git_oid id1;
cl_set_cleanup(&cleanup_1397, NULL);
repo = cl_git_sandbox_init("issue_1397");
cl_repo_set_bool(repo, "core.autocrlf", true);
/* Ensure we're the only guy in the room */
cl_git_pass(git_repository_index(&index, repo));
/* Store the expected hash of the file/blob
* This has been generated by executing the following
* $ git hash-object crlf_file.txt
*/
cl_git_pass(git_oid_fromstr(&id1, "8312e0889a9cbab77c732b6bc39b51a683e3a318"));
/* Make sure the initial SHA-1 is correct */
cl_assert((entry = git_index_get_bypath(index, "crlf_file.txt", 0)) != NULL);
cl_assert_equal_oid(&id1, &entry->id);
/* Update the index */
cl_git_pass(git_index_add_bypath(index, "crlf_file.txt"));
/* Check the new SHA-1 */
cl_assert((entry = git_index_get_bypath(index, "crlf_file.txt", 0)) != NULL);
cl_assert_equal_oid(&id1, &entry->id);
git_index_free(index);
}
开发者ID:1336,项目名称:libgit2,代码行数:35,代码来源:tests.c
示例6: test_checkout_crlf__autocrlf_true_index_size_is_filtered_size
void test_checkout_crlf__autocrlf_true_index_size_is_filtered_size(void)
{
git_index *index;
const git_index_entry *entry;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_repo_set_bool(g_repo, "core.autocrlf", true);
git_checkout_head(g_repo, &opts);
git_repository_index(&index, g_repo);
cl_assert((entry = git_index_get_bypath(index, "all-lf", 0)) != NULL);
if (GIT_EOL_NATIVE == GIT_EOL_LF)
cl_assert_equal_sz(strlen(ALL_LF_TEXT_RAW), entry->file_size);
else
cl_assert_equal_sz(strlen(ALL_LF_TEXT_AS_CRLF), entry->file_size);
cl_assert((entry = git_index_get_bypath(index, "all-crlf", 0)) != NULL);
cl_assert_equal_sz(strlen(ALL_CRLF_TEXT_RAW), entry->file_size);
git_index_free(index);
}
开发者ID:1336,项目名称:libgit2,代码行数:25,代码来源:crlf.c
示例7: test_index_crlf__safecrlf_true_no_attrs
void test_index_crlf__safecrlf_true_no_attrs(void)
{
cl_repo_set_bool(g_repo, "core.autocrlf", true);
cl_repo_set_bool(g_repo, "core.safecrlf", true);
cl_git_mkfile("crlf/newfile.txt", ALL_LF_TEXT_RAW);
cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));
cl_git_mkfile("crlf/newfile.txt", ALL_CRLF_TEXT_RAW);
cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));
cl_git_mkfile("crlf/newfile.txt", MORE_CRLF_TEXT_RAW);
cl_git_fail(git_index_add_bypath(g_index, "newfile.txt"));
cl_git_mkfile("crlf/newfile.txt", MORE_LF_TEXT_RAW);
cl_git_fail(git_index_add_bypath(g_index, "newfile.txt"));
}
开发者ID:DonkeyWs,项目名称:libgit2,代码行数:17,代码来源:crlf.c
示例8: test_checkout_nasty__honors_core_protectntfs
void test_checkout_nasty__honors_core_protectntfs(void)
{
cl_repo_set_bool(repo, "core.protectNTFS", true);
test_checkout_fails("refs/heads/dotgit_backslash_path", ".git/foobar");
test_checkout_fails("refs/heads/dotcapitalgit_backslash_path", ".GIT/foobar");
test_checkout_fails("refs/heads/dot_git_dot", ".git/foobar");
test_checkout_fails("refs/heads/git_tilde1", ".git/foobar");
}
开发者ID:1336,项目名称:libgit2,代码行数:9,代码来源:nasty.c
示例9: test_filter_crlf__initialize
void test_filter_crlf__initialize(void)
{
g_repo = cl_git_sandbox_init("crlf");
cl_git_mkfile("crlf/.gitattributes",
"*.txt text\n*.bin binary\n*.crlf text eol=crlf\n*.lf text eol=lf\n");
cl_repo_set_bool(g_repo, "core.autocrlf", true);
}
开发者ID:1336,项目名称:libgit2,代码行数:9,代码来源:crlf.c
示例10: test_status_worktree__line_endings_dont_count_as_changes_with_autocrlf_issue_1397
void test_status_worktree__line_endings_dont_count_as_changes_with_autocrlf_issue_1397(void)
{
git_repository *repo = cl_git_sandbox_init("issue_1397");
unsigned int status;
cl_repo_set_bool(repo, "core.autocrlf", true);
cl_git_pass(git_status_file(&status, repo, "crlf_file.txt"));
cl_assert_equal_i(GIT_STATUS_CURRENT, status);
}
开发者ID:benqian,项目名称:repobuild,代码行数:11,代码来源:worktree.c
示例11: test_index_tests__honors_protect_filesystems
void test_index_tests__honors_protect_filesystems(void)
{
git_repository *repo;
p_mkdir("invalid", 0700);
cl_git_pass(git_repository_init(&repo, "./invalid", 0));
cl_repo_set_bool(repo, "core.protectHFS", true);
cl_repo_set_bool(repo, "core.protectNTFS", true);
write_invalid_filename(repo, ".git./hello");
write_invalid_filename(repo, ".git\xe2\x80\xad/hello");
write_invalid_filename(repo, "git~1/hello");
write_invalid_filename(repo, ".git\xe2\x81\xaf/hello");
git_repository_free(repo);
cl_fixture_cleanup("invalid");
}
开发者ID:1336,项目名称:libgit2,代码行数:20,代码来源:tests.c
示例12: test_checkout_crlf__all_crlf_autocrlf_true
void test_checkout_crlf__all_crlf_autocrlf_true(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
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);
}
开发者ID:1336,项目名称:libgit2,代码行数:11,代码来源:crlf.c
示例13: test_refs_create__fsyncs_when_repo_config_set
void test_refs_create__fsyncs_when_repo_config_set(void)
{
size_t create_count, compress_count;
cl_repo_set_bool(g_repo, "core.fsyncObjectFiles", true);
count_fsyncs(&create_count, &compress_count);
cl_assert_equal_i(expected_fsyncs_create, create_count);
cl_assert_equal_i(expected_fsyncs_compress, compress_count);
}
开发者ID:YueLinHo,项目名称:libgit2,代码行数:11,代码来源:create.c
示例14: test_object_tree_write__protect_filesystems
void test_object_tree_write__protect_filesystems(void)
{
git_treebuilder *builder;
git_oid bid;
cl_git_pass(git_oid_fromstr(&bid, "fa49b077972391ad58037050f2a75f74e3671e92"));
/* Ensure that (by default) we can write objects with funny names on
* platforms that are not affected.
*/
cl_git_pass(git_treebuilder_new(&builder, g_repo, NULL));
#ifndef GIT_WIN32
cl_git_pass(git_treebuilder_insert(NULL, builder, ".git.", &bid, GIT_FILEMODE_BLOB));
cl_git_pass(git_treebuilder_insert(NULL, builder, "git~1", &bid, GIT_FILEMODE_BLOB));
#endif
#ifndef __APPLE__
cl_git_pass(git_treebuilder_insert(NULL, builder, ".git\xef\xbb\xbf", &bid, GIT_FILEMODE_BLOB));
cl_git_pass(git_treebuilder_insert(NULL, builder, ".git\xe2\x80\xad", &bid, GIT_FILEMODE_BLOB));
#endif
git_treebuilder_free(builder);
/* Now turn on core.protectHFS and core.protectNTFS and validate that these
* paths are rejected.
*/
cl_repo_set_bool(g_repo, "core.protectHFS", true);
cl_repo_set_bool(g_repo, "core.protectNTFS", true);
cl_git_pass(git_treebuilder_new(&builder, g_repo, NULL));
cl_git_fail(git_treebuilder_insert(NULL, builder, ".git.", &bid, GIT_FILEMODE_BLOB));
cl_git_fail(git_treebuilder_insert(NULL, builder, "git~1", &bid, GIT_FILEMODE_BLOB));
cl_git_fail(git_treebuilder_insert(NULL, builder, ".git\xef\xbb\xbf", &bid, GIT_FILEMODE_BLOB));
cl_git_fail(git_treebuilder_insert(NULL, builder, ".git\xe2\x80\xad", &bid, GIT_FILEMODE_BLOB));
git_treebuilder_free(builder);
}
开发者ID:RsrchBoy,项目名称:p5-Git-Raw,代码行数:41,代码来源:write.c
示例15: test_checkout_index__honor_coresymlinks_setting_set_to_false
void test_checkout_index__honor_coresymlinks_setting_set_to_false(void)
{
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
cl_repo_set_bool(g_repo, "core.symlinks", false);
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
check_file_contents("./testrepo/link_to_new.txt", "new.txt");
}
开发者ID:benqian,项目名称:repobuild,代码行数:12,代码来源:index.c
示例16: test_checkout_crlf__detect_crlf_autocrlf_false
void test_checkout_crlf__detect_crlf_autocrlf_false(void)
{
git_checkout_opts opts = GIT_CHECKOUT_OPTS_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);
}
开发者ID:ANNAVARAMVENKATESH,项目名称:libgit2,代码行数:12,代码来源:crlf.c
示例17: test_status_worktree__line_endings_dont_count_as_changes_with_autocrlf
void test_status_worktree__line_endings_dont_count_as_changes_with_autocrlf(void)
{
git_repository *repo = cl_git_sandbox_init("status");
unsigned int status;
cl_repo_set_bool(repo, "core.autocrlf", true);
cl_git_rewritefile("status/current_file", "current_file\r\n");
cl_git_pass(git_status_file(&status, repo, "current_file"));
cl_assert_equal_i(GIT_STATUS_CURRENT, status);
}
开发者ID:benqian,项目名称:repobuild,代码行数:13,代码来源:worktree.c
示例18: test_checkout_crlf__more_crlf_autocrlf_true
void test_checkout_crlf__more_crlf_autocrlf_true(void)
{
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
cl_repo_set_bool(g_repo, "core.autocrlf", true);
git_checkout_head(g_repo, &opts);
if (GIT_EOL_NATIVE == GIT_EOL_LF)
check_file_contents("./crlf/more-crlf", MORE_CRLF_TEXT_RAW);
else
check_file_contents("./crlf/more-crlf", MORE_CRLF_TEXT_AS_CRLF);
}
开发者ID:ANNAVARAMVENKATESH,项目名称:libgit2,代码行数:14,代码来源:crlf.c
示例19: test_status_worktree__filemode_changes
void test_status_worktree__filemode_changes(void)
{
git_repository *repo = cl_git_sandbox_init("filemodes");
status_entry_counts counts;
git_status_options opts = GIT_STATUS_OPTIONS_INIT;
/* overwrite stored filemode with platform appropriate value */
if (cl_is_chmod_supported())
cl_repo_set_bool(repo, "core.filemode", true);
else {
int i;
cl_repo_set_bool(repo, "core.filemode", false);
/* won't trust filesystem mode diffs, so these will appear unchanged */
for (i = 0; i < filemode_count; ++i)
if (filemode_statuses[i] == GIT_STATUS_WT_MODIFIED)
filemode_statuses[i] = GIT_STATUS_CURRENT;
}
opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
GIT_STATUS_OPT_INCLUDE_IGNORED |
GIT_STATUS_OPT_INCLUDE_UNMODIFIED;
memset(&counts, 0, sizeof(counts));
counts.expected_entry_count = filemode_count;
counts.expected_paths = filemode_paths;
counts.expected_statuses = filemode_statuses;
cl_git_pass(
git_status_foreach_ext(repo, &opts, cb_status__normal, &counts)
);
cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
cl_assert_equal_i(0, counts.wrong_status_flags_count);
cl_assert_equal_i(0, counts.wrong_sorted_path);
}
开发者ID:benqian,项目名称:repobuild,代码行数:37,代码来源:worktree.c
示例20: test_index_crlf__autocrlf_true_no_attrs
void test_index_crlf__autocrlf_true_no_attrs(void)
{
const git_index_entry *entry;
git_oid oid;
cl_repo_set_bool(g_repo, "core.autocrlf", true);
cl_git_mkfile("./crlf/newfile.txt",
(GIT_EOL_NATIVE == GIT_EOL_CRLF) ? FILE_CONTENTS_CRLF : FILE_CONTENTS_LF);
cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
cl_assert(git_oid_cmp(&oid, &entry->id) == 0);
}
开发者ID:DonkeyWs,项目名称:libgit2,代码行数:16,代码来源:crlf.c
注:本文中的cl_repo_set_bool函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论