void test_repo_init__symlinks_win32_enabled_by_global_config(void) { #ifndef GIT_WIN32 cl_skip(); #else git_config *config, *repo_config; int val; if (!filesystem_supports_symlinks("link")) cl_skip(); create_tmp_global_config("tmp_global_config", "core.symlinks", "true"); /* * Create a new repository (can't use `assert_config_on_init` since we * want to examine configuration levels with more granularity.) */ cl_git_pass(git_repository_init(&_repo, "config_entry/test.non.bare.git", false)); /* Ensure that core.symlinks remains set (via the global config). */ cl_git_pass(git_repository_config(&config, _repo)); cl_git_pass(git_config_get_bool(&val, config, "core.symlinks")); cl_assert_equal_i(1, val); /* * Ensure that the repository config does not set core.symlinks. * It should remain inherited. */ cl_git_pass(git_config_open_level(&repo_config, config, GIT_CONFIG_LEVEL_LOCAL)); cl_git_fail_with(GIT_ENOTFOUND, git_config_get_bool(&val, repo_config, "core.symlinks")); git_config_free(repo_config); git_config_free(config); #endif }
void test_core_filebuf__rename_error(void) { git_filebuf file = GIT_FILEBUF_INIT; char *dir = "subdir", *test = "subdir/test", *test_lock = "subdir/test.lock"; int fd; #ifndef GIT_WIN32 cl_skip(); #endif cl_git_pass(p_mkdir(dir, 0666)); cl_git_mkfile(test, "dummy content"); fd = p_open(test, O_RDONLY); cl_assert(fd > 0); cl_git_pass(git_filebuf_open(&file, test, 0, 0666)); cl_git_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks")); cl_assert_equal_i(true, git_path_exists(test_lock)); cl_git_fail(git_filebuf_commit(&file)); p_close(fd); git_filebuf_cleanup(&file); cl_assert_equal_i(false, git_path_exists(test_lock)); }
void test_status_worktree__unreadable_not_included(void) { #ifndef GIT_WIN32 const char *expected_paths[] = { "no_permission/" }; const unsigned int expected_statuses[] = {GIT_STATUS_WT_NEW}; git_repository *repo = cl_git_sandbox_init("empty_standard_repo"); git_status_options opts = GIT_STATUS_OPTIONS_INIT; status_entry_counts counts = {0}; /* Create directory with no read permission */ cl_git_pass(git_futils_mkdir_r("empty_standard_repo/no_permission", 0777)); cl_git_mkfile("empty_standard_repo/no_permission/foo", "dummy"); p_chmod("empty_standard_repo/no_permission", 0644); counts.expected_entry_count = 1; counts.expected_paths = expected_paths; counts.expected_statuses = expected_statuses; opts.show = GIT_STATUS_SHOW_WORKDIR_ONLY; opts.flags = (GIT_STATUS_OPT_INCLUDE_IGNORED | GIT_STATUS_OPT_INCLUDE_UNTRACKED); cl_git_pass( git_status_foreach_ext(repo, &opts, cb_status__normal, &counts) ); /* Restore permissions so we can cleanup :) */ p_chmod("empty_standard_repo/no_permission", 0777); 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); #else cl_skip(); #endif }
void test_repo_init__at_filesystem_root(void) { git_repository *repo; const char *sandbox = clar_sandbox_path(); git_buf root = GIT_BUF_INIT; int root_len; if (!cl_is_env_set("GITTEST_INVASIVE_FS_STRUCTURE")) cl_skip(); root_len = git_path_root(sandbox); cl_assert(root_len >= 0); git_buf_put(&root, sandbox, root_len+1); git_buf_joinpath(&root, root.ptr, "libgit2_test_dir"); cl_assert(!git_path_exists(root.ptr)); cl_git_pass(git_repository_init(&repo, root.ptr, 0)); cl_assert(git_path_isdir(root.ptr)); cl_git_pass(git_futils_rmdir_r(root.ptr, NULL, GIT_RMDIR_REMOVE_FILES)); git_buf_free(&root); git_repository_free(repo); }
/* Lots of empty dirs, or nearly empty ones, make the old workdir * iterator cry. Also, segfault. */ void test_iterator_workdir__filesystem_gunk(void) { git_iterator *i; git_buf parent = GIT_BUF_INIT; int n; if (!cl_is_env_set("GITTEST_INVASIVE_SPEED")) cl_skip(); g_repo = cl_git_sandbox_init("testrepo"); for (n = 0; n < 100000; n++) { git_buf_clear(&parent); git_buf_printf(&parent, "%s/refs/heads/foo/%d/subdir", git_repository_path(g_repo), n); cl_assert(!git_buf_oom(&parent)); cl_git_pass(git_futils_mkdir(parent.ptr, 0775, GIT_MKDIR_PATH)); } cl_git_pass(git_iterator_for_filesystem(&i, "testrepo/.git/refs", NULL)); /* should only have 13 items, since we're not asking for trees to be * returned. the goal of this test is simply to not crash. */ expect_iterator_items(i, 15, NULL, 15, NULL); git_iterator_free(i); git_buf_dispose(&parent); }
void test_core_filebuf__symlink_follow(void) { git_filebuf file = GIT_FILEBUF_INIT; const char *dir = "linkdir", *source = "linkdir/link"; #ifdef GIT_WIN32 cl_skip(); #endif cl_git_pass(p_mkdir(dir, 0777)); cl_git_pass(p_symlink("target", source)); cl_git_pass(git_filebuf_open(&file, source, 0, 0666)); cl_git_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks")); cl_assert_equal_i(true, git_path_exists("linkdir/target.lock")); cl_git_pass(git_filebuf_commit(&file)); cl_assert_equal_i(true, git_path_exists("linkdir/target")); git_filebuf_cleanup(&file); /* The second time around, the target file does exist */ cl_git_pass(git_filebuf_open(&file, source, 0, 0666)); cl_git_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks")); cl_assert_equal_i(true, git_path_exists("linkdir/target.lock")); cl_git_pass(git_filebuf_commit(&file)); cl_assert_equal_i(true, git_path_exists("linkdir/target")); git_filebuf_cleanup(&file); cl_git_pass(git_futils_rmdir_r(dir, NULL, GIT_RMDIR_REMOVE_FILES)); }
void test_core_filebuf__hidden_file(void) { #ifndef GIT_WIN32 cl_skip(); #else git_filebuf file = GIT_FILEBUF_INIT; char *dir = "hidden", *test = "hidden/test"; bool hidden; cl_git_pass(p_mkdir(dir, 0666)); cl_git_mkfile(test, "dummy content"); cl_git_pass(git_win32__set_hidden(test, true)); cl_git_pass(git_win32__hidden(&hidden, test)); cl_assert(hidden); cl_git_pass(git_filebuf_open(&file, test, 0, 0666)); cl_git_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks")); cl_git_pass(git_filebuf_commit(&file)); git_filebuf_cleanup(&file); #endif }
void test_repo_init__symlinks_win32_off_by_default(void) { #ifndef GIT_WIN32 cl_skip(); #else assert_config_entry_on_init("core.symlinks", false); #endif }
void test_odb_largefiles__streamwrite(void) { git_oid expected, oid; #ifndef GIT_ARCH_64 cl_skip(); #endif if (!cl_is_env_set("GITTEST_INVASIVE_FS_SIZE") || !cl_is_env_set("GITTEST_SLOW")) cl_skip(); git_oid_fromstr(&expected, "3fb56989cca483b21ba7cb0a6edb229d10e1c26c"); writefile(&oid); cl_assert_equal_oid(&expected, &oid); }
void test_odb_largefiles__streamread(void) { git_oid oid, read_oid; git_odb_stream *stream; char buf[10240]; char hdr[64]; size_t len, hdr_len, total = 0; git_hash_ctx hash; git_otype type; int ret; #ifndef GIT_ARCH_64 cl_skip(); #endif if (!cl_is_env_set("GITTEST_INVASIVE_FS_SIZE") || !cl_is_env_set("GITTEST_SLOW")) cl_skip(); writefile(&oid); cl_git_pass(git_odb_open_rstream(&stream, &len, &type, odb, &oid)); cl_assert_equal_sz(LARGEFILE_SIZE, len); cl_assert_equal_i(GIT_OBJ_BLOB, type); cl_git_pass(git_hash_ctx_init(&hash)); cl_git_pass(git_odb__format_object_header(&hdr_len, hdr, sizeof(hdr), len, type)); cl_git_pass(git_hash_update(&hash, hdr, hdr_len)); while ((ret = git_odb_stream_read(stream, buf, 10240)) > 0) { cl_git_pass(git_hash_update(&hash, buf, ret)); total += ret; } cl_assert_equal_sz(LARGEFILE_SIZE, total); git_hash_final(&read_oid, &hash); cl_assert_equal_oid(&oid, &read_oid); git_hash_ctx_cleanup(&hash); git_odb_stream_free(stream); }
void test_online_clone__ssh_cert(void) { g_options.remote_callbacks.certificate_check = ssh_certificate_check; if (!cl_getenv("GITTEST_REMOTE_SSH_FINGERPRINT")) cl_skip(); cl_git_fail_with(GIT_EUSER, git_clone(&g_repo, "ssh://localhost/foo", "./foo", &g_options)); }
void test_online_clone__ssh_cert(void) { g_options.fetch_opts.callbacks.certificate_check = ssh_certificate_check; if (!_remote_ssh_fingerprint) cl_skip(); cl_git_fail_with(GIT_EUSER, git_clone(&g_repo, _remote_url, "./foo", &g_options)); }
void test_repo_init__symlinks_posix_detected(void) { #ifdef GIT_WIN32 cl_skip(); #else assert_config_entry_on_init( "core.symlinks", filesystem_supports_symlinks("link") ? GIT_ENOTFOUND : false); #endif }
void test_odb_largefiles__read_into_memory_rejected_on_32bit(void) { git_oid oid; git_odb_object *obj = NULL; #ifdef GIT_ARCH_64 cl_skip(); #endif if (!cl_is_env_set("GITTEST_INVASIVE_FS_SIZE") || !cl_is_env_set("GITTEST_INVASIVE_MEMORY") || !cl_is_env_set("GITTEST_SLOW")) cl_skip(); writefile(&oid); cl_git_fail(git_odb_read(&obj, odb, &oid)); git_odb_object_free(obj); }
void test_odb_largefiles__read_header(void) { git_oid oid; size_t len; git_otype type; #ifndef GIT_ARCH_64 cl_skip(); #endif if (!cl_is_env_set("GITTEST_INVASIVE_FS_SIZE") || !cl_is_env_set("GITTEST_SLOW")) cl_skip(); writefile(&oid); cl_git_pass(git_odb_read_header(&len, &type, odb, &oid)); cl_assert_equal_sz(LARGEFILE_SIZE, len); cl_assert_equal_i(GIT_OBJ_BLOB, type); }
void test_online_clone__proxy_credentials_in_url(void) { if (!_remote_proxy_url) cl_skip(); g_options.fetch_opts.proxy_opts.type = GIT_PROXY_SPECIFIED; g_options.fetch_opts.proxy_opts.url = _remote_proxy_url; called_proxy_creds = 0; cl_git_pass(git_clone(&g_repo, "http://github.com/libgit2/TestGitRepository", "./foo", &g_options)); cl_assert(called_proxy_creds == 0); }
void test_attr_ignore__symlink_to_outside(void) { #ifdef GIT_WIN32 cl_skip(); #endif cl_git_rewritefile("attr/.gitignore", "symlink\n"); cl_git_mkfile("target", "target"); cl_git_pass(p_symlink("../target", "attr/symlink")); assert_is_ignored(true, "symlink"); assert_is_ignored(true, "lala/../symlink"); }
void test_odb_largefiles__write_from_memory(void) { git_oid expected, oid; git_buf buf = GIT_BUF_INIT; size_t i; #ifndef GIT_ARCH_64 cl_skip(); #endif if (!cl_is_env_set("GITTEST_INVASIVE_FS_SIZE") || !cl_is_env_set("GITTEST_INVASIVE_MEMORY") || !cl_is_env_set("GITTEST_SLOW")) cl_skip(); for (i = 0; i < (3041*126103); i++) cl_git_pass(git_buf_puts(&buf, "Hello, world.\n")); git_oid_fromstr(&expected, "3fb56989cca483b21ba7cb0a6edb229d10e1c26c"); cl_git_pass(git_odb_write(&oid, odb, buf.ptr, buf.size, GIT_OBJ_BLOB)); cl_assert_equal_oid(&expected, &oid); }
void test_online_clone__proxy_credentials_in_url(void) { git_buf url = GIT_BUF_INIT; if (!_remote_proxy_url || !_remote_proxy_user || !_remote_proxy_pass) cl_skip(); cl_git_pass(git_buf_printf(&url, "http://%s:%s@%s/", _remote_proxy_user, _remote_proxy_pass, _remote_proxy_url)); g_options.fetch_opts.proxy_opts.type = GIT_PROXY_SPECIFIED; g_options.fetch_opts.proxy_opts.url = url.ptr; called_proxy_creds = 0; cl_git_pass(git_clone(&g_repo, "http://github.com/libgit2/TestGitRepository", "./foo", &g_options)); cl_assert(called_proxy_creds == 0); git_buf_free(&url); }
void test_core_filebuf__symlink_depth(void) { git_filebuf file = GIT_FILEBUF_INIT; const char *dir = "linkdir", *source = "linkdir/link"; #ifdef GIT_WIN32 cl_skip(); #endif cl_git_pass(p_mkdir(dir, 0777)); /* Endless loop */ cl_git_pass(p_symlink("link", source)); cl_git_fail(git_filebuf_open(&file, source, 0, 0666)); cl_git_pass(git_futils_rmdir_r(dir, NULL, GIT_RMDIR_REMOVE_FILES)); }
void test_object_tree_read__largefile(void) { git_reference *ref; git_commit *commit; git_tree *tree; git_oid oid; const git_tree_entry *entry; git_object *object; git_buf file = GIT_BUF_INIT; int fd; git_index *idx; if (!cl_is_env_set("GITTEST_INVASIVE_FS_SIZE")) cl_skip(); cl_git_pass(git_reference_lookup(&ref, g_repo, "refs/heads/master")); cl_git_pass(git_repository_index(&idx, g_repo)); cl_git_pass(git_buf_puts(&file, git_repository_workdir(g_repo))); cl_git_pass(git_buf_joinpath(&file, file.ptr, BIGFILE)); fd = p_open(git_buf_cstr(&file), O_CREAT|O_RDWR, 0644); cl_assert_(fd >= 0, "invalid file descriptor"); cl_must_pass(p_fallocate(fd, 0, BIGFILE_SIZE)); cl_must_pass(p_close(fd)); cl_git_pass(git_index_add_bypath(idx, BIGFILE)); cl_repo_commit_from_index(&oid, g_repo, NULL, 0, "bigfile"); cl_git_pass(git_commit_lookup(&commit, g_repo, &oid)); cl_git_pass(git_commit_tree(&tree, commit)); entry = git_tree_entry_byname(tree, BIGFILE); cl_assert_(entry, "entry was NULL"); cl_git_pass(git_tree_entry_to_object(&object, g_repo, entry)); git_buf_dispose(&file); git_object_free(object); git_tree_free(tree); git_index_free(idx); git_commit_free(commit); git_reference_free(ref); }
void test_config_global__open_programdata(void) { git_config *cfg; git_repository *repo; git_buf config_path = GIT_BUF_INIT; git_buf var_contents = GIT_BUF_INIT; if (cl_is_env_set("GITTEST_INVASIVE_FS_STRUCTURE")) cl_skip(); cl_git_pass(git_libgit2_opts(GIT_OPT_GET_SEARCH_PATH, GIT_CONFIG_LEVEL_PROGRAMDATA, &config_path)); if (!git_path_isdir(config_path.ptr)) cl_git_pass(p_mkdir(config_path.ptr, 0777)); cl_git_pass(git_buf_puts(&config_path, "/config")); cl_git_pass(git_config_open_ondisk(&cfg, config_path.ptr)); cl_git_pass(git_config_set_string(cfg, "programdata.var", "even higher level")); git_buf_free(&config_path); git_config_free(cfg); git_config_open_default(&cfg); cl_git_pass(git_config_get_string_buf(&var_contents, cfg, "programdata.var")); cl_assert_equal_s("even higher level", var_contents.ptr); git_config_free(cfg); git_buf_free(&var_contents); cl_git_pass(git_repository_init(&repo, "./foo.git", true)); cl_git_pass(git_repository_config(&cfg, repo)); cl_git_pass(git_config_get_string_buf(&var_contents, cfg, "programdata.var")); cl_assert_equal_s("even higher level", var_contents.ptr); git_config_free(cfg); git_buf_free(&var_contents); git_repository_free(repo); cl_fixture_cleanup("./foo.git"); }
void test_iterator_workdir__skips_unreadable_dirs(void) { git_iterator *i; const git_index_entry *e; if (!cl_is_chmod_supported()) return; #ifndef GIT_WIN32 if (geteuid() == 0) cl_skip(); #endif g_repo = cl_git_sandbox_init("empty_standard_repo"); cl_must_pass(p_mkdir("empty_standard_repo/r", 0777)); cl_git_mkfile("empty_standard_repo/r/a", "hello"); cl_must_pass(p_mkdir("empty_standard_repo/r/b", 0777)); cl_git_mkfile("empty_standard_repo/r/b/problem", "not me"); cl_must_pass(p_chmod("empty_standard_repo/r/b", 0000)); cl_must_pass(p_mkdir("empty_standard_repo/r/c", 0777)); cl_git_mkfile("empty_standard_repo/r/c/foo", "aloha"); cl_git_mkfile("empty_standard_repo/r/d", "final"); cl_git_pass(git_iterator_for_filesystem( &i, "empty_standard_repo/r", NULL)); cl_git_pass(git_iterator_advance(&e, i)); /* a */ cl_assert_equal_s("a", e->path); cl_git_pass(git_iterator_advance(&e, i)); /* c/foo */ cl_assert_equal_s("c/foo", e->path); cl_git_pass(git_iterator_advance(&e, i)); /* d */ cl_assert_equal_s("d", e->path); cl_must_pass(p_chmod("empty_standard_repo/r/b", 0777)); cl_assert_equal_i(GIT_ITEROVER, git_iterator_advance(&e, i)); git_iterator_free(i); }
void test_checkout_icase__initialize(void) { git_oid id; git_config *cfg; int icase = 0; repo = cl_git_sandbox_init("testrepo"); cl_git_pass(git_repository_config_snapshot(&cfg, repo)); git_config_get_bool(&icase, cfg, "core.ignorecase"); git_config_free(cfg); if (!icase) cl_skip(); cl_git_pass(git_reference_name_to_id(&id, repo, "refs/heads/dir")); cl_git_pass(git_object_lookup(&obj, repo, &id, GIT_OBJ_ANY)); git_checkout_init_options(&checkout_opts, GIT_CHECKOUT_OPTIONS_VERSION); checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE; }
void test_iterator_workdir__skips_fifos_and_special_files(void) { #ifndef GIT_WIN32 git_iterator *i; const git_index_entry *e; git_iterator_options i_opts = GIT_ITERATOR_OPTIONS_INIT; g_repo = cl_git_sandbox_init("empty_standard_repo"); cl_must_pass(p_mkdir("empty_standard_repo/dir", 0777)); cl_git_mkfile("empty_standard_repo/file", "not me"); cl_assert(!mkfifo("empty_standard_repo/fifo", 0777)); cl_assert(!access("empty_standard_repo/fifo", F_OK)); i_opts.flags = GIT_ITERATOR_INCLUDE_TREES | GIT_ITERATOR_DONT_AUTOEXPAND; cl_git_pass(git_iterator_for_filesystem( &i, "empty_standard_repo", &i_opts)); cl_git_pass(git_iterator_advance(&e, i)); /* .git */ cl_assert(S_ISDIR(e->mode)); cl_git_pass(git_iterator_advance(&e, i)); /* dir */ cl_assert(S_ISDIR(e->mode)); /* skips fifo */ cl_git_pass(git_iterator_advance(&e, i)); /* file */ cl_assert(S_ISREG(e->mode)); cl_assert_equal_i(GIT_ITEROVER, git_iterator_advance(&e, i)); git_iterator_free(i); #else cl_skip(); #endif }
/* * $ git blame -n 359fc2d -- include/git2.h * orig line no final line no * commit orig path V author timestamp V * d12299fe src/git.h 1 (Vicent Martí 2010-12-03 22:22:10 +0200 1 * 359fc2d2 include/git2.h 2 (Edward Thomson 2013-01-08 17:07:25 -0600 2 * d12299fe src/git.h 5 (Vicent Martí 2010-12-03 22:22:10 +0200 3 * bb742ede include/git2.h 4 (Vicent Martí 2011-09-19 01:54:32 +0300 4 * bb742ede include/git2.h 5 (Vicent Martí 2011-09-19 01:54:32 +0300 5 * d12299fe src/git.h 24 (Vicent Martí 2010-12-03 22:22:10 +0200 6 * d12299fe src/git.h 25 (Vicent Martí 2010-12-03 22:22:10 +0200 7 * d12299fe src/git.h 26 (Vicent Martí 2010-12-03 22:22:10 +0200 8 * d12299fe src/git.h 27 (Vicent Martí 2010-12-03 22:22:10 +0200 9 * d12299fe src/git.h 28 (Vicent Martí 2010-12-03 22:22:10 +0200 10 * 96fab093 include/git2.h 11 (Sven Strickroth 2011-10-09 18:37:41 +0200 11 * 9d1dcca2 src/git2.h 33 (Vicent Martí 2011-02-07 10:35:58 +0200 12 * 44908fe7 src/git2.h 29 (Vicent Martí 2010-12-06 23:03:16 +0200 13 * a15c550d include/git2.h 14 (Vicent Martí 2011-11-16 14:09:44 +0100 14 * 44908fe7 src/git2.h 30 (Vicent Martí 2010-12-06 23:03:16 +0200 15 * d12299fe src/git.h 32 (Vicent Martí 2010-12-03 22:22:10 +0200 16 * 44908fe7 src/git2.h 33 (Vicent Martí 2010-12-06 23:03:16 +0200 17 * d12299fe src/git.h 34 (Vicent Martí 2010-12-03 22:22:10 +0200 18 * 44908fe7 src/git2.h 35 (Vicent Martí 2010-12-06 23:03:16 +0200 19 * 638c2ca4 src/git2.h 36 (Vicent Martí 2010-12-18 02:10:25 +0200 20 * 44908fe7 src/git2.h 36 (Vicent Martí 2010-12-06 23:03:16 +0200 21 * d12299fe src/git.h 37 (Vicent Martí 2010-12-03 22:22:10 +0200 22 * 44908fe7 src/git2.h 38 (Vicent Martí 2010-12-06 23:03:16 +0200 23 * 44908fe7 src/git2.h 39 (Vicent Martí 2010-12-06 23:03:16 +0200 24 * bf787bd8 include/git2.h 25 (Carlos Martín Nieto 2012-04-08 18:56:50 +0200 25 * 0984c876 include/git2.h 26 (Scott J. Goldman 2012-11-28 18:27:43 -0800 26 * 2f8a8ab2 src/git2.h 41 (Vicent Martí 2011-01-29 01:56:25 +0200 27 * 27df4275 include/git2.h 47 (Michael Schubert 2011-06-28 14:13:12 +0200 28 * a346992f include/git2.h 28 (Ben Straub 2012-05-10 09:47:14 -0700 29 * d12299fe src/git.h 40 (Vicent Martí 2010-12-03 22:22:10 +0200 30 * 44908fe7 src/git2.h 41 (Vicent Martí 2010-12-06 23:03:16 +0200 31 * 44908fe7 src/git2.h 42 (Vicent Martí 2010-12-06 23:03:16 +0200 32 * 44908fe7 src/git2.h 43 (Vicent Martí 2010-12-06 23:03:16 +0200 33 * 44908fe7 src/git2.h 44 (Vicent Martí 2010-12-06 23:03:16 +0200 34 * 44908fe7 src/git2.h 45 (Vicent Martí 2010-12-06 23:03:16 +0200 35 * 65b09b1d include/git2.h 33 (Russell Belfer 2012-02-02 18:03:43 -0800 36 * d12299fe src/git.h 46 (Vicent Martí 2010-12-03 22:22:10 +0200 37 * 44908fe7 src/git2.h 47 (Vicent Martí 2010-12-06 23:03:16 +0200 38 * 5d4cd003 include/git2.h 55 (Carlos Martín Nieto 2011-03-28 17:02:45 +0200 39 * 41fb1ca0 include/git2.h 39 (Philip Kelley 2012-10-29 13:41:14 -0400 40 * 2dc31040 include/git2.h 56 (Carlos Martín Nieto 2011-06-20 18:58:57 +0200 41 * 764df57e include/git2.h 40 (Ben Straub 2012-06-15 13:14:43 -0700 42 * 5280f4e6 include/git2.h 41 (Ben Straub 2012-07-31 19:39:06 -0700 43 * 613d5eb9 include/git2.h 43 (Philip Kelley 2012-11-28 11:42:37 -0500 44 * d12299fe src/git.h 48 (Vicent Martí 2010-12-03 22:22:10 +0200 45 * 111ee3fe include/git2.h 41 (Vicent Martí 2012-07-11 14:37:26 +0200 46 * f004c4a8 include/git2.h 44 (Russell Belfer 2012-08-21 17:26:39 -0700 47 * 111ee3fe include/git2.h 42 (Vicent Martí 2012-07-11 14:37:26 +0200 48 * 9c82357b include/git2.h 58 (Carlos Martín Nieto 2011-06-17 18:13:14 +0200 49 * d6258deb include/git2.h 61 (Carlos Martín Nieto 2011-06-25 15:10:09 +0200 50 * b311e313 include/git2.h 63 (Julien Miotte 2011-07-27 18:31:13 +0200 51 * 3412391d include/git2.h 63 (Carlos Martín Nieto 2011-07-07 11:47:31 +0200 52 * bfc9ca59 include/git2.h 43 (Russell Belfer 2012-03-28 16:45:36 -0700 53 * bf477ed4 include/git2.h 44 (Michael Schubert 2012-02-15 00:33:38 +0100 54 * edebceff include/git2.h 46 (nulltoken 2012-05-01 13:57:45 +0200 55 * 743a4b3b include/git2.h 48 (nulltoken 2012-06-15 22:24:59 +0200 56 * 0a32dca5 include/git2.h 54 (Michael Schubert 2012-08-19 22:26:32 +0200 57 * 590fb68b include/git2.h 55 (nulltoken 2012-10-04 13:47:45 +0200 58 * bf477ed4 include/git2.h 45 (Michael Schubert 2012-02-15 00:33:38 +0100 59 * d12299fe src/git.h 49 (Vicent Martí 2010-12-03 22:22:10 +0200 60 */ void test_blame_simple__trivial_libgit2(void) { git_blame_options opts = GIT_BLAME_OPTIONS_INIT; git_object *obj; /* If we can't open the libgit2 repo or if it isn't a full repo * with proper history, just skip this test */ if (git_repository_open(&g_repo, cl_fixture("../..")) < 0) cl_skip(); if (git_repository_is_shallow(g_repo)) cl_skip(); if (git_revparse_single(&obj, g_repo, "359fc2d") < 0) cl_skip(); git_oid_cpy(&opts.newest_commit, git_object_id(obj)); git_object_free(obj); cl_git_pass(git_blame_file(&g_blame, g_repo, "include/git2.h", &opts)); check_blame_hunk_index(g_repo, g_blame, 0, 1, 1, 0, "d12299fe", "src/git.h"); check_blame_hunk_index(g_repo, g_blame, 1, 2, 1, 0, "359fc2d2", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 2, 3, 1, 0, "d12299fe", "src/git.h"); check_blame_hunk_index(g_repo, g_blame, 3, 4, 2, 0, "bb742ede", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 4, 6, 5, 0, "d12299fe", "src/git.h"); check_blame_hunk_index(g_repo, g_blame, 5, 11, 1, 0, "96fab093", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 6, 12, 1, 0, "9d1dcca2", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 7, 13, 1, 0, "44908fe7", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 8, 14, 1, 0, "a15c550d", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 9, 15, 1, 0, "44908fe7", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 10, 16, 1, 0, "d12299fe", "src/git.h"); check_blame_hunk_index(g_repo, g_blame, 11, 17, 1, 0, "44908fe7", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 12, 18, 1, 0, "d12299fe", "src/git.h"); check_blame_hunk_index(g_repo, g_blame, 13, 19, 1, 0, "44908fe7", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 14, 20, 1, 0, "638c2ca4", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 15, 21, 1, 0, "44908fe7", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 16, 22, 1, 0, "d12299fe", "src/git.h"); check_blame_hunk_index(g_repo, g_blame, 17, 23, 2, 0, "44908fe7", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 18, 25, 1, 0, "bf787bd8", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 19, 26, 1, 0, "0984c876", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 20, 27, 1, 0, "2f8a8ab2", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 21, 28, 1, 0, "27df4275", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 22, 29, 1, 0, "a346992f", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 23, 30, 1, 0, "d12299fe", "src/git.h"); check_blame_hunk_index(g_repo, g_blame, 24, 31, 5, 0, "44908fe7", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 25, 36, 1, 0, "65b09b1d", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 26, 37, 1, 0, "d12299fe", "src/git.h"); check_blame_hunk_index(g_repo, g_blame, 27, 38, 1, 0, "44908fe7", "src/git2.h"); check_blame_hunk_index(g_repo, g_blame, 28, 39, 1, 0, "5d4cd003", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 29, 40, 1, 0, "41fb1ca0", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 30, 41, 1, 0, "2dc31040", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 31, 42, 1, 0, "764df57e", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 32, 43, 1, 0, "5280f4e6", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 33, 44, 1, 0, "613d5eb9", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 34, 45, 1, 0, "d12299fe", "src/git.h"); check_blame_hunk_index(g_repo, g_blame, 35, 46, 1, 0, "111ee3fe", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 36, 47, 1, 0, "f004c4a8", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 37, 48, 1, 0, "111ee3fe", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 38, 49, 1, 0, "9c82357b", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 39, 50, 1, 0, "d6258deb", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 40, 51, 1, 0, "b311e313", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 41, 52, 1, 0, "3412391d", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 42, 53, 1, 0, "bfc9ca59", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 43, 54, 1, 0, "bf477ed4", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 44, 55, 1, 0, "edebceff", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 45, 56, 1, 0, "743a4b3b", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 46, 57, 1, 0, "0a32dca5", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 47, 58, 1, 0, "590fb68b", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 48, 59, 1, 0, "bf477ed4", "include/git2.h"); check_blame_hunk_index(g_repo, g_blame, 49, 60, 1, 0, "d12299fe", "src/git.h"); }