mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 09:36:47 +00:00
Merge pull request #1382 from arrbee/fix-diff-patch-a-different-way
Allow empty config object and use it for tests
This commit is contained in:
commit
01be786319
@ -426,8 +426,6 @@ static int get_string(const char **out, const git_config *cfg, const char *name)
|
||||
file_internal *internal;
|
||||
unsigned int i;
|
||||
|
||||
assert(cfg->files.length);
|
||||
|
||||
git_vector_foreach(&cfg->files, i, internal) {
|
||||
int res = get_string_at_file(out, internal->file, name);
|
||||
|
||||
@ -466,8 +464,6 @@ int git_config_get_entry(const git_config_entry **out, const git_config *cfg, co
|
||||
file_internal *internal;
|
||||
unsigned int i;
|
||||
|
||||
assert(cfg->files.length);
|
||||
|
||||
*out = NULL;
|
||||
|
||||
git_vector_foreach(&cfg->files, i, internal) {
|
||||
@ -488,8 +484,6 @@ int git_config_get_multivar(const git_config *cfg, const char *name, const char
|
||||
int ret = GIT_ENOTFOUND;
|
||||
size_t i;
|
||||
|
||||
assert(cfg->files.length);
|
||||
|
||||
/*
|
||||
* This loop runs the "wrong" way 'round because we need to
|
||||
* look at every value from the most general to most specific
|
||||
|
@ -150,9 +150,8 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
|
||||
|
||||
g_repo = cl_git_sandbox_init("renames");
|
||||
|
||||
cl_git_pass(git_repository_config(&cfg, g_repo));
|
||||
cl_git_pass(git_config_set_bool(cfg, "core.autocrlf", false));
|
||||
git_config_free(cfg);
|
||||
cl_git_pass(git_config_new(&cfg));
|
||||
git_repository_set_config(g_repo, cfg);
|
||||
|
||||
cl_git_rewritefile("renames/songof7cities.txt", new_content);
|
||||
|
||||
@ -278,9 +277,8 @@ void test_diff_patch__line_counts_with_eofnl(void)
|
||||
|
||||
g_repo = cl_git_sandbox_init("renames");
|
||||
|
||||
cl_git_pass(git_repository_config(&cfg, g_repo));
|
||||
cl_git_pass(git_config_set_bool(cfg, "core.autocrlf", false));
|
||||
git_config_free(cfg);
|
||||
cl_git_pass(git_config_new(&cfg));
|
||||
git_repository_set_config(g_repo, cfg);
|
||||
|
||||
cl_git_pass(git_futils_readbuffer(&content, "renames/songof7cities.txt"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user