python_code
stringlengths
0
1.8M
repo_name
stringclasses
7 values
file_path
stringlengths
5
99
#include "clar.h" #include "clar_libgit2.h" #include "futils.h" #include "git2/cherrypick.h" #include "../merge/merge_helpers.h" #define TEST_REPO_PATH "cherrypick" static git_repository *repo; static git_index *repo_index; /* Fixture setup and teardown */ void test_cherrypick_workdir__initialize(void) { repo = c...
libgit2-main
tests/libgit2/cherrypick/workdir.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "merge_helpers.h" #include "conflict_data.h" #include "refs.h" #include "futils.h" #include "diff_xdiff.h" #define TEST_REPO_PATH "merge-resolve" #define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index" static git_r...
libgit2-main
tests/libgit2/merge/files.c
/* NOTE: this is the implementation for both merge/trees/analysis.c and merge/workdir/analysis.c You probably want to make changes to both files. */ #include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "git2/annotated_commit.h" #include "git2/sys/index.h" #include "merge.h" #include ...
libgit2-main
tests/libgit2/merge/analysis.c
#include "clar_libgit2.h" static git_repository *g_repo; void test_merge_annotated_commit__initialize(void) { g_repo = cl_git_sandbox_init("testrepo"); } void test_merge_annotated_commit__cleanup(void) { cl_git_sandbox_cleanup(); } void test_merge_annotated_commit__lookup_annotated_tag(void) { git_annotated_com...
libgit2-main
tests/libgit2/merge/annotated_commit.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #define TEST_REPO_PATH "merge-resolve" #define BRANCH_ID "7cb63eed597130ba4abb87b3e544b85021905520" #define AUTOMERGEABLE_IDSTR "f2e1550a0c9e53d5811175864a29536642ae3821" static git_repository *repo; static git_index *r...
libgit2-main
tests/libgit2/merge/driver.c
#include "clar_libgit2.h" #include "futils.h" #include "refs.h" #include "tree.h" #include "merge_helpers.h" #include "merge.h" #include "index.h" #include "git2/merge.h" #include "git2/sys/index.h" #include "git2/annotated_commit.h" int merge_trees_from_branches( git_index **index, git_repository *repo, const char ...
libgit2-main
tests/libgit2/merge/merge_helpers.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "../merge_helpers.h" #include "refs.h" #include "futils.h" #include "git2/sys/index.h" static git_repository *repo; #define TEST_REPO_PATH "merge-resolve" #define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index" /...
libgit2-main
tests/libgit2/merge/trees/trivial.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "../merge_helpers.h" #include "futils.h" static git_repository *repo; #define TEST_REPO_PATH "merge-resolve" #define DF_SIDE1_BRANCH "df_side1" #define DF_SIDE2_BRANCH "df_side2" /* Fixture setup and teardow...
libgit2-main
tests/libgit2/merge/trees/modeconflict.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "../merge_helpers.h" static git_repository *repo; #define TEST_REPO_PATH "merge-recursive" void test_merge_trees_recursive__initialize(void) { repo = cl_git_sandbox_init(TEST_REPO_PATH); } void test_merge_tre...
libgit2-main
tests/libgit2/merge/trees/recursive.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "../merge_helpers.h" #include "../conflict_data.h" static git_repository *repo; #define TEST_REPO_PATH "merge-resolve" void test_merge_trees_commits__initialize(void) { repo = cl_git_sandbox_init(TEST_REPO_PAT...
libgit2-main
tests/libgit2/merge/trees/commits.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "futils.h" #include "../merge_helpers.h" #include "../conflict_data.h" static git_repository *repo; #define TEST_REPO_PATH "merge-resolve" #define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index" #define THEIRS_AUT...
libgit2-main
tests/libgit2/merge/trees/automerge.c
#include "clar_libgit2.h" #include "git2/tree.h" #include "merge.h" #include "../merge_helpers.h" #include "diff.h" #include "diff_tform.h" #include "git2/sys/hashsig.h" static git_repository *repo; #define TEST_REPO_PATH "merge-resolve" #define TREE_OID_ANCESTOR "0d52e3a556e189ba0948ae56780918011c1b167d" #define T...
libgit2-main
tests/libgit2/merge/trees/treediff.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "../merge_helpers.h" #include "futils.h" static git_repository *repo; #define TEST_REPO_PATH "merge-whitespace" #define BRANCH_A_EOL "branch_a_eol" #define BRANCH_B_EOL "branch_b_eol" #define BRANCH_A_CHANGE...
libgit2-main
tests/libgit2/merge/trees/whitespace.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "../merge_helpers.h" #include "futils.h" static git_repository *repo; #define TEST_REPO_PATH "merge-resolve" #define BRANCH_RENAME_OURS "rename_conflict_ours" #define BRANCH_RENAME_THEIRS "rename_conflic...
libgit2-main
tests/libgit2/merge/trees/renames.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "git2/sys/index.h" #include "merge.h" #include "../merge_helpers.h" #include "refs.h" #include "futils.h" static git_repository *repo; static git_index *repo_index; #define TEST_REPO_PATH "merge-resolve" #define TEST_INDEX_PATH TE...
libgit2-main
tests/libgit2/merge/workdir/trivial.c
#include "clar_libgit2.h" #include "git2/merge.h" #include "merge.h" #include "index.h" #include "../merge_helpers.h" #include "posix.h" #define TEST_REPO_PATH "merge-resolve" #define MERGE_BRANCH_OID "7cb63eed597130ba4abb87b3e544b85021905520" #define AUTOMERGEABLE_MERGED_FILE \ "this file is changed in master\n" \ ...
libgit2-main
tests/libgit2/merge/workdir/dirty.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "../merge_helpers.h" static git_repository *repo; #define TEST_REPO_PATH "merge-resolve" #define SUBMODULE_MAIN_BRANCH "submodules" #define SUBMODULE_OTHER_BRANCH "submodules-branch" #define SUBMODULE_OTHER2_...
libgit2-main
tests/libgit2/merge/workdir/submodules.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "refs.h" #include "futils.h" static git_repository *repo; static git_index *repo_index; #define TEST_REPO_PATH "merge-resolve" #define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index" #define ORIG_HEAD "bd593285...
libgit2-main
tests/libgit2/merge/workdir/setup.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "../merge_helpers.h" #include "../conflict_data.h" static git_repository *repo; #define TEST_REPO_PATH "merge-recursive" void test_merge_workdir_recursive__initialize(void) { repo = cl_git_sandbox_init(TEST_RE...
libgit2-main
tests/libgit2/merge/workdir/recursive.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "../merge_helpers.h" #include "../conflict_data.h" #include "refs.h" #include "futils.h" static git_repository *repo; static git_index *repo_index; #define TEST_REPO_PATH "merge-resolve" #define TEST_INDEX_PATH ...
libgit2-main
tests/libgit2/merge/workdir/simple.c
#include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" #include "merge.h" #include "../merge_helpers.h" #include "futils.h" #include "refs.h" static git_repository *repo; #define TEST_REPO_PATH "merge-resolve" #define BRANCH_RENAME_OURS "rename_conflict_ours" #define BRANCH_RENAME_THEIRS ...
libgit2-main
tests/libgit2/merge/workdir/renames.c
#include "clar_libgit2.h" #include "filebuf.h" #include "futils.h" #include "posix.h" #define TEST_CONFIG "git-test-config" static git_buf buf = GIT_BUF_INIT; void test_config_stress__initialize(void) { git_filebuf file = GIT_FILEBUF_INIT; cl_git_pass(git_filebuf_open(&file, TEST_CONFIG, 0, 0666)); git_filebuf...
libgit2-main
tests/libgit2/config/stress.c
#include "clar_libgit2.h" #include "futils.h" #include "repository.h" #ifdef GIT_WIN32 # define ROOT_PREFIX "C:" #else # define ROOT_PREFIX #endif static git_repository *_repo; void test_config_conditionals__initialize(void) { _repo = cl_git_sandbox_init("empty_standard_repo"); } void test_config_conditionals__cle...
libgit2-main
tests/libgit2/config/conditionals.c
#include "clar_libgit2.h" #include "config_backend.h" static git_config_backend *backend; void test_config_memory__initialize(void) { backend = NULL; } void test_config_memory__cleanup(void) { git_config_backend_free(backend); } static void assert_config_contains(git_config_backend *backend, const char *name, c...
libgit2-main
tests/libgit2/config/memory.c
#include "clar_libgit2.h" #include "config.h" static git_repository *g_repo = NULL; static git_config *g_config = NULL; void test_config_rename__initialize(void) { g_repo = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_repository_config(&g_config, g_repo)); } void test_config_rename__cleanup(void) { git...
libgit2-main
tests/libgit2/config/rename.c
#include "clar_libgit2.h" #include "config.h" static git_config *cfg; void test_config_validkeyname__initialize(void) { cl_fixture_sandbox("config/config10"); cl_git_pass(git_config_open_ondisk(&cfg, "config10")); } void test_config_validkeyname__cleanup(void) { git_config_free(cfg); cfg = NULL; cl_fixture_c...
libgit2-main
tests/libgit2/config/validkeyname.c
#include "clar_libgit2.h" #include "fs_path.h" static git_buf buf = GIT_BUF_INIT; void test_config_read__cleanup(void) { git_buf_dispose(&buf); } void test_config_read__simple_read(void) { git_config *cfg; int32_t i; cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config0"))); cl_git_pass(git_conf...
libgit2-main
tests/libgit2/config/read.c
#include "clar_libgit2.h" #include "config_backend.h" static git_config *cfg; static git_config *snapshot; void test_config_snapshot__cleanup(void) { git_config_free(cfg); cfg = NULL; git_config_free(snapshot); snapshot = NULL; } void test_config_snapshot__create_snapshot(void) { int32_t i; cl_git_mkfile("co...
libgit2-main
tests/libgit2/config/snapshot.c
#include "clar_libgit2.h" static const char *_name = "remote.ab.url"; void test_config_multivar__initialize(void) { cl_fixture_sandbox("config"); } void test_config_multivar__cleanup(void) { cl_fixture_cleanup("config"); } static int mv_read_cb(const git_config_entry *entry, void *data) { int *n = (int *) data; ...
libgit2-main
tests/libgit2/config/multivar.c
#include "clar_libgit2.h" #include "config_backend.h" #include "config.h" #include "path.h" static git_config *cfg; void test_config_readonly__initialize(void) { cl_git_pass(git_config_new(&cfg)); } void test_config_readonly__cleanup(void) { git_config_free(cfg); cfg = NULL; } void test_config_readonly__writing_...
libgit2-main
tests/libgit2/config/readonly.c
#include "clar_libgit2.h" void test_config_add__initialize(void) { cl_fixture_sandbox("config/config10"); } void test_config_add__cleanup(void) { cl_fixture_cleanup("config10"); } void test_config_add__to_existing_section(void) { git_config *cfg; int32_t i; cl_git_pass(git_config_open_ondisk(&cfg, "config10"))...
libgit2-main
tests/libgit2/config/add.c
#include "clar_libgit2.h" void test_config_configlevel__adding_the_same_level_twice_returns_EEXISTS(void) { int error; git_config *cfg; cl_git_pass(git_config_new(&cfg)); cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"), GIT_CONFIG_LEVEL_LOCAL, NULL, 0)); cl_git_pass(git_config_add_file...
libgit2-main
tests/libgit2/config/configlevel.c
#include "clar_libgit2.h" #include "futils.h" static git_config *cfg; static git_buf buf; void test_config_include__initialize(void) { cfg = NULL; memset(&buf, 0, sizeof(git_buf)); } void test_config_include__cleanup(void) { git_config_free(cfg); git_buf_dispose(&buf); } void test_config_include__relative(void)...
libgit2-main
tests/libgit2/config/include.c
#include "clar_libgit2.h" #include "config_helpers.h" #include "repository.h" void assert_config_entry_existence( git_repository *repo, const char *name, bool is_supposed_to_exist) { git_config *config; git_config_entry *entry = NULL; int result; cl_git_pass(git_repository_config__weakptr(&config, repo)); re...
libgit2-main
tests/libgit2/config/config_helpers.c
#include "clar_libgit2.h" #include "futils.h" void test_config_global__initialize(void) { git_str path = GIT_STR_INIT; cl_git_pass(git_futils_mkdir_r("home", 0777)); cl_git_pass(git_fs_path_prettify(&path, "home", NULL)); cl_git_pass(git_libgit2_opts( GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr))...
libgit2-main
tests/libgit2/config/global.c
#include "clar_libgit2.h" #include "git2/sys/config.h" void test_config_backend__checks_version(void) { git_config *cfg; git_config_backend backend = GIT_CONFIG_BACKEND_INIT; const git_error *err; backend.version = 1024; cl_git_pass(git_config_new(&cfg)); cl_git_fail(git_config_add_backend(cfg, &backend, 0, NU...
libgit2-main
tests/libgit2/config/backend.c
#include "clar_libgit2.h" #include "futils.h" #include "git2/sys/config.h" #include "config.h" void test_config_write__initialize(void) { cl_fixture_sandbox("config/config9"); cl_fixture_sandbox("config/config15"); cl_fixture_sandbox("config/config17"); cl_fixture_sandbox("config/config22"); } void test_config_wr...
libgit2-main
tests/libgit2/config/write.c
#include "clar_libgit2.h" #include "filebuf.h" #include "futils.h" #include "posix.h" #define TEST_CONFIG "git-new-config" void test_config_new__write_new_config(void) { git_config *config; git_buf buf = GIT_BUF_INIT; cl_git_mkfile(TEST_CONFIG, ""); cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG)); c...
libgit2-main
tests/libgit2/config/new.c
#include "clar_libgit2.h" #include "posix.h" #include "path.h" #include "futils.h" static git_repository *g_repo = NULL; void test_ignore_path__initialize(void) { g_repo = cl_git_sandbox_init("attr"); } void test_ignore_path__cleanup(void) { cl_git_sandbox_cleanup(); g_repo = NULL; } static void assert_is_ignore...
libgit2-main
tests/libgit2/ignore/path.c
#include "clar_libgit2.h" #include "futils.h" #include "git2/attr.h" #include "ignore.h" #include "attr.h" #include "status/status_helpers.h" static git_repository *g_repo = NULL; void test_ignore_status__initialize(void) { } void test_ignore_status__cleanup(void) { cl_git_sandbox_cleanup(); } static void assert_i...
libgit2-main
tests/libgit2/ignore/status.c
#include "clar_libgit2.h" #include "path.h" void test_path_validate__cleanup(void) { cl_git_sandbox_cleanup(); } void test_path_validate__length(void) { cl_must_pass(git_path_validate_length(NULL, "/foo/bar")); cl_must_pass(git_path_validate_length(NULL, "C:\\Foo\\Bar")); cl_must_pass(git_path_validate_length(NUL...
libgit2-main
tests/libgit2/path/validate.c
#include "clar_libgit2.h" #include "transports/smart.h" enum expected_status { PARSE_SUCCESS, PARSE_FAILURE }; static void assert_flush_parses(const char *line) { size_t linelen = strlen(line) + 1; const char *endptr; git_pkt *pkt; cl_git_pass(git_pkt_parse_line((git_pkt **) &pkt, &endptr, line, linelen)); cl...
libgit2-main
tests/libgit2/transports/smart/packet.c
#include "clar_libgit2.h" #include "git2/sys/stream.h" #include "streams/tls.h" #include "streams/socket.h" #include "stream.h" void test_stream_deprecated__cleanup(void) { cl_git_pass(git_stream_register(GIT_STREAM_TLS | GIT_STREAM_STANDARD, NULL)); } #ifndef GIT_DEPRECATE_HARD static git_stream test_stream; static...
libgit2-main
tests/libgit2/stream/deprecated.c
#include "clar_libgit2.h" #include "git2/sys/stream.h" #include "streams/tls.h" #include "streams/socket.h" #include "stream.h" static git_stream test_stream; static int ctor_called; void test_stream_registration__cleanup(void) { cl_git_pass(git_stream_register(GIT_STREAM_TLS | GIT_STREAM_STANDARD, NULL)); } static...
libgit2-main
tests/libgit2/stream/registration.c
#include "clar_libgit2.h" #include "posix.h" #include "reset_helpers.h" #include "path.h" static git_repository *repo; static git_object *target; void test_reset_mixed__initialize(void) { repo = cl_git_sandbox_init("attr"); target = NULL; } void test_reset_mixed__cleanup(void) { git_object_free(target); target =...
libgit2-main
tests/libgit2/reset/mixed.c
#include "clar_libgit2.h" #include "posix.h" #include "reset_helpers.h" #include "path.h" static git_repository *_repo; static git_object *_target; static git_strarray _pathspecs; static git_index *_index; static void initialize(const char *repo_name) { _repo = cl_git_sandbox_init(repo_name); cl_git_pass(git_reposi...
libgit2-main
tests/libgit2/reset/default.c
#include "clar_libgit2.h" #include "posix.h" #include "reset_helpers.h" #include "path.h" #include "repo/repo_helpers.h" static git_repository *repo; static git_object *target; void test_reset_soft__initialize(void) { repo = cl_git_sandbox_init("testrepo.git"); } void test_reset_soft__cleanup(void) { git_object_fr...
libgit2-main
tests/libgit2/reset/soft.c
#include "clar_libgit2.h" #include "reset_helpers.h" void reflog_check(git_repository *repo, const char *refname, size_t exp_count, const char *exp_email, const char *exp_msg) { git_reflog *log; const git_reflog_entry *entry; GIT_UNUSED(exp_email); cl_git_pass(git_reflog_read(&log, repo, refname)); cl_assert_...
libgit2-main
tests/libgit2/reset/reset_helpers.c
#include "clar_libgit2.h" #include "posix.h" #include "reset_helpers.h" #include "path.h" #include "futils.h" static git_repository *repo; static git_object *target; void test_reset_hard__initialize(void) { repo = cl_git_sandbox_init("status"); target = NULL; } void test_reset_hard__cleanup(void) { if (target != ...
libgit2-main
tests/libgit2/reset/hard.c
#include "clar_libgit2.h" #include "date.h" void test_date_rfc2822__format_rfc2822_no_offset(void) { git_time t = {1397031663, 0}; git_str buf = GIT_STR_INIT; cl_git_pass(git_date_rfc2822_fmt(&buf, t.time, t.offset)); cl_assert_equal_s("Wed, 9 Apr 2014 08:21:03 +0000", buf.ptr); git_str_dispose(&buf); } void ...
libgit2-main
tests/libgit2/date/rfc2822.c
#include "clar_libgit2.h" #include "date.h" void test_date_date__overflow(void) { #ifdef __LP64__ git_time_t d2038, d2039; /* This is expected to fail on a 32-bit machine. */ cl_git_pass(git_date_parse(&d2038, "2038-1-1")); cl_git_pass(git_date_parse(&d2039, "2039-1-1")); cl_assert(d2038 < d2039); #en...
libgit2-main
tests/libgit2/date/date.c
#include "clar_libgit2.h" #include "path.h" #include "remote.h" static const char* tagger_name = "Vicent Marti"; static const char* tagger_email = "vicent@github.com"; static const char* tagger_message = "This is my tag.\n\nThere are many tags, but this one is mine\n"; static int transfer_cb(const git_indexer_progre...
libgit2-main
tests/libgit2/network/fetchlocal.c
#include "clar_libgit2.h" #include "refspec.h" #include "remote.h" static void assert_refspec(unsigned int direction, const char *input, bool is_expected_to_be_valid) { git_refspec refspec; int error; error = git_refspec__parse(&refspec, input, direction == GIT_DIRECTION_FETCH); git_refspec__dispose(&refspec); ...
libgit2-main
tests/libgit2/network/refspecs.c
#include "clar_libgit2.h" #include "netops.h" void test_network_matchhost__match(void) { cl_git_pass(gitno__match_host("*.example.org", "www.example.org")); cl_git_pass(gitno__match_host("*.foo.example.org", "www.foo.example.org")); cl_git_fail(gitno__match_host("*.foo.example.org", "foo.example.org")); cl_git_fai...
libgit2-main
tests/libgit2/network/matchhost.c
#include "clar_libgit2.h" #include "git2/cred_helpers.h" void test_network_cred__stock_userpass_validates_args(void) { git_credential_userpass_payload payload = {0}; cl_git_fail(git_credential_userpass(NULL, NULL, NULL, 0, NULL)); payload.username = "user"; cl_git_fail(git_credential_userpass(NULL, NULL, NULL, ...
libgit2-main
tests/libgit2/network/cred.c
#include "clar_libgit2.h" #include "net.h" void test_network_url_valid__test(void) { cl_assert(git_net_str_is_url("http://example.com/")); cl_assert(git_net_str_is_url("file://localhost/tmp/foo/")); cl_assert(git_net_str_is_url("ssh://user@host:42/tmp")); cl_assert(git_net_str_is_url("git+ssh://user@host:42/tmp"))...
libgit2-main
tests/libgit2/network/url/valid.c
#include "clar_libgit2.h" #include "net.h" #include "netops.h" static git_net_url conndata; void test_network_url_redirect__initialize(void) { memset(&conndata, 0, sizeof(conndata)); } void test_network_url_redirect__cleanup(void) { git_net_url_dispose(&conndata); } void test_network_url_redirect__redirect_http(v...
libgit2-main
tests/libgit2/network/url/redirect.c
#include "clar_libgit2.h" #include "net.h" static git_net_url conndata; void test_network_url_scp__initialize(void) { memset(&conndata, 0, sizeof(conndata)); } void test_network_url_scp__cleanup(void) { git_net_url_dispose(&conndata); } /* Hostname */ void test_network_url_scp__hostname_trivial(void) { cl_git_p...
libgit2-main
tests/libgit2/network/url/scp.c
#include "clar_libgit2.h" #include "net.h" static git_net_url conndata; void test_network_url_parse__initialize(void) { memset(&conndata, 0, sizeof(conndata)); } void test_network_url_parse__cleanup(void) { git_net_url_dispose(&conndata); } /* Hostname */ void test_network_url_parse__hostname_trivial(void) { cl...
libgit2-main
tests/libgit2/network/url/parse.c
#include "clar_libgit2.h" #include "net.h" struct url_pattern { const char *url; const char *pattern; bool matches; }; void test_network_url_pattern__single(void) { git_net_url url; size_t i; struct url_pattern url_patterns[] = { /* Wildcard matches */ { "https://example.com/", "", false }, { "https://ex...
libgit2-main
tests/libgit2/network/url/pattern.c
#include "clar_libgit2.h" #include "net.h" #include "netops.h" static git_net_url source, target; void test_network_url_joinpath__initialize(void) { memset(&source, 0, sizeof(source)); memset(&target, 0, sizeof(target)); } void test_network_url_joinpath__cleanup(void) { git_net_url_dispose(&source); git_net_url_...
libgit2-main
tests/libgit2/network/url/joinpath.c
#include "clar_libgit2.h" #include "config/config_helpers.h" #include "repository.h" static git_repository *_repo; static const char *_remote_name = "test"; void test_network_remote_rename__initialize(void) { _repo = cl_git_sandbox_init("testrepo.git"); } void test_network_remote_rename__cleanup(void) { cl_git_sa...
libgit2-main
tests/libgit2/network/remote/rename.c
#include "clar_libgit2.h" static int is_valid_name(const char *name) { int valid = 0; cl_git_pass(git_remote_name_is_valid(&valid, name)); return valid; } void test_network_remote_isvalidname__can_detect_invalid_formats(void) { cl_assert_equal_i(false, is_valid_name("/")); cl_assert_equal_i(false, is_valid_name(...
libgit2-main
tests/libgit2/network/remote/isvalidname.c
#include "clar_libgit2.h" #include "git2/sys/commit.h" #include "oid.h" static git_remote *_remote; static git_repository *_repo, *_dummy; void test_network_remote_push__initialize(void) { cl_fixture_sandbox("testrepo.git"); git_repository_open(&_repo, "testrepo.git"); /* We need a repository to have a remote */ ...
libgit2-main
tests/libgit2/network/remote/push.c
#include "clar_libgit2.h" #include "path.h" #include "posix.h" #include "git2/sys/repository.h" static git_repository *repo; static git_str file_path_buf = GIT_STR_INIT; static git_remote *remote; static char *push_refspec_strings[] = { "refs/heads/master", }; static git_strarray push_array = { push_refspec_strings...
libgit2-main
tests/libgit2/network/remote/local.c
#include "clar_libgit2.h" #include "refspec.h" #include "remote.h" static git_remote *g_remote; static git_repository *g_repo_a, *g_repo_b; void test_network_remote_defaultbranch__initialize(void) { g_repo_a = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_repository_init(&g_repo_b, "repo-b.git", true)); cl_...
libgit2-main
tests/libgit2/network/remote/defaultbranch.c
#include "clar_libgit2.h" #include "config/config_helpers.h" #include "refspec.h" #include "remote.h" static git_remote *_remote; static git_repository *_repo; static const git_refspec *_refspec; void test_network_remote_remotes__initialize(void) { _repo = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_remot...
libgit2-main
tests/libgit2/network/remote/remotes.c
#include "clar_libgit2.h" #include "config/config_helpers.h" #include "repository.h" static git_repository *_repo; void test_network_remote_delete__initialize(void) { _repo = cl_git_sandbox_init("testrepo.git"); } void test_network_remote_delete__cleanup(void) { cl_git_sandbox_cleanup(); } void test_network_remo...
libgit2-main
tests/libgit2/network/remote/delete.c
#include "clar_libgit2.h" #include <git2.h> #include <git2/sys/commit_graph.h> #include "commit_graph.h" #include "futils.h" void test_graph_commitgraph__parse(void) { git_repository *repo; struct git_commit_graph_file *file; struct git_commit_graph_entry e, parent; git_oid id; git_str commit_graph_path = GIT_S...
libgit2-main
tests/libgit2/graph/commitgraph.c
#include "clar_libgit2.h" #include <git2.h> #include "commit_graph.h" #include "bitvec.h" #include "vector.h" static git_repository *repo; #define TEST_REPO_PATH "merge-recursive" void test_graph_reachable_from_any__initialize(void) { git_oid oid; git_commit *commit; repo = cl_git_sandbox_init(TEST_REPO_PATH);...
libgit2-main
tests/libgit2/graph/reachable_from_any.c
#include "clar_libgit2.h" static git_repository *_repo; static git_commit *commit; static size_t ahead; static size_t behind; void test_graph_ahead_behind__initialize(void) { git_oid oid; cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git"))); cl_git_pass(git_oid__fromstr(&oid, "be3563ae3f795b2b4353...
libgit2-main
tests/libgit2/graph/ahead_behind.c
#include "clar_libgit2.h" static git_repository *_repo; static git_commit *commit; void test_graph_descendant_of__initialize(void) { git_oid oid; cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git"))); git_oid__fromstr(&oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1); cl_git_pass(gi...
libgit2-main
tests/libgit2/graph/descendant_of.c
#include "clar_libgit2.h" #include "worktree_helpers.h" void cleanup_fixture_worktree(worktree_fixture *fixture) { if (!fixture) return; if (fixture->repo) { git_repository_free(fixture->repo); fixture->repo = NULL; } if (fixture->worktree) { git_repository_free(fixture->worktree); fixture->worktree = N...
libgit2-main
tests/libgit2/worktree/worktree_helpers.c
#include "clar_libgit2.h" #include "worktree_helpers.h" #include "reflog.h" #define COMMON_REPO "testrepo" #define WORKTREE_REPO "testrepo-worktree" #define REFLOG "refs/heads/testrepo-worktree" #define REFLOG_MESSAGE "reflog message" static worktree_fixture fixture = WORKTREE_FIXTURE_INIT(COMMON_REPO, WORKTREE_RE...
libgit2-main
tests/libgit2/worktree/reflog.c
#include "clar_libgit2.h" #include "worktree_helpers.h" #include "submodule/submodule_helpers.h" #define COMMON_REPO "testrepo.git" #define WORKTREE_REPO "worktree" static git_repository *g_repo; void test_worktree_bare__initialize(void) { g_repo = cl_git_sandbox_init(COMMON_REPO); cl_assert_equal_i(1, git_reposi...
libgit2-main
tests/libgit2/worktree/bare.c
#include "clar_libgit2.h" #include "path.h" #include "refs.h" #include "worktree.h" #include "worktree_helpers.h" #define COMMON_REPO "testrepo" #define WORKTREE_REPO "testrepo-worktree" static worktree_fixture fixture = WORKTREE_FIXTURE_INIT(COMMON_REPO, WORKTREE_REPO); void test_worktree_refs__initialize(void) { ...
libgit2-main
tests/libgit2/worktree/refs.c
#include "clar_libgit2.h" #include "worktree_helpers.h" #include "submodule/submodule_helpers.h" #include "repository.h" #define COMMON_REPO "testrepo" #define WORKTREE_REPO "testrepo-worktree" static worktree_fixture fixture = WORKTREE_FIXTURE_INIT(COMMON_REPO, WORKTREE_REPO); void test_worktree_repository__initi...
libgit2-main
tests/libgit2/worktree/repository.c
#include "clar_libgit2.h" #include "worktree_helpers.h" #define COMMON_REPO "testrepo" #define WORKTREE_REPO "testrepo-worktree" static worktree_fixture fixture = WORKTREE_FIXTURE_INIT(COMMON_REPO, WORKTREE_REPO); void test_worktree_config__initialize(void) { setup_fixture_worktree(&fixture); } void test_worktree...
libgit2-main
tests/libgit2/worktree/config.c
#include "clar_libgit2.h" #include "repository.h" #include "worktree.h" #include "worktree_helpers.h" #define WORKTREE_PARENT "submodules-worktree-parent" #define WORKTREE_CHILD "submodules-worktree-child" static worktree_fixture parent = WORKTREE_FIXTURE_INIT("submodules", WORKTREE_PARENT); static worktree_fixtu...
libgit2-main
tests/libgit2/worktree/submodule.c
#include "clar_libgit2.h" #include "worktree_helpers.h" #include "submodule/submodule_helpers.h" #include "checkout.h" #include "repository.h" #include "worktree.h" #define COMMON_REPO "testrepo" #define WORKTREE_REPO "testrepo-worktree" static worktree_fixture fixture = WORKTREE_FIXTURE_INIT(COMMON_REPO, WORKTREE_...
libgit2-main
tests/libgit2/worktree/worktree.c
#include "clar_libgit2.h" #include "repository.h" #include "worktree.h" #include "worktree_helpers.h" #define COMMON_REPO "testrepo" #define WORKTREE_REPO "testrepo-worktree" static worktree_fixture fixture = WORKTREE_FIXTURE_INIT(COMMON_REPO, WORKTREE_REPO); static void assert_worktree_valid(git_repository *wt, co...
libgit2-main
tests/libgit2/worktree/open.c
#include "clar_libgit2.h" #include "worktree_helpers.h" #include "merge/merge_helpers.h" #define COMMON_REPO "testrepo" #define WORKTREE_REPO "testrepo-worktree" #define MASTER_BRANCH "refs/heads/master" #define CONFLICT_BRANCH "refs/heads/merge-conflict" #define CONFLICT_BRANCH_FILE_TXT \ "<<<<<<< HEAD\n" \ "hi\...
libgit2-main
tests/libgit2/worktree/merge.c
#include "clar_libgit2.h" #include "futils.h" #include "pack.h" #include "hash.h" #include "iterator.h" #include "vector.h" #include "posix.h" #include "hash.h" static git_repository *_repo; static git_revwalk *_revwalker; static git_packbuilder *_packbuilder; static git_indexer *_indexer; static git_vector _commits; ...
libgit2-main
tests/libgit2/pack/packbuilder.c
#include "clar_libgit2.h" #include <git2.h> #include "futils.h" #include "hash.h" #include "iterator.h" #include "vector.h" #include "posix.h" /* * This is a packfile with three objects. The second is a delta which * depends on the third, which is also a delta. */ static const unsigned char out_of_order_pack[] = {...
libgit2-main
tests/libgit2/pack/indexer.c
#include "clar_libgit2.h" #include <git2.h> #include "strmap.h" #include "mwindow.h" #include "pack.h" extern git_strmap *git__pack_cache; void test_pack_sharing__open_two_repos(void) { git_repository *repo1, *repo2; git_object *obj1, *obj2; git_oid id; size_t pos; void *data; int error; cl_git_pass(git_repos...
libgit2-main
tests/libgit2/pack/sharing.c
#include "clar_libgit2.h" #include "pool.h" #include <git2.h> #include "git2/sys/commit.h" #include "git2/sys/mempack.h" static size_t original_mwindow_file_limit = 0; void test_pack_threadsafety__initialize(void) { size_t open_mwindow_files = 1; cl_git_pass(git_libgit2_opts(GIT_OPT_GET_MWINDOW_FILE_LIMIT, &origi...
libgit2-main
tests/libgit2/pack/threadsafety.c
#include "clar_libgit2.h" #include "mwindow.h" #include <git2.h> #include "git2/sys/commit.h" #include "git2/sys/mempack.h" static size_t expected_open_mwindow_files = 0; static size_t original_mwindow_file_limit = 0; extern git_mutex git__mwindow_mutex; extern git_mwindow_ctl git_mwindow__mem_ctl; void test_pack_f...
libgit2-main
tests/libgit2/pack/filelimit.c
#include "clar_libgit2.h" #include <git2.h> #include <git2/sys/midx.h> #include "futils.h" #include "midx.h" void test_pack_midx__parse(void) { git_repository *repo; struct git_midx_file *idx; struct git_midx_entry e; git_oid id; git_str midx_path = GIT_STR_INIT; cl_git_pass(git_repository_open(&repo, cl_fixt...
libgit2-main
tests/libgit2/pack/midx.c
#include "clar_libgit2.h" static void assert_trailers(const char *message, git_message_trailer *trailers) { git_message_trailer_array arr; size_t i; int rc = git_message_trailers(&arr, message); cl_assert_equal_i(0, rc); for(i=0; i<arr.count; i++) { cl_assert_equal_s(arr.trailers[i].key, trailers[i].key); ...
libgit2-main
tests/libgit2/message/trailer.c
#include "clar_libgit2.h" #include "userdiff.h" static git_regexp regex; void test_diff_userdiff__cleanup(void) { git_regexp_dispose(&regex); } void test_diff_userdiff__compile_userdiff_regexps(void) { size_t idx; for (idx = 0; idx < ARRAY_SIZE(builtin_defs); ++idx) { git_diff_driver_definition ddef = builtin...
libgit2-main
tests/libgit2/diff/userdiff.c
#include "clar_libgit2.h" #include "diff_helpers.h" #include "repository.h" #include "diff_driver.h" static git_repository *g_repo = NULL; void test_diff_drivers__initialize(void) { } void test_diff_drivers__cleanup(void) { cl_git_sandbox_cleanup(); g_repo = NULL; } static void overwrite_filemode(const char *expe...
libgit2-main
tests/libgit2/diff/drivers.c
#include "clar_libgit2.h" #include "git2/sys/repository.h" #include "diff_helpers.h" #include "diff.h" #include "repository.h" static git_repository *g_repo = NULL; void test_diff_patch__initialize(void) { } void test_diff_patch__cleanup(void) { cl_git_sandbox_cleanup(); } #define EXPECTED_HEADER "diff --git a/su...
libgit2-main
tests/libgit2/diff/patch.c
#include "clar_libgit2.h" #include "diff_helpers.h" static git_repository *g_repo = NULL; void test_diff_rename__initialize(void) { g_repo = cl_git_sandbox_init("renames"); cl_repo_set_bool(g_repo, "core.autocrlf", false); } void test_diff_rename__cleanup(void) { cl_git_sandbox_cleanup(); } #define INITIAL_COMM...
libgit2-main
tests/libgit2/diff/rename.c
#include "clar_libgit2.h" #include "patch/patch_common.h" static void verify_patch_id(const char *diff_content, const char *expected_id) { git_oid expected_oid, actual_oid; git_diff *diff; cl_git_pass(git_oid__fromstr(&expected_oid, expected_id, GIT_OID_SHA1)); cl_git_pass(git_diff_from_buffer(&diff, diff_content...
libgit2-main
tests/libgit2/diff/patchid.c
#include "clar_libgit2.h" #include "repository.h" #include "posix.h" #include "diff_helpers.h" #include "../submodule/submodule_helpers.h" static git_repository *g_repo = NULL; void test_diff_submodules__initialize(void) { } void test_diff_submodules__cleanup(void) { cl_git_sandbox_cleanup(); } #define get_buf_ptr...
libgit2-main
tests/libgit2/diff/submodules.c
#include "clar_libgit2.h" #include "git2/sys/diff.h" #include "delta.h" #include "filebuf.h" #include "repository.h" static git_repository *repo; void test_diff_binary__initialize(void) { } void test_diff_binary__cleanup(void) { cl_git_sandbox_cleanup(); } static void test_patch( const char *one, const char *t...
libgit2-main
tests/libgit2/diff/binary.c
#include "clar.h" #include "clar_libgit2.h" #include "commit.h" #include "diff.h" #include "diff_generate.h" static git_repository *_repo; static git_diff_stats *_stats; void test_diff_stats__initialize(void) { _repo = cl_git_sandbox_init("diff_format_email"); } void test_diff_stats__cleanup(void) { git_diff_stat...
libgit2-main
tests/libgit2/diff/stats.c
#include "clar_libgit2.h" #include "../checkout/checkout_helpers.h" #include "index.h" #include "repository.h" static git_repository *g_repo; void test_diff_externalmodifications__initialize(void) { g_repo = cl_git_sandbox_init("testrepo2"); } void test_diff_externalmodifications__cleanup(void) { cl_git_sandbox_c...
libgit2-main
tests/libgit2/diff/externalmodifications.c
/* This test exercises the problem described in ** https://github.com/libgit2/libgit2/pull/3568 ** where deleting a directory during a diff/status ** operation can cause an access violation. ** ** The "test_diff_racediffiter__basic() test confirms ** the normal operation of diff on the given repo. ** ** The "test_diff_...
libgit2-main
tests/libgit2/diff/racediffiter.c
#include "clar_libgit2.h" #include "diff_helpers.h" static git_repository *g_repo = NULL; void test_diff_index__initialize(void) { g_repo = cl_git_sandbox_init("status"); } void test_diff_index__cleanup(void) { cl_git_sandbox_cleanup(); } void test_diff_index__0(void) { /* grabbed a couple of commit oids from th...
libgit2-main
tests/libgit2/diff/index.c