void test_repo_init__reinit_doesnot_overwrite_ignorecase(void) { git_config *config; int current_value; /* Init a new repo */ cl_set_cleanup(&cleanup_repository, "not.overwrite.git"); cl_git_pass(git_repository_init(&_repo, "not.overwrite.git", 1)); /* Change the "core.ignorecase" config value to something unlikely */ git_repository_config(&config, _repo); git_config_set_int32(config, "core.ignorecase", 42); git_config_free(config); git_repository_free(_repo); _repo = NULL; /* Reinit the repository */ cl_git_pass(git_repository_init(&_repo, "not.overwrite.git", 1)); git_repository_config(&config, _repo); /* Ensure the "core.ignorecase" config value hasn't been updated */ cl_git_pass(git_config_get_int32(¤t_value, config, "core.ignorecase")); cl_assert_equal_i(42, current_value); git_config_free(config); }
void test_submodule_modify__init(void) { git_config *cfg; const char *str; /* erase submodule data from .git/config */ cl_git_pass(git_repository_config(&cfg, g_repo)); cl_git_pass( git_config_foreach_match(cfg, "submodule\\..*", delete_one_config, cfg)); git_config_free(cfg); /* confirm no submodule data in config */ cl_git_pass(git_repository_config(&cfg, g_repo)); cl_git_fail(git_config_get_string(&str, cfg, "submodule.sm_unchanged.url")); cl_git_fail(git_config_get_string(&str, cfg, "submodule.sm_changed_head.url")); cl_git_fail(git_config_get_string(&str, cfg, "submodule.sm_added_and_uncommited.url")); git_config_free(cfg); /* call init and see that settings are copied */ cl_git_pass(git_submodule_foreach(g_repo, init_one_submodule, NULL)); git_submodule_reload_all(g_repo); /* confirm submodule data in config */ cl_git_pass(git_repository_config(&cfg, g_repo)); cl_git_pass(git_config_get_string(&str, cfg, "submodule.sm_unchanged.url")); cl_assert(git__suffixcmp(str, "/submod2_target") == 0); cl_git_pass(git_config_get_string(&str, cfg, "submodule.sm_changed_head.url")); cl_assert(git__suffixcmp(str, "/submod2_target") == 0); cl_git_pass(git_config_get_string(&str, cfg, "submodule.sm_added_and_uncommited.url")); cl_assert(git__suffixcmp(str, "/submod2_target") == 0); git_config_free(cfg); }
void test_repo_init__reinit_overwrites_filemode(void) { git_config *config; int expected, current_value; #ifdef GIT_WIN32 expected = false; #else expected = true; #endif /* Init a new repo */ cl_set_cleanup(&cleanup_repository, "overwrite.git"); cl_git_pass(git_repository_init(&_repo, "overwrite.git", 1)); /* Change the "core.filemode" config value to something unlikely */ git_repository_config(&config, _repo); git_config_set_bool(config, "core.filemode", !expected); git_config_free(config); git_repository_free(_repo); _repo = NULL; /* Reinit the repository */ cl_git_pass(git_repository_init(&_repo, "overwrite.git", 1)); git_repository_config(&config, _repo); /* Ensure the "core.filemode" config value has been reset */ cl_git_pass(git_config_get_bool(¤t_value, config, "core.filemode")); cl_assert_equal_i(expected, current_value); git_config_free(config); }
void test_notes_notesref__config_corenotesref(void) { git_oid oid, note_oid; const char *default_ref; cl_git_pass(git_signature_now(&_sig, "alice", "*****@*****.**")); cl_git_pass(git_oid_fromstr(&oid, "8496071c1b46c854b31185ea97743be6a8774479")); cl_git_pass(git_repository_config(&_cfg, _repo)); cl_git_pass(git_config_set_string(_cfg, "core.notesRef", "refs/notes/mydefaultnotesref")); cl_git_pass(git_note_create(¬e_oid, _repo, _sig, _sig, NULL, &oid, "test123test\n")); cl_git_pass(git_note_read(&_note, _repo, NULL, &oid)); cl_assert(!strcmp(git_note_message(_note), "test123test\n")); cl_assert(!git_oid_cmp(git_note_oid(_note), ¬e_oid)); git_note_free(_note); cl_git_pass(git_note_read(&_note, _repo, "refs/notes/mydefaultnotesref", &oid)); cl_assert(!strcmp(git_note_message(_note), "test123test\n")); cl_assert(!git_oid_cmp(git_note_oid(_note), ¬e_oid)); cl_git_pass(git_note_default_ref(&default_ref, _repo)); cl_assert(!strcmp(default_ref, "refs/notes/mydefaultnotesref")); cl_git_pass(git_config_delete(_cfg, "core.notesRef")); cl_git_pass(git_note_default_ref(&default_ref, _repo)); cl_assert(!strcmp(default_ref, GIT_NOTES_DEFAULT_REF)); }
void cl_repo_set_string(git_repository *repo, const char *cfg, const char *value) { git_config *config; cl_git_pass(git_repository_config(&config, repo)); cl_git_pass(git_config_set_string(config, cfg, value)); git_config_free(config); }
void test_refs_branches_create__default_reflog_message(void) { git_reflog *log; const git_reflog_entry *entry; git_signature *sig; git_config *cfg; cl_git_pass(git_repository_config(&cfg, repo)); cl_git_pass(git_config_set_string(cfg, "user.name", "Foo Bar")); cl_git_pass(git_config_set_string(cfg, "user.email", "*****@*****.**")); git_config_free(cfg); cl_git_pass(git_signature_default(&sig, repo)); retrieve_known_commit(&target, repo); cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false, NULL, NULL)); cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME)); entry = git_reflog_entry_byindex(log, 0); cl_assert_equal_s("Branch: created", git_reflog_entry_message(entry)); cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email); git_reflog_free(log); git_signature_free(sig); }
void test_repo_config__can_open_missing_global_with_separators(void) { git_repository *repo; git_config *config, *global; cl_git_pass(git_buf_printf( &path, "%c%s", GIT_PATH_LIST_SEPARATOR, "dummy")); cl_git_pass(git_libgit2_opts( GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr)); cl_git_pass(git_libgit2_opts( GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, path.ptr)); cl_git_pass(git_libgit2_opts( GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_XDG, path.ptr)); git_buf_dispose(&path); cl_git_pass(git_repository_open(&repo, "empty_standard_repo")); cl_git_pass(git_repository_config(&config, repo)); cl_git_pass(git_config_open_level( &global, config, GIT_CONFIG_LEVEL_GLOBAL)); cl_git_pass(git_config_set_string(global, "test.set", "42")); git_config_free(global); git_config_free(config); git_repository_free(repo); }
void test_attr_ignore__expand_tilde_to_homedir(void) { git_buf path = GIT_BUF_INIT; git_config *cfg; assert_is_ignored(false, "example.global_with_tilde"); /* construct fake home with fake global excludes */ cl_must_pass(p_mkdir("home", 0777)); cl_git_pass(git_path_prettify(&path, "home", NULL)); cl_git_pass(git_libgit2_opts( GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr)); cl_git_mkfile("home/globalexcludes", "# found me\n*.global_with_tilde\n"); cl_git_pass(git_repository_config(&cfg, g_repo)); cl_git_pass(git_config_set_string(cfg, "core.excludesfile", "~/globalexcludes")); git_config_free(cfg); git_attr_cache_flush(g_repo); /* must reset to pick up change */ assert_is_ignored(true, "example.global_with_tilde"); cl_git_pass(git_futils_rmdir_r("home", NULL, GIT_RMDIR_REMOVE_FILES)); cl_git_pass(git_libgit2_opts( GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, NULL)); git_buf_free(&path); }
PyObject * Repository_config__get__(Repository *self, void *closure) { int err; git_config *config; Config *py_config; assert(self->repo); if (self->config == NULL) { err = git_repository_config(&config, self->repo); if (err < 0) return Error_set(err); py_config = PyObject_GC_New(Config, &ConfigType); if (!py_config) { git_config_free(config); return NULL; } Py_INCREF(self); py_config->repo = self; py_config->config = config; PyObject_GC_Track(py_config); self->config = (PyObject*)py_config; } Py_INCREF(self->config); return self->config; }
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 cl_repo_set_bool(git_repository *repo, const char *cfg, int value) { git_config *config; cl_git_pass(git_repository_config(&config, repo)); cl_git_pass(git_config_set_bool(config, cfg, value != 0)); git_config_free(config); }
void test_status_worktree__new_staged_file_must_handle_crlf(void) { git_repository *repo; git_index *index; git_config *config; unsigned int status; cl_git_pass(git_repository_init(&repo, "getting_started", 0)); // Ensure that repo has core.autocrlf=true cl_git_pass(git_repository_config(&config, repo)); cl_git_pass(git_config_set_bool(config, "core.autocrlf", true)); cl_git_mkfile("getting_started/testfile.txt", "content\r\n"); // Content with CRLF cl_git_pass(git_repository_index(&index, repo)); cl_git_pass(git_index_add_from_workdir(index, "testfile.txt")); cl_git_pass(git_index_write(index)); cl_git_pass(git_status_file(&status, repo, "testfile.txt")); cl_assert_equal_i(GIT_STATUS_INDEX_NEW, status); git_config_free(config); git_index_free(index); git_repository_free(repo); }
static int notes_ref_lookup(git_buf *out, git_rebase *rebase) { git_config *config = NULL; int do_rewrite, error; if (rebase->options.rewrite_notes_ref) { git_buf_attach_notowned(out, rebase->options.rewrite_notes_ref, strlen(rebase->options.rewrite_notes_ref)); return 0; } if ((error = git_repository_config(&config, rebase->repo)) < 0 || (error = git_config_get_bool(&do_rewrite, config, "notes.rewrite.rebase")) < 0) { if (error != GIT_ENOTFOUND) goto done; giterr_clear(); do_rewrite = 1; } error = do_rewrite ? git_config_get_string_buf(out, config, "notes.rewriteref") : GIT_ENOTFOUND; done: git_config_free(config); return error; }
PyObject * Repository_config__get__(Repository *self) { int err; git_config *config; Config *py_config; assert(self->repo); if (self->config == NULL) { err = git_repository_config(&config, self->repo); if (err < 0) return Error_set(err); py_config = PyObject_New(Config, &ConfigType); if (py_config == NULL) { git_config_free(config); return NULL; } py_config->config = config; self->config = (PyObject*)py_config; /* We need 2 refs here. One is returned, one is kept internally. */ Py_INCREF(self->config); } else { Py_INCREF(self->config); } return self->config; }
void test_worktree_config__set(void) { git_config *cfg; int32_t val; cl_git_pass(git_repository_config(&cfg, fixture.worktree)); cl_git_pass(git_config_set_int32(cfg, "core.dummy", 5)); git_config_free(cfg); // reopen to verify configuration has been set in the // common dir cl_git_pass(git_repository_config(&cfg, fixture.repo)); cl_git_pass(git_config_get_int32(&val, cfg, "core.dummy")); cl_assert_equal_i(val, 5); git_config_free(cfg); }
void test_network_remote_remotes__nonmatch_upstream_refspec(void) { git_config *config; git_remote *remote; char *specstr[] = { "refs/tags/*:refs/tags/*", }; git_strarray specs = { specstr, 1, }; cl_git_pass(git_remote_create(&remote, _repo, "taggy", git_repository_path(_repo))); /* * Set the current branch's upstream remote to a dummy ref so we call into the code * which tries to check for the current branch's upstream in the refspecs */ cl_git_pass(git_repository_config(&config, _repo)); cl_git_pass(git_config_set_string(config, "branch.master.remote", "taggy")); cl_git_pass(git_config_set_string(config, "branch.master.merge", "refs/heads/foo")); cl_git_pass(git_remote_fetch(remote, &specs, NULL, NULL)); git_remote_free(remote); }
void test_attr_ignore__expand_tilde_to_homedir(void) { git_config *cfg; assert_is_ignored(false, "example.global_with_tilde"); cl_fake_home(); /* construct fake home with fake global excludes */ cl_git_mkfile("home/globalexclude", "# found me\n*.global_with_tilde\n"); cl_git_pass(git_repository_config(&cfg, g_repo)); cl_git_pass(git_config_set_string(cfg, "core.excludesfile", "~/globalexclude")); git_config_free(cfg); git_attr_cache_flush(g_repo); /* must reset to pick up change */ assert_is_ignored(true, "example.global_with_tilde"); cl_git_pass(git_futils_rmdir_r("home", NULL, GIT_RMDIR_REMOVE_FILES)); cl_fake_home_cleanup(NULL); git_attr_cache_flush(g_repo); /* must reset to pick up change */ assert_is_ignored(false, "example.global_with_tilde"); }
static void assert_config_entry_on_init_bytype(const char *config_key, int expected_value, bool is_bare) { git_config *config; int current_value; git_buf repo_path = GIT_BUF_INIT; cl_set_cleanup(&cleanup_repository, "config_entry"); cl_git_pass(git_buf_puts(&repo_path, "config_entry/test.")); if (!is_bare) cl_git_pass(git_buf_puts(&repo_path, "non.")); cl_git_pass(git_buf_puts(&repo_path, "bare.git")); cl_git_pass(git_repository_init(&_repo, git_buf_cstr(&repo_path), is_bare)); git_buf_free(&repo_path); git_repository_config(&config, _repo); if (expected_value >= 0) { cl_git_pass(git_config_get_bool(¤t_value, config, config_key)); cl_assert_equal_i(expected_value, current_value); } else { int error = git_config_get_bool(¤t_value, config, config_key); cl_assert_equal_i(expected_value, error); } git_config_free(config); }
static int repository_create_cb(git_repository **out, const char *path, int bare, void *payload) { UNUSED(payload); char *proxy_string; git_config *conf; int ret = git_repository_init(out, path, bare); if (ret != 0) { if (verbose) fprintf(stderr, "Initializing git repository failed\n"); return ret; } git_repository_config(&conf, *out); if (getProxyString(&proxy_string)) { if (verbose) fprintf(stderr, "set proxy to \"%s\"\n", proxy_string); git_config_set_string(conf, "http.proxy", proxy_string); free(proxy_string); } else { if (verbose) fprintf(stderr, "delete proxy setting\n"); git_config_delete_entry(conf, "http.proxy"); } return ret; }
static int rebase_normalize_opts( git_repository *repo, git_rebase_options *opts, const git_rebase_options *given_opts) { git_rebase_options default_opts = GIT_REBASE_OPTIONS_INIT; git_config *config; if (given_opts) memcpy(opts, given_opts, sizeof(git_rebase_options)); else memcpy(opts, &default_opts, sizeof(git_rebase_options)); if (git_repository_config(&config, repo) < 0) return -1; if (given_opts && given_opts->rewrite_notes_ref) { opts->rewrite_notes_ref = git__strdup(given_opts->rewrite_notes_ref); GITERR_CHECK_ALLOC(opts->rewrite_notes_ref); } else if (git_config__get_bool_force(config, "notes.rewrite.rebase", 1)) { char *rewrite_ref = git_config__get_string_force( config, "notes.rewriteref", NOTES_DEFAULT_REF); if (rewrite_ref) { opts->rewrite_notes_ref = rewrite_ref; GITERR_CHECK_ALLOC(opts->rewrite_notes_ref); } } git_config_free(config); return 0; }
/* this should correctly initialize both the local and remote * repository for the Subsurface cloud storage */ static git_repository *create_and_push_remote(const char *localdir, const char *remote, const char *branch) { git_repository *repo; git_config *conf; int len; char *variable_name, *merge_head; /* first make sure the directory for the local cache exists */ subsurface_mkdir(localdir); /* set up the origin to point to our remote */ git_repository_init_options init_opts = GIT_REPOSITORY_INIT_OPTIONS_INIT; init_opts.origin_url = remote; /* now initialize the repository with */ git_repository_init_ext(&repo, localdir, &init_opts); /* create a config so we can set the remote tracking branch */ git_repository_config(&conf, repo); len = sizeof("branch..remote") + strlen(branch); variable_name = malloc(len); snprintf(variable_name, len, "branch.%s.remote", branch); git_config_set_string(conf, variable_name, "origin"); /* we know this is shorter than the previous one, so we reuse the variable*/ snprintf(variable_name, len, "branch.%s.merge", branch); len = sizeof("refs/heads/") + strlen(branch); merge_head = malloc(len); snprintf(merge_head, len, "refs/heads/%s", branch); git_config_set_string(conf, variable_name, merge_head); /* finally create an empty commit and push it to the remote */ if (do_git_save(repo, branch, remote, false, true)) return NULL; return(repo); }
static void set_config_int(git_repository *repo, const char *name, int value) { git_config *cfg; cl_git_pass(git_repository_config(&cfg, repo)); cl_git_pass(git_config_set_int32(cfg, name, value)); git_config_free(cfg); }
void test_submodule_modify__add(void) { git_submodule *sm; git_config *cfg; const char *s; /* re-add existing submodule */ cl_assert( git_submodule_add_setup(NULL, g_repo, "whatever", "sm_unchanged", 1) == GIT_EEXISTS ); /* add a submodule using a gitlink */ cl_git_pass( git_submodule_add_setup(&sm, g_repo, SM_LIBGIT2_URL, SM_LIBGIT2, 1) ); cl_assert(git_path_isfile("submod2/" SM_LIBGIT2 "/.git")); cl_assert(git_path_isdir("submod2/.git/modules")); cl_assert(git_path_isdir("submod2/.git/modules/" SM_LIBGIT2)); cl_assert(git_path_isfile("submod2/.git/modules/" SM_LIBGIT2 "/HEAD")); cl_git_pass(git_repository_config(&cfg, g_repo)); cl_git_pass( git_config_get_string(&s, cfg, "submodule." SM_LIBGIT2 ".url")); cl_assert_equal_s(s, SM_LIBGIT2_URL); git_config_free(cfg); /* add a submodule not using a gitlink */ cl_git_pass( git_submodule_add_setup(&sm, g_repo, SM_LIBGIT2_URL, SM_LIBGIT2B, 0) ); cl_assert(git_path_isdir("submod2/" SM_LIBGIT2B "/.git")); cl_assert(git_path_isfile("submod2/" SM_LIBGIT2B "/.git/HEAD")); cl_assert(!git_path_exists("submod2/.git/modules/" SM_LIBGIT2B)); cl_git_pass(git_repository_config(&cfg, g_repo)); cl_git_pass( git_config_get_string(&s, cfg, "submodule." SM_LIBGIT2B ".url")); cl_assert_equal_s(s, SM_LIBGIT2_URL); git_config_free(cfg); }
static void set_config_entry_to(const char *entry_name, bool value) { git_config *cfg; cl_git_pass(git_repository_config(&cfg, g_repo)); cl_git_pass(git_config_set_bool(cfg, entry_name, value)); git_config_free(cfg); }
void test_network_remotes__initialize(void) { cl_fixture_sandbox(REPOSITORY_FOLDER); cl_git_pass(git_repository_open(&repo, REPOSITORY_FOLDER)); cl_git_pass(git_repository_config(&cfg, repo, NULL, NULL)); cl_git_pass(git_remote_get(&remote, cfg, "test")); refspec = git_remote_fetchspec(remote); cl_assert(refspec != NULL); }
void test_worktree_config__open(void) { git_config *cfg; cl_git_pass(git_repository_config(&cfg, fixture.worktree)); cl_assert(cfg != NULL); git_config_free(cfg); }
static void set_core_autocrlf_to(git_repository *repo, bool value) { git_config *cfg; cl_git_pass(git_repository_config(&cfg, repo)); cl_git_pass(git_config_set_bool(cfg, "core.autocrlf", value)); git_config_free(cfg); }
void test_submodule_modify__sync(void) { git_submodule *sm1, *sm2, *sm3; git_config *cfg; const char *str; #define SM1 "sm_unchanged" #define SM2 "sm_changed_head" #define SM3 "sm_added_and_uncommited" /* look up some submodules */ cl_git_pass(git_submodule_lookup(&sm1, g_repo, SM1)); cl_git_pass(git_submodule_lookup(&sm2, g_repo, SM2)); cl_git_pass(git_submodule_lookup(&sm3, g_repo, SM3)); /* At this point, the .git/config URLs for the submodules have * not be rewritten with the absolute paths (although the * .gitmodules have. Let's confirm that they DO NOT match * yet, then we can do a sync to make them match... */ /* check submodule info does not match before sync */ cl_git_pass(git_repository_config(&cfg, g_repo)); cl_git_pass(git_config_get_string(&str, cfg, "submodule."SM1".url")); cl_assert(strcmp(git_submodule_url(sm1), str) != 0); cl_git_pass(git_config_get_string(&str, cfg, "submodule."SM2".url")); cl_assert(strcmp(git_submodule_url(sm2), str) != 0); cl_git_pass(git_config_get_string(&str, cfg, "submodule."SM3".url")); cl_assert(strcmp(git_submodule_url(sm3), str) != 0); git_config_free(cfg); /* sync all the submodules */ cl_git_pass(git_submodule_foreach(g_repo, sync_one_submodule, NULL)); /* check that submodule config is updated */ cl_git_pass(git_repository_config(&cfg, g_repo)); cl_git_pass(git_config_get_string(&str, cfg, "submodule."SM1".url")); cl_assert_equal_s(git_submodule_url(sm1), str); cl_git_pass(git_config_get_string(&str, cfg, "submodule."SM2".url")); cl_assert_equal_s(git_submodule_url(sm2), str); cl_git_pass(git_config_get_string(&str, cfg, "submodule."SM3".url")); cl_assert_equal_s(git_submodule_url(sm3), str); git_config_free(cfg); }
void test_submodule_add__url_absolute(void) { git_submodule *sm; git_config *cfg; git_repository *repo; const char *worktree_path; git_buf dot_git_content = GIT_BUF_INIT; g_repo = setup_fixture_submod2(); /* re-add existing submodule */ cl_git_fail_with( GIT_EEXISTS, git_submodule_add_setup(NULL, g_repo, "whatever", "sm_unchanged", 1)); /* add a submodule using a gitlink */ cl_git_pass( git_submodule_add_setup(&sm, g_repo, "https://github.com/libgit2/libgit2.git", "sm_libgit2", 1) ); git_submodule_free(sm); cl_assert(git_path_isfile("submod2/" "sm_libgit2" "/.git")); cl_assert(git_path_isdir("submod2/.git/modules")); cl_assert(git_path_isdir("submod2/.git/modules/" "sm_libgit2")); cl_assert(git_path_isfile("submod2/.git/modules/" "sm_libgit2" "/HEAD")); assert_submodule_url("sm_libgit2", "https://github.com/libgit2/libgit2.git"); cl_git_pass(git_repository_open(&repo, "submod2/" "sm_libgit2")); /* Verify worktree path is relative */ cl_git_pass(git_repository_config(&cfg, repo)); cl_git_pass(git_config_get_string(&worktree_path, cfg, "core.worktree")); cl_assert_equal_s("../../../sm_libgit2/", worktree_path); /* Verify gitdir path is relative */ cl_git_pass(git_futils_readbuffer(&dot_git_content, "submod2/" "sm_libgit2" "/.git")); cl_assert_equal_s("gitdir: ../.git/modules/sm_libgit2/", dot_git_content.ptr); git_config_free(cfg); git_repository_free(repo); git_buf_free(&dot_git_content); /* add a submodule not using a gitlink */ cl_git_pass( git_submodule_add_setup(&sm, g_repo, "https://github.com/libgit2/libgit2.git", "sm_libgit2b", 0) ); git_submodule_free(sm); cl_assert(git_path_isdir("submod2/" "sm_libgit2b" "/.git")); cl_assert(git_path_isfile("submod2/" "sm_libgit2b" "/.git/HEAD")); cl_assert(!git_path_exists("submod2/.git/modules/" "sm_libgit2b")); assert_submodule_url("sm_libgit2b", "https://github.com/libgit2/libgit2.git"); }
void test_rebase_merge__copy_notes_specified_in_config(void) { git_config *config; cl_git_pass(git_repository_config(&config, repo)); cl_git_pass(git_config_set_string(config, "notes.rewriteRef", "refs/notes/test")); test_copy_note(NULL, 1); }