mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
tests: declare functions statically where appropriate
This commit is contained in:
@@ -509,7 +509,7 @@ void test_checkout_tree__can_disable_pattern_match(void)
|
||||
cl_assert(git_fs_path_isfile("testrepo/branch_file.txt"));
|
||||
}
|
||||
|
||||
void assert_conflict(
|
||||
static void assert_conflict(
|
||||
const char *entry_path,
|
||||
const char *new_content,
|
||||
const char *parent_sha,
|
||||
@@ -1034,7 +1034,8 @@ void test_checkout_tree__filemode_preserved_in_index(void)
|
||||
git_index_free(index);
|
||||
}
|
||||
|
||||
mode_t read_filemode(const char *path)
|
||||
#ifndef GIT_WIN32
|
||||
static mode_t read_filemode(const char *path)
|
||||
{
|
||||
git_str fullpath = GIT_STR_INIT;
|
||||
struct stat st;
|
||||
@@ -1050,6 +1051,7 @@ mode_t read_filemode(const char *path)
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
void test_checkout_tree__filemode_preserved_in_workdir(void)
|
||||
{
|
||||
@@ -1267,7 +1269,7 @@ void test_checkout_tree__case_changing_rename(void)
|
||||
git_commit_free(master_commit);
|
||||
}
|
||||
|
||||
void perfdata_cb(const git_checkout_perfdata *in, void *payload)
|
||||
static void perfdata_cb(const git_checkout_perfdata *in, void *payload)
|
||||
{
|
||||
memcpy(payload, in, sizeof(git_checkout_perfdata));
|
||||
}
|
||||
@@ -1296,7 +1298,7 @@ void test_checkout_tree__can_collect_perfdata(void)
|
||||
git_object_free(obj);
|
||||
}
|
||||
|
||||
void update_attr_callback(
|
||||
static void update_attr_callback(
|
||||
const char *path,
|
||||
size_t completed_steps,
|
||||
size_t total_steps,
|
||||
|
||||
@@ -109,7 +109,7 @@ void test_clone_nonetwork__fail_with_already_existing_but_non_empty_directory(vo
|
||||
cl_git_fail(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
|
||||
}
|
||||
|
||||
int custom_origin_name_remote_create(
|
||||
static int custom_origin_name_remote_create(
|
||||
git_remote **out,
|
||||
git_repository *repo,
|
||||
const char *name,
|
||||
|
||||
@@ -111,7 +111,7 @@ void test_commit_commit__create_initial_commit_parent_not_current(void)
|
||||
git_signature_free(s);
|
||||
}
|
||||
|
||||
void assert_commit_summary(const char *expected, const char *given)
|
||||
static void assert_commit_summary(const char *expected, const char *given)
|
||||
{
|
||||
git_commit *dummy;
|
||||
|
||||
@@ -123,7 +123,7 @@ void assert_commit_summary(const char *expected, const char *given)
|
||||
git_commit__free(dummy);
|
||||
}
|
||||
|
||||
void assert_commit_body(const char *expected, const char *given)
|
||||
static void assert_commit_body(const char *expected, const char *given)
|
||||
{
|
||||
git_commit *dummy;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void test_config_stress__dont_break_on_invalid_input(void)
|
||||
git_config_free(config);
|
||||
}
|
||||
|
||||
void assert_config_value(git_config *config, const char *key, const char *value)
|
||||
static void assert_config_value(git_config *config, const char *key, const char *value)
|
||||
{
|
||||
git_buf_dispose(&buf);
|
||||
cl_git_pass(git_config_get_string_buf(&buf, config, key));
|
||||
|
||||
@@ -45,7 +45,8 @@ void test_core_copy__file_in_dir(void)
|
||||
cl_assert(!git_fs_path_isdir("an_dir"));
|
||||
}
|
||||
|
||||
void assert_hard_link(const char *path)
|
||||
#ifndef GIT_WIN32
|
||||
static void assert_hard_link(const char *path)
|
||||
{
|
||||
/* we assert this by checking that there's more than one link to the file */
|
||||
struct stat st;
|
||||
@@ -54,6 +55,7 @@ void assert_hard_link(const char *path)
|
||||
cl_git_pass(p_stat(path, &st));
|
||||
cl_assert(st.st_nlink > 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void test_core_copy__tree(void)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ void test_diff_binary__cleanup(void)
|
||||
cl_git_sandbox_cleanup();
|
||||
}
|
||||
|
||||
void test_patch(
|
||||
static void test_patch(
|
||||
const char *one,
|
||||
const char *two,
|
||||
const git_diff_options *opts,
|
||||
|
||||
@@ -938,7 +938,7 @@ struct rename_expected
|
||||
size_t idx;
|
||||
};
|
||||
|
||||
int test_names_expected(const git_diff_delta *delta, float progress, void *p)
|
||||
static int test_names_expected(const git_diff_delta *delta, float progress, void *p)
|
||||
{
|
||||
struct rename_expected *expected = p;
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ void test_diff_tree__checks_options_version(void)
|
||||
err = git_error_last();
|
||||
}
|
||||
|
||||
void process_tree_to_tree_diffing(
|
||||
static void process_tree_to_tree_diffing(
|
||||
const char *old_commit,
|
||||
const char *new_commit)
|
||||
{
|
||||
|
||||
386
tests/email/create.c.bak
Normal file
386
tests/email/create.c.bak
Normal file
@@ -0,0 +1,386 @@
|
||||
#include "clar.h"
|
||||
#include "clar_libgit2.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "diff_generate.h"
|
||||
|
||||
static git_repository *repo;
|
||||
|
||||
void test_email_create__initialize(void)
|
||||
{
|
||||
repo = cl_git_sandbox_init("diff_format_email");
|
||||
}
|
||||
|
||||
void test_email_create__cleanup(void)
|
||||
{
|
||||
cl_git_sandbox_cleanup();
|
||||
}
|
||||
|
||||
static void email_for_commit(
|
||||
git_buf *out,
|
||||
const char *commit_id,
|
||||
git_email_create_options *opts)
|
||||
{
|
||||
git_oid oid;
|
||||
git_commit *commit = NULL;
|
||||
git_diff *diff = NULL;
|
||||
|
||||
git_oid_fromstr(&oid, commit_id);
|
||||
|
||||
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
|
||||
|
||||
cl_git_pass(git_email_create_from_commit(out, commit, opts));
|
||||
|
||||
git_diff_free(diff);
|
||||
git_commit_free(commit);
|
||||
}
|
||||
|
||||
static void assert_email_match(
|
||||
const char *expected,
|
||||
const char *commit_id,
|
||||
git_email_create_options *opts)
|
||||
{
|
||||
git_buf buf = GIT_BUF_INIT;
|
||||
|
||||
email_for_commit(&buf, commit_id, opts);
|
||||
cl_assert_equal_s(expected, git_buf_cstr(&buf));
|
||||
|
||||
git_buf_dispose(&buf);
|
||||
}
|
||||
|
||||
static void assert_subject_match(
|
||||
const char *expected,
|
||||
const char *commit_id,
|
||||
git_email_create_options *opts)
|
||||
{
|
||||
git_buf buf = GIT_BUF_INIT;
|
||||
const char *loc;
|
||||
|
||||
email_for_commit(&buf, commit_id, opts);
|
||||
|
||||
cl_assert((loc = strstr(buf.ptr, "\nSubject: ")) != NULL);
|
||||
git_buf_consume(&buf, (loc + 10));
|
||||
git_buf_truncate_at_char(&buf, '\n');
|
||||
|
||||
cl_assert_equal_s(expected, git_buf_cstr(&buf));
|
||||
|
||||
git_buf_dispose(&buf);
|
||||
}
|
||||
|
||||
void test_email_create__commit(void)
|
||||
{
|
||||
const char *expected =
|
||||
"From 9264b96c6d104d0e07ae33d3007b6a48246c6f92 Mon Sep 17 00:00:00 2001\n" \
|
||||
"From: Jacques Germishuys <jacquesg@striata.com>\n" \
|
||||
"Date: Wed, 9 Apr 2014 20:57:01 +0200\n" \
|
||||
"Subject: [PATCH] Modify some content\n" \
|
||||
"\n" \
|
||||
"---\n" \
|
||||
" file1.txt | 8 +++++---\n" \
|
||||
" 1 file changed, 5 insertions(+), 3 deletions(-)\n" \
|
||||
"\n" \
|
||||
"diff --git a/file1.txt b/file1.txt\n" \
|
||||
"index 94aaae8..af8f41d 100644\n" \
|
||||
"--- a/file1.txt\n" \
|
||||
"+++ b/file1.txt\n" \
|
||||
"@@ -1,15 +1,17 @@\n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
"+_file1.txt_\n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
"+\n" \
|
||||
"+\n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"+_file1.txt_\n" \
|
||||
"+_file1.txt_\n" \
|
||||
" file1.txt\n" \
|
||||
"--\n" \
|
||||
"libgit2 " LIBGIT2_VERSION "\n" \
|
||||
"\n";
|
||||
|
||||
assert_email_match(
|
||||
expected, "9264b96c6d104d0e07ae33d3007b6a48246c6f92", NULL);
|
||||
}
|
||||
|
||||
void test_email_create__custom_summary_and_body(void)
|
||||
{
|
||||
const char *expected = "From 627e7e12d87e07a83fad5b6bfa25e86ead4a5270 Mon Sep 17 00:00:00 2001\n" \
|
||||
"From: Patrick Steinhardt <ps@pks.im>\n" \
|
||||
"Date: Tue, 24 Nov 2015 13:34:39 +0100\n" \
|
||||
"Subject: [PPPPPATCH 2/4] This is a subject\n" \
|
||||
"\n" \
|
||||
"Modify content of file3.txt by appending a new line. Make this\n" \
|
||||
"commit message somewhat longer to test behavior with newlines\n" \
|
||||
"embedded in the message body.\n" \
|
||||
"\n" \
|
||||
"Also test if new paragraphs are included correctly.\n" \
|
||||
"---\n" \
|
||||
" file3.txt | 1 +\n" \
|
||||
" 1 file changed, 1 insertion(+)\n" \
|
||||
"\n" \
|
||||
"diff --git a/file3.txt b/file3.txt\n" \
|
||||
"index 9a2d780..7309653 100644\n" \
|
||||
"--- a/file3.txt\n" \
|
||||
"+++ b/file3.txt\n" \
|
||||
"@@ -3,3 +3,4 @@ file3!\n" \
|
||||
" file3\n" \
|
||||
" file3\n" \
|
||||
" file3\n" \
|
||||
"+file3\n" \
|
||||
"--\n" \
|
||||
"libgit2 " LIBGIT2_VERSION "\n" \
|
||||
"\n";
|
||||
|
||||
const char *summary = "This is a subject\nwith\nnewlines";
|
||||
const char *body = "Modify content of file3.txt by appending a new line. Make this\n" \
|
||||
"commit message somewhat longer to test behavior with newlines\n" \
|
||||
"embedded in the message body.\n" \
|
||||
"\n" \
|
||||
"Also test if new paragraphs are included correctly.";
|
||||
|
||||
git_oid oid;
|
||||
git_commit *commit = NULL;
|
||||
git_diff *diff = NULL;
|
||||
git_buf buf = GIT_BUF_INIT;
|
||||
git_email_create_options opts = GIT_EMAIL_CREATE_OPTIONS_INIT;
|
||||
|
||||
opts.subject_prefix = "PPPPPATCH";
|
||||
|
||||
git_oid_fromstr(&oid, "627e7e12d87e07a83fad5b6bfa25e86ead4a5270");
|
||||
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
|
||||
cl_git_pass(git_diff__commit(&diff, repo, commit, NULL));
|
||||
cl_git_pass(git_email_create_from_diff(&buf, diff, 2, 4, &oid, summary, body, git_commit_author(commit), &opts));
|
||||
|
||||
cl_assert_equal_s(expected, git_buf_cstr(&buf));
|
||||
|
||||
git_diff_free(diff);
|
||||
git_commit_free(commit);
|
||||
git_buf_dispose(&buf);
|
||||
}
|
||||
|
||||
void test_email_create__mode_change(void)
|
||||
{
|
||||
const char *expected =
|
||||
"From 7ade76dd34bba4733cf9878079f9fd4a456a9189 Mon Sep 17 00:00:00 2001\n" \
|
||||
"From: Jacques Germishuys <jacquesg@striata.com>\n" \
|
||||
"Date: Thu, 10 Apr 2014 10:05:03 +0200\n" \
|
||||
"Subject: [PATCH] Update permissions\n" \
|
||||
"\n" \
|
||||
"---\n" \
|
||||
" file1.txt.renamed | 0\n" \
|
||||
" 1 file changed, 0 insertions(+), 0 deletions(-)\n" \
|
||||
" mode change 100644 => 100755 file1.txt.renamed\n" \
|
||||
"\n" \
|
||||
"diff --git a/file1.txt.renamed b/file1.txt.renamed\n" \
|
||||
"old mode 100644\n" \
|
||||
"new mode 100755\n" \
|
||||
"--\n" \
|
||||
"libgit2 " LIBGIT2_VERSION "\n" \
|
||||
"\n";
|
||||
|
||||
assert_email_match(expected, "7ade76dd34bba4733cf9878079f9fd4a456a9189", NULL);
|
||||
}
|
||||
|
||||
void test_email_create__rename(void)
|
||||
{
|
||||
const char *expected =
|
||||
"From 6e05acc5a5dab507d91a0a0cc0fb05a3dd98892d Mon Sep 17 00:00:00 2001\n" \
|
||||
"From: Jacques Germishuys <jacquesg@striata.com>\n" \
|
||||
"Date: Wed, 9 Apr 2014 21:15:56 +0200\n" \
|
||||
"Subject: [PATCH] Renamed file1.txt -> file1.txt.renamed\n" \
|
||||
"\n" \
|
||||
"---\n" \
|
||||
" file1.txt => file1.txt.renamed | 4 ++--\n" \
|
||||
" 1 file changed, 2 insertions(+), 2 deletions(-)\n" \
|
||||
"\n" \
|
||||
"diff --git a/file1.txt b/file1.txt.renamed\n" \
|
||||
"similarity index 86%\n" \
|
||||
"rename from file1.txt\n" \
|
||||
"rename to file1.txt.renamed\n" \
|
||||
"index af8f41d..a97157a 100644\n" \
|
||||
"--- a/file1.txt\n" \
|
||||
"+++ b/file1.txt.renamed\n" \
|
||||
"@@ -3,13 +3,13 @@ file1.txt\n" \
|
||||
" _file1.txt_\n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"+file1.txt_renamed\n" \
|
||||
" file1.txt\n" \
|
||||
" \n" \
|
||||
" \n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"+file1.txt_renamed\n" \
|
||||
" file1.txt\n" \
|
||||
" file1.txt\n" \
|
||||
" _file1.txt_\n" \
|
||||
"--\n" \
|
||||
"libgit2 " LIBGIT2_VERSION "\n" \
|
||||
"\n";
|
||||
|
||||
assert_email_match(expected, "6e05acc5a5dab507d91a0a0cc0fb05a3dd98892d", NULL);
|
||||
}
|
||||
|
||||
void test_email_create__rename_as_add_delete(void)
|
||||
{
|
||||
const char *expected =
|
||||
"From 6e05acc5a5dab507d91a0a0cc0fb05a3dd98892d Mon Sep 17 00:00:00 2001\n" \
|
||||
"From: Jacques Germishuys <jacquesg@striata.com>\n" \
|
||||
"Date: Wed, 9 Apr 2014 21:15:56 +0200\n" \
|
||||
"Subject: [PATCH] Renamed file1.txt -> file1.txt.renamed\n" \
|
||||
"\n" \
|
||||
"---\n" \
|
||||
" file1.txt | 17 -----------------\n" \
|
||||
" file1.txt.renamed | 17 +++++++++++++++++\n" \
|
||||
" 2 files changed, 17 insertions(+), 17 deletions(-)\n" \
|
||||
" delete mode 100644 file1.txt\n" \
|
||||
" create mode 100644 file1.txt.renamed\n" \
|
||||
"\n" \
|
||||
"diff --git a/file1.txt b/file1.txt\n" \
|
||||
"deleted file mode 100644\n" \
|
||||
"index af8f41d..0000000\n" \
|
||||
"--- a/file1.txt\n" \
|
||||
"+++ /dev/null\n" \
|
||||
"@@ -1,17 +0,0 @@\n" \
|
||||
"-file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"-_file1.txt_\n" \
|
||||
"-file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"-\n" \
|
||||
"-\n" \
|
||||
"-file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"-file1.txt\n" \
|
||||
"-_file1.txt_\n" \
|
||||
"-_file1.txt_\n" \
|
||||
"-file1.txt\n" \
|
||||
"diff --git a/file1.txt.renamed b/file1.txt.renamed\n" \
|
||||
"new file mode 100644\n" \
|
||||
"index 0000000..a97157a\n" \
|
||||
"--- /dev/null\n" \
|
||||
"+++ b/file1.txt.renamed\n" \
|
||||
"@@ -0,0 +1,17 @@\n" \
|
||||
"+file1.txt\n" \
|
||||
"+file1.txt\n" \
|
||||
"+_file1.txt_\n" \
|
||||
"+file1.txt\n" \
|
||||
"+file1.txt\n" \
|
||||
"+file1.txt_renamed\n" \
|
||||
"+file1.txt\n" \
|
||||
"+\n" \
|
||||
"+\n" \
|
||||
"+file1.txt\n" \
|
||||
"+file1.txt\n" \
|
||||
"+file1.txt_renamed\n" \
|
||||
"+file1.txt\n" \
|
||||
"+file1.txt\n" \
|
||||
"+_file1.txt_\n" \
|
||||
"+_file1.txt_\n" \
|
||||
"+file1.txt\n" \
|
||||
"--\n" \
|
||||
"libgit2 " LIBGIT2_VERSION "\n" \
|
||||
"\n";
|
||||
|
||||
git_email_create_options opts = GIT_EMAIL_CREATE_OPTIONS_INIT;
|
||||
opts.flags |= GIT_EMAIL_CREATE_NO_RENAMES;
|
||||
|
||||
assert_email_match(expected, "6e05acc5a5dab507d91a0a0cc0fb05a3dd98892d", &opts);
|
||||
}
|
||||
|
||||
void test_email_create__binary(void)
|
||||
{
|
||||
const char *expected =
|
||||
"From 8d7523f6fcb2404257889abe0d96f093d9f524f9 Mon Sep 17 00:00:00 2001\n" \
|
||||
"From: Jacques Germishuys <jacquesg@striata.com>\n" \
|
||||
"Date: Sun, 13 Apr 2014 18:10:18 +0200\n" \
|
||||
"Subject: [PATCH] Modified binary file\n" \
|
||||
"\n" \
|
||||
"---\n" \
|
||||
" binary.bin | Bin 3 -> 5 bytes\n" \
|
||||
" 1 file changed, 0 insertions(+), 0 deletions(-)\n" \
|
||||
"\n" \
|
||||
"diff --git a/binary.bin b/binary.bin\n" \
|
||||
"index bd474b2519cc15eab801ff851cc7d50f0dee49a1..9ac35ff15cd8864aeafd889e4826a3150f0b06c4 100644\n" \
|
||||
"GIT binary patch\n" \
|
||||
"literal 5\n" \
|
||||
"Mc${NkU}WL~000&M4gdfE\n" \
|
||||
"\n" \
|
||||
"literal 3\n" \
|
||||
"Kc${Nk-~s>u4FC%O\n" \
|
||||
"\n" \
|
||||
"--\n" \
|
||||
"libgit2 " LIBGIT2_VERSION "\n" \
|
||||
"\n";
|
||||
|
||||
assert_email_match(expected, "8d7523f6fcb2404257889abe0d96f093d9f524f9", NULL);
|
||||
}
|
||||
|
||||
void test_email_create__binary_not_included(void)
|
||||
{
|
||||
const char *expected =
|
||||
"From 8d7523f6fcb2404257889abe0d96f093d9f524f9 Mon Sep 17 00:00:00 2001\n" \
|
||||
"From: Jacques Germishuys <jacquesg@striata.com>\n" \
|
||||
"Date: Sun, 13 Apr 2014 18:10:18 +0200\n" \
|
||||
"Subject: [PATCH] Modified binary file\n" \
|
||||
"\n" \
|
||||
"---\n" \
|
||||
" binary.bin | Bin 3 -> 5 bytes\n" \
|
||||
" 1 file changed, 0 insertions(+), 0 deletions(-)\n" \
|
||||
"\n" \
|
||||
"diff --git a/binary.bin b/binary.bin\n" \
|
||||
"index bd474b2..9ac35ff 100644\n" \
|
||||
"Binary files a/binary.bin and b/binary.bin differ\n" \
|
||||
"--\n" \
|
||||
"libgit2 " LIBGIT2_VERSION "\n" \
|
||||
"\n";
|
||||
|
||||
git_email_create_options opts = GIT_EMAIL_CREATE_OPTIONS_INIT;
|
||||
opts.diff_opts.flags &= ~GIT_DIFF_SHOW_BINARY;
|
||||
|
||||
assert_email_match(expected, "8d7523f6fcb2404257889abe0d96f093d9f524f9", &opts);
|
||||
}
|
||||
|
||||
void test_email_create__commit_subjects(void)
|
||||
{
|
||||
git_email_create_options opts = GIT_EMAIL_CREATE_OPTIONS_INIT;
|
||||
|
||||
assert_subject_match("[PATCH] Modify some content", "9264b96c6d104d0e07ae33d3007b6a48246c6f92", &opts);
|
||||
|
||||
opts.reroll_number = 42;
|
||||
assert_subject_match("[PATCH v42] Modify some content", "9264b96c6d104d0e07ae33d3007b6a48246c6f92", &opts);
|
||||
|
||||
opts.flags |= GIT_EMAIL_CREATE_ALWAYS_NUMBER;
|
||||
assert_subject_match("[PATCH v42 1/1] Modify some content", "9264b96c6d104d0e07ae33d3007b6a48246c6f92", &opts);
|
||||
|
||||
opts.start_number = 9;
|
||||
assert_subject_match("[PATCH v42 9/9] Modify some content", "9264b96c6d104d0e07ae33d3007b6a48246c6f92", &opts);
|
||||
|
||||
opts.subject_prefix = "";
|
||||
assert_subject_match("[v42 9/9] Modify some content", "9264b96c6d104d0e07ae33d3007b6a48246c6f92", &opts);
|
||||
|
||||
opts.reroll_number = 0;
|
||||
assert_subject_match("[9/9] Modify some content", "9264b96c6d104d0e07ae33d3007b6a48246c6f92", &opts);
|
||||
|
||||
opts.start_number = 0;
|
||||
assert_subject_match("[1/1] Modify some content", "9264b96c6d104d0e07ae33d3007b6a48246c6f92", &opts);
|
||||
|
||||
opts.flags = GIT_EMAIL_CREATE_OMIT_NUMBERS;
|
||||
assert_subject_match("Modify some content", "9264b96c6d104d0e07ae33d3007b6a48246c6f92", &opts);
|
||||
}
|
||||
@@ -408,7 +408,7 @@ static bool found_master;
|
||||
static bool found_haacked;
|
||||
static bool find_master_haacked_called;
|
||||
|
||||
int find_master_haacked(const char *ref_name, const char *remote_url, const git_oid *oid, unsigned int is_merge, void *payload)
|
||||
static int find_master_haacked(const char *ref_name, const char *remote_url, const git_oid *oid, unsigned int is_merge, void *payload)
|
||||
{
|
||||
GIT_UNUSED(remote_url);
|
||||
GIT_UNUSED(oid);
|
||||
@@ -466,7 +466,7 @@ struct prefix_count {
|
||||
int expected;
|
||||
};
|
||||
|
||||
int count_refs(const char *ref_name, const char *remote_url, const git_oid *oid, unsigned int is_merge, void *payload)
|
||||
static int count_refs(const char *ref_name, const char *remote_url, const git_oid *oid, unsigned int is_merge, void *payload)
|
||||
{
|
||||
int i;
|
||||
struct prefix_count *prefix_counts = (struct prefix_count *) payload;
|
||||
|
||||
@@ -128,7 +128,7 @@ git_filter *create_reverse_filter(const char *attrs)
|
||||
return filter;
|
||||
}
|
||||
|
||||
int erroneous_filter_stream(
|
||||
static int erroneous_filter_stream(
|
||||
git_writestream **out,
|
||||
git_filter *self,
|
||||
void **payload,
|
||||
|
||||
@@ -55,19 +55,19 @@ struct buf_writestream {
|
||||
git_str buf;
|
||||
};
|
||||
|
||||
int buf_writestream_write(git_writestream *s, const char *buf, size_t len)
|
||||
static int buf_writestream_write(git_writestream *s, const char *buf, size_t len)
|
||||
{
|
||||
struct buf_writestream *stream = (struct buf_writestream *)s;
|
||||
return git_str_put(&stream->buf, buf, len);
|
||||
}
|
||||
|
||||
int buf_writestream_close(git_writestream *s)
|
||||
static int buf_writestream_close(git_writestream *s)
|
||||
{
|
||||
GIT_UNUSED(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void buf_writestream_free(git_writestream *s)
|
||||
static void buf_writestream_free(git_writestream *s)
|
||||
{
|
||||
struct buf_writestream *stream = (struct buf_writestream *)s;
|
||||
git_str_dispose(&stream->buf);
|
||||
|
||||
@@ -328,7 +328,7 @@ int merge_test_reuc(git_index *index, const struct merge_reuc_entry expected[],
|
||||
return 1;
|
||||
}
|
||||
|
||||
int dircount(void *payload, git_str *pathbuf)
|
||||
static int dircount(void *payload, git_str *pathbuf)
|
||||
{
|
||||
size_t *entries = payload;
|
||||
size_t len = git_str_len(pathbuf);
|
||||
|
||||
@@ -108,7 +108,7 @@ void test_network_fetchlocal__prune(void)
|
||||
git_repository_free(repo);
|
||||
}
|
||||
|
||||
int update_tips_fail_on_call(const char *ref, const git_oid *old, const git_oid *new, void *data)
|
||||
static int update_tips_fail_on_call(const char *ref, const git_oid *old, const git_oid *new, void *data)
|
||||
{
|
||||
GIT_UNUSED(ref);
|
||||
GIT_UNUSED(old);
|
||||
@@ -119,7 +119,7 @@ int update_tips_fail_on_call(const char *ref, const git_oid *old, const git_oid
|
||||
return 0;
|
||||
}
|
||||
|
||||
void assert_ref_exists(git_repository *repo, const char *name)
|
||||
static void assert_ref_exists(git_repository *repo, const char *name)
|
||||
{
|
||||
git_reference *ref;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ void test_network_remote_push__cleanup(void)
|
||||
cl_fixture_cleanup("dummy.git");
|
||||
}
|
||||
|
||||
int negotiation_cb(const git_push_update **updates, size_t len, void *payload)
|
||||
static int negotiation_cb(const git_push_update **updates, size_t len, void *payload)
|
||||
{
|
||||
const git_push_update *expected = payload;
|
||||
|
||||
@@ -69,7 +69,7 @@ void test_network_remote_push__delete_notification(void)
|
||||
|
||||
}
|
||||
|
||||
void create_dummy_commit(git_reference **out, git_repository *repo)
|
||||
static void create_dummy_commit(git_reference **out, git_repository *repo)
|
||||
{
|
||||
git_index *index;
|
||||
git_oid tree_id, commit_id;
|
||||
|
||||
@@ -103,7 +103,7 @@ static int note_list_create_cb(
|
||||
return 0;
|
||||
}
|
||||
|
||||
void assert_notes_seen(struct note_create_payload payload[], size_t n)
|
||||
static void assert_notes_seen(struct note_create_payload payload[], size_t n)
|
||||
{
|
||||
size_t seen = 0, i;
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ void test_object_tag_write__deleting_with_an_invalid_name_returns_EINVALIDSPEC(v
|
||||
cl_assert_equal_i(GIT_EINVALIDSPEC, git_tag_delete(g_repo, "Inv@{id"));
|
||||
}
|
||||
|
||||
void create_annotation(git_oid *tag_id, const char *name)
|
||||
static void create_annotation(git_oid *tag_id, const char *name)
|
||||
{
|
||||
git_object *target;
|
||||
git_oid target_id;
|
||||
|
||||
@@ -187,7 +187,7 @@ void test_odb_loose__read_header(void)
|
||||
test_read_header(&some);
|
||||
}
|
||||
|
||||
void test_write_object_permission(
|
||||
static void test_write_object_permission(
|
||||
mode_t dir_mode, mode_t file_mode,
|
||||
mode_t expected_dir_mode, mode_t expected_file_mode)
|
||||
{
|
||||
|
||||
@@ -361,7 +361,7 @@ void test_online_clone__cred_callback_called_again_on_auth_failure(void)
|
||||
cl_assert_equal_i(3, counter);
|
||||
}
|
||||
|
||||
int cred_default(
|
||||
static int cred_default(
|
||||
git_credential **cred,
|
||||
const char *url,
|
||||
const char *user_from_url,
|
||||
@@ -618,7 +618,7 @@ void test_online_clone__ssh_cannot_change_username(void)
|
||||
cl_git_fail(git_clone(&g_repo, "ssh://git@github.com/libgit2/TestGitRepository", "./foo", &g_options));
|
||||
}
|
||||
|
||||
int ssh_certificate_check(git_cert *cert, int valid, const char *host, void *payload)
|
||||
static int ssh_certificate_check(git_cert *cert, int valid, const char *host, void *payload)
|
||||
{
|
||||
git_cert_hostkey *key;
|
||||
git_oid expected = {{0}}, actual = {{0}};
|
||||
|
||||
@@ -10,7 +10,7 @@ void updated_tip_free(updated_tip *t)
|
||||
git__free(t);
|
||||
}
|
||||
|
||||
void push_status_free(push_status *s)
|
||||
static void push_status_free(push_status *s)
|
||||
{
|
||||
git__free(s->ref);
|
||||
git__free(s->msg);
|
||||
|
||||
@@ -47,7 +47,7 @@ void test_pack_filelimit__cleanup(void)
|
||||
* (README.md) has the same content in all commits, but the second one
|
||||
* (file.txt) has a different content in each commit.
|
||||
*/
|
||||
void create_packfile_commit(
|
||||
static void create_packfile_commit(
|
||||
git_repository *repo,
|
||||
git_oid *out_commit_id,
|
||||
git_oid *parent_id,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* and then print a variety of patch files.
|
||||
*/
|
||||
|
||||
void patch_print_from_patchfile(const char *data, size_t len)
|
||||
static void patch_print_from_patchfile(const char *data, size_t len)
|
||||
{
|
||||
git_patch *patch;
|
||||
git_buf buf = GIT_BUF_INIT;
|
||||
|
||||
@@ -120,7 +120,7 @@ void test_path_dotgit__dotgit_modules_symlink(void)
|
||||
cl_assert_equal_b(false, git_path_is_valid(NULL, ".gitmodules . .::$DATA", S_IFLNK, GIT_PATH_REJECT_DOT_GIT_NTFS));
|
||||
}
|
||||
|
||||
void test_core_path__git_fs_path_is_file(void)
|
||||
void test_path_dotgit__git_fs_path_is_file(void)
|
||||
{
|
||||
cl_git_fail(git_path_is_gitfile("blob", 4, -1, GIT_PATH_FS_HFS));
|
||||
cl_git_pass(git_path_is_gitfile("blob", 4, GIT_PATH_GITFILE_GITIGNORE, GIT_PATH_FS_HFS));
|
||||
|
||||
@@ -6,35 +6,27 @@
|
||||
#include "win32/path_w32.h"
|
||||
#endif
|
||||
|
||||
void test_utf8_to_utf16(const char *utf8_in, const wchar_t *utf16_expected)
|
||||
{
|
||||
#ifdef GIT_WIN32
|
||||
static void test_utf8_to_utf16(const char *utf8_in, const wchar_t *utf16_expected)
|
||||
{
|
||||
git_win32_path path_utf16;
|
||||
int path_utf16len;
|
||||
|
||||
cl_assert((path_utf16len = git_win32_path_from_utf8(path_utf16, utf8_in)) >= 0);
|
||||
cl_assert_equal_wcs(utf16_expected, path_utf16);
|
||||
cl_assert_equal_i(wcslen(utf16_expected), path_utf16len);
|
||||
#else
|
||||
GIT_UNUSED(utf8_in);
|
||||
GIT_UNUSED(utf16_expected);
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_utf8_to_utf16_relative(const char* utf8_in, const wchar_t* utf16_expected)
|
||||
static void test_utf8_to_utf16_relative(const char* utf8_in, const wchar_t* utf16_expected)
|
||||
{
|
||||
#ifdef GIT_WIN32
|
||||
git_win32_path path_utf16;
|
||||
int path_utf16len;
|
||||
|
||||
cl_assert((path_utf16len = git_win32_path_relative_from_utf8(path_utf16, utf8_in)) >= 0);
|
||||
cl_assert_equal_wcs(utf16_expected, path_utf16);
|
||||
cl_assert_equal_i(wcslen(utf16_expected), path_utf16len);
|
||||
#else
|
||||
GIT_UNUSED(utf8_in);
|
||||
GIT_UNUSED(utf16_expected);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void test_path_win32__utf8_to_utf16(void)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ static void test_operations(git_rebase *rebase, size_t expected_current)
|
||||
}
|
||||
}
|
||||
|
||||
void test_iterator(bool inmemory)
|
||||
static void test_iterator(bool inmemory)
|
||||
{
|
||||
git_rebase *rebase;
|
||||
git_rebase_options opts = GIT_REBASE_OPTIONS_INIT;
|
||||
|
||||
@@ -729,7 +729,7 @@ void test_rebase_merge__copy_notes_disabled_in_config(void)
|
||||
test_copy_note(NULL, 0);
|
||||
}
|
||||
|
||||
void rebase_checkout_progress_cb(
|
||||
static void rebase_checkout_progress_cb(
|
||||
const char *path,
|
||||
size_t completed_steps,
|
||||
size_t total_steps,
|
||||
|
||||
@@ -86,7 +86,7 @@ committer Rebaser <rebaser@rebaser.rb> 1405694510 +0000\n";
|
||||
git_rebase_free(rebase);
|
||||
}
|
||||
|
||||
int create_cb_signed_gpg(
|
||||
static int create_cb_signed_gpg(
|
||||
git_oid *out,
|
||||
const git_signature *author,
|
||||
const git_signature *committer,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "repository.h"
|
||||
|
||||
void assert_shorthand(git_repository *repo, const char *refname, const char *shorthand)
|
||||
static void assert_shorthand(git_repository *repo, const char *refname, const char *shorthand)
|
||||
{
|
||||
git_reference *ref;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ void test_remote_fetch__cleanup(void) {
|
||||
* @param force Whether to use a spec with '+' prefixed to force the refs
|
||||
* to update
|
||||
*/
|
||||
void do_time_travelling_fetch(git_oid *commit1id, git_oid *commit2id,
|
||||
static void do_time_travelling_fetch(git_oid *commit1id, git_oid *commit2id,
|
||||
bool force) {
|
||||
char *refspec_strs = {
|
||||
force ? FORCE_FETCHSPEC : NON_FORCE_FETCHSPEC,
|
||||
|
||||
@@ -40,7 +40,7 @@ void test_remote_httpproxy__cleanup(void)
|
||||
cl_git_sandbox_cleanup();
|
||||
}
|
||||
|
||||
void assert_proxy_is(const char *expected)
|
||||
static void assert_proxy_is(const char *expected)
|
||||
{
|
||||
git_remote *remote;
|
||||
char *proxy;
|
||||
@@ -57,7 +57,7 @@ void assert_proxy_is(const char *expected)
|
||||
git__free(proxy);
|
||||
}
|
||||
|
||||
void assert_config_match(const char *config, const char *expected)
|
||||
static void assert_config_match(const char *config, const char *expected)
|
||||
{
|
||||
git_remote *remote;
|
||||
char *proxy;
|
||||
@@ -106,7 +106,7 @@ void test_remote_httpproxy__config_empty_overrides(void)
|
||||
assert_config_match("remote.lg2.proxy", "");
|
||||
}
|
||||
|
||||
void assert_global_config_match(const char *config, const char *expected)
|
||||
static void assert_global_config_match(const char *config, const char *expected)
|
||||
{
|
||||
git_remote *remote;
|
||||
char *proxy;
|
||||
|
||||
@@ -316,7 +316,7 @@ struct seen_paths {
|
||||
bool when;
|
||||
};
|
||||
|
||||
int checkout_notify(
|
||||
static int checkout_notify(
|
||||
git_checkout_notify_t why,
|
||||
const char *path,
|
||||
const git_diff_file *baseline,
|
||||
@@ -368,7 +368,7 @@ void test_stash_apply__executes_notify_cb(void)
|
||||
cl_assert_equal_b(true, seen_paths.when);
|
||||
}
|
||||
|
||||
int progress_cb(
|
||||
static int progress_cb(
|
||||
git_stash_apply_progress_t progress,
|
||||
void *payload)
|
||||
{
|
||||
@@ -393,7 +393,7 @@ void test_stash_apply__calls_progress_cb(void)
|
||||
cl_assert_equal_i(progress, GIT_STASH_APPLY_PROGRESS_DONE);
|
||||
}
|
||||
|
||||
int aborting_progress_cb(
|
||||
static int aborting_progress_cb(
|
||||
git_stash_apply_progress_t progress,
|
||||
void *payload)
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ void test_stash_drop__dropping_the_last_entry_removes_the_stash(void)
|
||||
git_reference_lookup(&stash, repo, GIT_REFS_STASH_FILE), GIT_ENOTFOUND);
|
||||
}
|
||||
|
||||
void retrieve_top_stash_id(git_oid *out)
|
||||
static void retrieve_top_stash_id(git_oid *out)
|
||||
{
|
||||
git_object *top_stash;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ void test_status_worktree__whole_repository(void)
|
||||
cl_assert_equal_i(0, counts.wrong_sorted_path);
|
||||
}
|
||||
|
||||
void assert_show(
|
||||
static void assert_show(
|
||||
const int entry_counts,
|
||||
const char *entry_paths[],
|
||||
const unsigned int entry_statuses[],
|
||||
|
||||
@@ -128,7 +128,7 @@ void test_submodule_modify__sync(void)
|
||||
git_submodule_free(sm3);
|
||||
}
|
||||
|
||||
void assert_ignore_change(git_submodule_ignore_t ignore)
|
||||
static void assert_ignore_change(git_submodule_ignore_t ignore)
|
||||
{
|
||||
git_submodule *sm;
|
||||
|
||||
@@ -146,7 +146,7 @@ void test_submodule_modify__set_ignore(void)
|
||||
assert_ignore_change(GIT_SUBMODULE_IGNORE_ALL);
|
||||
}
|
||||
|
||||
void assert_update_change(git_submodule_update_t update)
|
||||
static void assert_update_change(git_submodule_update_t update)
|
||||
{
|
||||
git_submodule *sm;
|
||||
|
||||
@@ -164,7 +164,7 @@ void test_submodule_modify__set_update(void)
|
||||
assert_update_change(GIT_SUBMODULE_UPDATE_CHECKOUT);
|
||||
}
|
||||
|
||||
void assert_recurse_change(git_submodule_recurse_t recurse)
|
||||
static void assert_recurse_change(git_submodule_recurse_t recurse)
|
||||
{
|
||||
git_submodule *sm;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user