Unnamed: 0
int64 0
0
| repo_id
stringlengths 5
186
| file_path
stringlengths 15
223
| content
stringlengths 1
32.8M
⌀ |
---|---|---|---|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/trace/trace.c
|
#include "clar_libgit2.h"
#include "clar_libgit2_trace.h"
#include "trace.h"
static int written = 0;
static void trace_callback(git_trace_level_t level, const char *message)
{
GIT_UNUSED(level);
cl_assert(strcmp(message, "Hello world!") == 0);
written = 1;
}
void test_trace_trace__initialize(void)
{
/* If global tracing is enabled, disable for the duration of this test. */
cl_global_trace_disable();
git_trace_set(GIT_TRACE_INFO, trace_callback);
written = 0;
}
void test_trace_trace__cleanup(void)
{
git_trace_set(GIT_TRACE_NONE, NULL);
/* If global tracing was enabled, restart it. */
cl_global_trace_register();
}
void test_trace_trace__sets(void)
{
#ifdef GIT_TRACE
cl_assert(git_trace_level() == GIT_TRACE_INFO);
#else
cl_skip();
#endif
}
void test_trace_trace__can_reset(void)
{
#ifdef GIT_TRACE
cl_assert(git_trace_level() == GIT_TRACE_INFO);
cl_git_pass(git_trace_set(GIT_TRACE_ERROR, trace_callback));
cl_assert(written == 0);
git_trace(GIT_TRACE_INFO, "Hello %s!", "world");
cl_assert(written == 0);
git_trace(GIT_TRACE_ERROR, "Hello %s!", "world");
cl_assert(written == 1);
#else
cl_skip();
#endif
}
void test_trace_trace__can_unset(void)
{
#ifdef GIT_TRACE
cl_assert(git_trace_level() == GIT_TRACE_INFO);
cl_git_pass(git_trace_set(GIT_TRACE_NONE, NULL));
cl_assert(git_trace_level() == GIT_TRACE_NONE);
cl_assert(written == 0);
git_trace(GIT_TRACE_FATAL, "Hello %s!", "world");
cl_assert(written == 0);
#else
cl_skip();
#endif
}
void test_trace_trace__skips_higher_level(void)
{
#ifdef GIT_TRACE
cl_assert(written == 0);
git_trace(GIT_TRACE_DEBUG, "Hello %s!", "world");
cl_assert(written == 0);
#else
cl_skip();
#endif
}
void test_trace_trace__writes(void)
{
#ifdef GIT_TRACE
cl_assert(written == 0);
git_trace(GIT_TRACE_INFO, "Hello %s!", "world");
cl_assert(written == 1);
#else
cl_skip();
#endif
}
void test_trace_trace__writes_lower_level(void)
{
#ifdef GIT_TRACE
cl_assert(written == 0);
git_trace(GIT_TRACE_ERROR, "Hello %s!", "world");
cl_assert(written == 1);
#else
cl_skip();
#endif
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/trace
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/trace/windows/stacktrace.c
|
#include "clar_libgit2.h"
#include "win32/w32_leakcheck.h"
#if defined(GIT_WIN32_LEAKCHECK)
static void a(void)
{
char buf[10000];
cl_assert(git_win32_leakcheck_stack(buf, sizeof(buf), 0, NULL, NULL) == 0);
#if 0
fprintf(stderr, "Stacktrace from [%s:%d]:\n%s\n", __FILE__, __LINE__, buf);
#endif
}
static void b(void)
{
a();
}
static void c(void)
{
b();
}
#endif
void test_trace_windows_stacktrace__basic(void)
{
#if defined(GIT_WIN32_LEAKCHECK)
c();
#endif
}
void test_trace_windows_stacktrace__leaks(void)
{
#if defined(GIT_WIN32_LEAKCHECK)
void * p1;
void * p2;
void * p3;
void * p4;
int before, after;
int leaks;
int error;
/* remember outstanding leaks due to set setup
* and set mark/checkpoint.
*/
before = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_QUIET |
GIT_WIN32_LEAKCHECK_STACKTRACE_LEAKS_TOTAL |
GIT_WIN32_LEAKCHECK_STACKTRACE_SET_MARK,
NULL);
p1 = git__malloc(5);
leaks = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_QUIET |
GIT_WIN32_LEAKCHECK_STACKTRACE_LEAKS_SINCE_MARK,
"p1");
cl_assert_equal_i(1, leaks);
p2 = git__malloc(5);
leaks = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_QUIET |
GIT_WIN32_LEAKCHECK_STACKTRACE_LEAKS_SINCE_MARK,
"p1,p2");
cl_assert_equal_i(2, leaks);
p3 = git__malloc(5);
leaks = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_QUIET |
GIT_WIN32_LEAKCHECK_STACKTRACE_LEAKS_SINCE_MARK,
"p1,p2,p3");
cl_assert_equal_i(3, leaks);
git__free(p2);
leaks = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_QUIET |
GIT_WIN32_LEAKCHECK_STACKTRACE_LEAKS_SINCE_MARK,
"p1,p3");
cl_assert_equal_i(2, leaks);
/* move the mark. only new leaks should appear afterwards */
error = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_SET_MARK,
NULL);
/* cannot use cl_git_pass() since that may allocate memory. */
cl_assert_equal_i(0, error);
leaks = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_QUIET |
GIT_WIN32_LEAKCHECK_STACKTRACE_LEAKS_SINCE_MARK,
"not_p1,not_p3");
cl_assert_equal_i(0, leaks);
p4 = git__malloc(5);
leaks = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_QUIET |
GIT_WIN32_LEAKCHECK_STACKTRACE_LEAKS_SINCE_MARK,
"p4,not_p1,not_p3");
cl_assert_equal_i(1, leaks);
git__free(p1);
git__free(p3);
leaks = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_QUIET |
GIT_WIN32_LEAKCHECK_STACKTRACE_LEAKS_SINCE_MARK,
"p4");
cl_assert_equal_i(1, leaks);
git__free(p4);
leaks = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_QUIET |
GIT_WIN32_LEAKCHECK_STACKTRACE_LEAKS_SINCE_MARK,
"end");
cl_assert_equal_i(0, leaks);
/* confirm current absolute leaks count matches beginning value. */
after = git_win32_leakcheck_stacktrace_dump(
GIT_WIN32_LEAKCHECK_STACKTRACE_QUIET |
GIT_WIN32_LEAKCHECK_STACKTRACE_LEAKS_TOTAL,
"total");
cl_assert_equal_i(before, after);
#endif
}
#if defined(GIT_WIN32_LEAKCHECK)
static void aux_cb_alloc__1(unsigned int *aux_id)
{
static unsigned int aux_counter = 0;
*aux_id = aux_counter++;
}
static void aux_cb_lookup__1(unsigned int aux_id, char *aux_msg, size_t aux_msg_len)
{
p_snprintf(aux_msg, aux_msg_len, "\tQQ%08x\n", aux_id);
}
#endif
void test_trace_windows_stacktrace__aux1(void)
{
#if defined(GIT_WIN32_LEAKCHECK)
git_win32_leakcheck_stack_set_aux_cb(aux_cb_alloc__1, aux_cb_lookup__1);
c();
c();
c();
c();
git_win32_leakcheck_stack_set_aux_cb(NULL, NULL);
#endif
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/attr/attr_expect.h
|
#ifndef __CLAR_TEST_ATTR_EXPECT__
#define __CLAR_TEST_ATTR_EXPECT__
enum attr_expect_t {
EXPECT_FALSE,
EXPECT_TRUE,
EXPECT_UNDEFINED,
EXPECT_STRING
};
struct attr_expected {
const char *path;
const char *attr;
enum attr_expect_t expected;
const char *expected_str;
};
GIT_INLINE(void) attr_check_expected(
enum attr_expect_t expected,
const char *expected_str,
const char *name,
const char *value)
{
switch (expected) {
case EXPECT_TRUE:
cl_assert_(GIT_ATTR_IS_TRUE(value), name);
break;
case EXPECT_FALSE:
cl_assert_(GIT_ATTR_IS_FALSE(value), name);
break;
case EXPECT_UNDEFINED:
cl_assert_(GIT_ATTR_IS_UNSPECIFIED(value), name);
break;
case EXPECT_STRING:
cl_assert_equal_s(expected_str, value);
break;
}
}
#endif
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/attr/repo.c
|
#include "clar_libgit2.h"
#include "futils.h"
#include "git2/attr.h"
#include "attr.h"
#include "sysdir.h"
#include "attr_expect.h"
#include "git2/sys/repository.h"
static git_repository *g_repo = NULL;
void test_attr_repo__initialize(void)
{
g_repo = cl_git_sandbox_init("attr");
}
void test_attr_repo__cleanup(void)
{
cl_git_sandbox_cleanup();
g_repo = NULL;
cl_sandbox_set_search_path_defaults();
}
static struct attr_expected get_one_test_cases[] = {
{ "root_test1", "repoattr", EXPECT_TRUE, NULL },
{ "root_test1", "rootattr", EXPECT_TRUE, NULL },
{ "root_test1", "missingattr", EXPECT_UNDEFINED, NULL },
{ "root_test1", "subattr", EXPECT_UNDEFINED, NULL },
{ "root_test1", "negattr", EXPECT_UNDEFINED, NULL },
{ "root_test2", "repoattr", EXPECT_TRUE, NULL },
{ "root_test2", "rootattr", EXPECT_FALSE, NULL },
{ "root_test2", "missingattr", EXPECT_UNDEFINED, NULL },
{ "root_test2", "multiattr", EXPECT_FALSE, NULL },
{ "root_test3", "repoattr", EXPECT_TRUE, NULL },
{ "root_test3", "rootattr", EXPECT_UNDEFINED, NULL },
{ "root_test3", "multiattr", EXPECT_STRING, "3" },
{ "root_test3", "multi2", EXPECT_UNDEFINED, NULL },
{ "sub/subdir_test1", "repoattr", EXPECT_TRUE, NULL },
{ "sub/subdir_test1", "rootattr", EXPECT_TRUE, NULL },
{ "sub/subdir_test1", "missingattr", EXPECT_UNDEFINED, NULL },
{ "sub/subdir_test1", "subattr", EXPECT_STRING, "yes" },
{ "sub/subdir_test1", "negattr", EXPECT_FALSE, NULL },
{ "sub/subdir_test1", "another", EXPECT_UNDEFINED, NULL },
{ "sub/subdir_test2.txt", "repoattr", EXPECT_TRUE, NULL },
{ "sub/subdir_test2.txt", "rootattr", EXPECT_TRUE, NULL },
{ "sub/subdir_test2.txt", "missingattr", EXPECT_UNDEFINED, NULL },
{ "sub/subdir_test2.txt", "subattr", EXPECT_STRING, "yes" },
{ "sub/subdir_test2.txt", "negattr", EXPECT_FALSE, NULL },
{ "sub/subdir_test2.txt", "another", EXPECT_STRING, "zero" },
{ "sub/subdir_test2.txt", "reposub", EXPECT_TRUE, NULL },
{ "sub/sub/subdir.txt", "another", EXPECT_STRING, "one" },
{ "sub/sub/subdir.txt", "reposubsub", EXPECT_TRUE, NULL },
{ "sub/sub/subdir.txt", "reposub", EXPECT_UNDEFINED, NULL },
{ "does-not-exist", "foo", EXPECT_STRING, "yes" },
{ "sub/deep/file", "deepdeep", EXPECT_TRUE, NULL },
{ "sub/sub/d/no", "test", EXPECT_STRING, "a/b/d/*" },
{ "sub/sub/d/yes", "test", EXPECT_UNDEFINED, NULL },
};
void test_attr_repo__get_one(void)
{
int i;
for (i = 0; i < (int)ARRAY_SIZE(get_one_test_cases); ++i) {
struct attr_expected *scan = &get_one_test_cases[i];
const char *value;
cl_git_pass(git_attr_get(&value, g_repo, 0, scan->path, scan->attr));
attr_check_expected(
scan->expected, scan->expected_str, scan->attr, value);
}
cl_assert(git_attr_cache__is_cached(
g_repo, GIT_ATTR_FILE_SOURCE_FILE, ".git/info/attributes"));
cl_assert(git_attr_cache__is_cached(
g_repo, GIT_ATTR_FILE_SOURCE_FILE, ".gitattributes"));
cl_assert(git_attr_cache__is_cached(
g_repo, GIT_ATTR_FILE_SOURCE_FILE, "sub/.gitattributes"));
}
void test_attr_repo__get_one_start_deep(void)
{
int i;
for (i = (int)ARRAY_SIZE(get_one_test_cases) - 1; i >= 0; --i) {
struct attr_expected *scan = &get_one_test_cases[i];
const char *value;
cl_git_pass(git_attr_get(&value, g_repo, 0, scan->path, scan->attr));
attr_check_expected(
scan->expected, scan->expected_str, scan->attr, value);
}
cl_assert(git_attr_cache__is_cached(
g_repo, GIT_ATTR_FILE_SOURCE_FILE, ".git/info/attributes"));
cl_assert(git_attr_cache__is_cached(
g_repo, GIT_ATTR_FILE_SOURCE_FILE, ".gitattributes"));
cl_assert(git_attr_cache__is_cached(
g_repo, GIT_ATTR_FILE_SOURCE_FILE, "sub/.gitattributes"));
}
void test_attr_repo__get_many(void)
{
const char *names[4] = { "repoattr", "rootattr", "missingattr", "subattr" };
const char *values[4];
cl_git_pass(git_attr_get_many(values, g_repo, 0, "root_test1", 4, names));
cl_assert(GIT_ATTR_IS_TRUE(values[0]));
cl_assert(GIT_ATTR_IS_TRUE(values[1]));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[2]));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[3]));
cl_git_pass(git_attr_get_many(values, g_repo, 0, "root_test2", 4, names));
cl_assert(GIT_ATTR_IS_TRUE(values[0]));
cl_assert(GIT_ATTR_IS_FALSE(values[1]));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[2]));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[3]));
cl_git_pass(git_attr_get_many(values, g_repo, 0, "sub/subdir_test1", 4, names));
cl_assert(GIT_ATTR_IS_TRUE(values[0]));
cl_assert(GIT_ATTR_IS_TRUE(values[1]));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[2]));
cl_assert_equal_s("yes", values[3]);
}
void test_attr_repo__get_many_in_place(void)
{
const char *vals[4] = { "repoattr", "rootattr", "missingattr", "subattr" };
/* it should be legal to look up values into the same array that has
* the attribute names, overwriting each name as the value is found.
*/
cl_git_pass(git_attr_get_many(vals, g_repo, 0, "sub/subdir_test1", 4, vals));
cl_assert(GIT_ATTR_IS_TRUE(vals[0]));
cl_assert(GIT_ATTR_IS_TRUE(vals[1]));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(vals[2]));
cl_assert_equal_s("yes", vals[3]);
}
static int count_attrs(
const char *name,
const char *value,
void *payload)
{
GIT_UNUSED(name);
GIT_UNUSED(value);
*((int *)payload) += 1;
return 0;
}
#define CANCEL_VALUE 12345
static int cancel_iteration(
const char *name,
const char *value,
void *payload)
{
GIT_UNUSED(name);
GIT_UNUSED(value);
*((int *)payload) -= 1;
if (*((int *)payload) < 0)
return CANCEL_VALUE;
return 0;
}
void test_attr_repo__foreach(void)
{
int count;
count = 0;
cl_git_pass(git_attr_foreach(
g_repo, 0, "root_test1", &count_attrs, &count));
cl_assert(count == 2);
count = 0;
cl_git_pass(git_attr_foreach(g_repo, 0, "sub/subdir_test1",
&count_attrs, &count));
cl_assert(count == 4); /* repoattr, rootattr, subattr, negattr */
count = 0;
cl_git_pass(git_attr_foreach(g_repo, 0, "sub/subdir_test2.txt",
&count_attrs, &count));
cl_assert(count == 6); /* repoattr, rootattr, subattr, reposub, negattr, another */
count = 2;
cl_assert_equal_i(
CANCEL_VALUE, git_attr_foreach(
g_repo, 0, "sub/subdir_test1", &cancel_iteration, &count)
);
}
void test_attr_repo__manpage_example(void)
{
const char *value;
cl_git_pass(git_attr_get(&value, g_repo, 0, "sub/abc", "foo"));
cl_assert(GIT_ATTR_IS_TRUE(value));
cl_git_pass(git_attr_get(&value, g_repo, 0, "sub/abc", "bar"));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(value));
cl_git_pass(git_attr_get(&value, g_repo, 0, "sub/abc", "baz"));
cl_assert(GIT_ATTR_IS_FALSE(value));
cl_git_pass(git_attr_get(&value, g_repo, 0, "sub/abc", "merge"));
cl_assert_equal_s("filfre", value);
cl_git_pass(git_attr_get(&value, g_repo, 0, "sub/abc", "frotz"));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(value));
}
#define CONTENT "I'm going to be dynamically processed\r\n" \
"And my line endings...\r\n" \
"...are going to be\n" \
"normalized!\r\n"
#define GITATTR "* text=auto\n" \
"*.txt text\n" \
"*.data binary\n"
static void add_to_workdir(const char *filename, const char *content)
{
git_buf buf = GIT_BUF_INIT;
cl_git_pass(git_buf_joinpath(&buf, "attr", filename));
cl_git_rewritefile(git_buf_cstr(&buf), content);
git_buf_dispose(&buf);
}
static void assert_proper_normalization(git_index *index, const char *filename, const char *expected_sha)
{
size_t index_pos;
const git_index_entry *entry;
add_to_workdir(filename, CONTENT);
cl_git_pass(git_index_add_bypath(index, filename));
cl_assert(!git_index_find(&index_pos, index, filename));
entry = git_index_get_byindex(index, index_pos);
cl_assert_equal_i(0, git_oid_streq(&entry->id, expected_sha));
}
void test_attr_repo__staging_properly_normalizes_line_endings_according_to_gitattributes_directives(void)
{
git_index* index;
cl_git_pass(git_repository_index(&index, g_repo));
add_to_workdir(".gitattributes", GITATTR);
assert_proper_normalization(index, "text.txt", "22c74203bace3c2e950278c7ab08da0fca9f4e9b");
assert_proper_normalization(index, "huh.dunno", "22c74203bace3c2e950278c7ab08da0fca9f4e9b");
assert_proper_normalization(index, "binary.data", "66eeff1fcbacf589e6d70aa70edd3fce5be2b37c");
git_index_free(index);
}
void test_attr_repo__bare_repo_with_index(void)
{
const char *names[4] = { "test1", "test2", "test3", "test4" };
const char *values[4];
git_index *index;
cl_git_pass(git_repository_index(&index, g_repo));
cl_git_mkfile(
"attr/.gitattributes",
"*.txt test1 test2=foobar -test3\n"
"trial.txt -test1 test2=barfoo !test3 test4\n");
cl_git_pass(git_index_add_bypath(index, ".gitattributes"));
git_index_free(index);
cl_must_pass(p_unlink("attr/.gitattributes"));
cl_assert(!git_path_exists("attr/.gitattributes"));
cl_git_pass(git_repository_set_bare(g_repo));
cl_git_pass(git_attr_get_many(values, g_repo, 0, "file.txt", 4, names));
cl_assert(GIT_ATTR_IS_TRUE(values[0]));
cl_assert_equal_s("foobar", values[1]);
cl_assert(GIT_ATTR_IS_FALSE(values[2]));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[3]));
cl_git_pass(git_attr_get_many(values, g_repo, 0, "trial.txt", 4, names));
cl_assert(GIT_ATTR_IS_FALSE(values[0]));
cl_assert_equal_s("barfoo", values[1]);
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[2]));
cl_assert(GIT_ATTR_IS_TRUE(values[3]));
cl_git_pass(git_attr_get_many(values, g_repo, 0, "sub/sub/subdir.txt", 4, names));
cl_assert(GIT_ATTR_IS_TRUE(values[0]));
cl_assert_equal_s("foobar", values[1]);
cl_assert(GIT_ATTR_IS_FALSE(values[2]));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[3]));
}
void test_attr_repo__sysdir(void)
{
git_buf sysdir = GIT_BUF_INIT;
const char *value;
cl_git_pass(p_mkdir("system", 0777));
cl_git_rewritefile("system/gitattributes", "file merge=foo");
cl_git_pass(git_buf_joinpath(&sysdir, clar_sandbox_path(), "system"));
cl_git_pass(git_sysdir_set(GIT_SYSDIR_SYSTEM, sysdir.ptr));
g_repo = cl_git_sandbox_reopen();
cl_git_pass(git_attr_get(&value, g_repo, 0, "file", "merge"));
cl_assert_equal_s(value, "foo");
cl_git_pass(p_unlink("system/gitattributes"));
cl_git_pass(p_rmdir("system"));
git_buf_dispose(&sysdir);
}
void test_attr_repo__sysdir_with_session(void)
{
const char *values[2], *attrs[2] = { "foo", "bar" };
git_buf sysdir = GIT_BUF_INIT;
git_attr_session session;
cl_git_pass(p_mkdir("system", 0777));
cl_git_rewritefile("system/gitattributes", "file foo=1 bar=2");
cl_git_pass(git_buf_joinpath(&sysdir, clar_sandbox_path(), "system"));
cl_git_pass(git_sysdir_set(GIT_SYSDIR_SYSTEM, sysdir.ptr));
g_repo = cl_git_sandbox_reopen();
cl_git_pass(git_attr_session__init(&session, g_repo));
cl_git_pass(git_attr_get_many_with_session(values, g_repo, &session, NULL, "file", ARRAY_SIZE(attrs), attrs));
cl_assert_equal_s(values[0], "1");
cl_assert_equal_s(values[1], "2");
cl_git_pass(p_unlink("system/gitattributes"));
cl_git_pass(p_rmdir("system"));
git_buf_dispose(&sysdir);
git_attr_session__free(&session);
}
void test_attr_repo__rewrite(void)
{
const char *value;
cl_git_rewritefile("attr/.gitattributes", "file.txt foo=first\n");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file.txt", "foo"));
cl_assert_equal_s(value, "first");
cl_git_rewritefile("attr/.gitattributes", "file.txt foo=second\n");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file.txt", "foo"));
cl_assert_equal_s(value, "second");
cl_git_rewritefile("attr/.gitattributes", "file.txt other=value\n");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file.txt", "foo"));
cl_assert_equal_p(value, NULL);
}
void test_attr_repo__rewrite_sysdir(void)
{
git_buf sysdir = GIT_BUF_INIT;
const char *value;
cl_git_pass(p_mkdir("system", 0777));
cl_git_pass(git_buf_joinpath(&sysdir, clar_sandbox_path(), "system"));
cl_git_pass(git_sysdir_set(GIT_SYSDIR_SYSTEM, sysdir.ptr));
g_repo = cl_git_sandbox_reopen();
cl_git_rewritefile("system/gitattributes", "file foo=first");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file", "foo"));
cl_assert_equal_s(value, "first");
cl_git_rewritefile("system/gitattributes", "file foo=second");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file", "foo"));
cl_assert_equal_s(value, "second");
git_buf_dispose(&sysdir);
}
void test_attr_repo__unlink(void)
{
const char *value;
cl_git_rewritefile("attr/.gitattributes", "file.txt foo=value1\n");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file.txt", "foo"));
cl_assert_equal_s(value, "value1");
cl_git_pass(p_unlink("attr/.gitattributes"));
cl_git_pass(git_attr_get(&value, g_repo, 0, "file.txt", "foo"));
cl_assert_equal_p(value, NULL);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/attr/file.c
|
#include "clar_libgit2.h"
#include "attr_file.h"
#include "attr_expect.h"
#define get_rule(X) ((git_attr_rule *)git_vector_get(&file->rules,(X)))
#define get_assign(R,Y) ((git_attr_assignment *)git_vector_get(&(R)->assigns,(Y)))
void test_attr_file__simple_read(void)
{
git_attr_file *file;
git_attr_assignment *assign;
git_attr_rule *rule;
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr0")));
cl_assert_equal_s(cl_fixture("attr/attr0"), file->entry->path);
cl_assert(file->rules.length == 1);
rule = get_rule(0);
cl_assert(rule != NULL);
cl_assert_equal_s("*", rule->match.pattern);
cl_assert(rule->match.length == 1);
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_HASWILD) != 0);
cl_assert(rule->assigns.length == 1);
assign = get_assign(rule, 0);
cl_assert(assign != NULL);
cl_assert_equal_s("binary", assign->name);
cl_assert(GIT_ATTR_IS_TRUE(assign->value));
git_attr_file__free(file);
}
void test_attr_file__match_variants(void)
{
git_attr_file *file;
git_attr_rule *rule;
git_attr_assignment *assign;
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr1")));
cl_assert_equal_s(cl_fixture("attr/attr1"), file->entry->path);
cl_assert(file->rules.length == 10);
/* let's do a thorough check of this rule, then just verify
* the things that are unique for the later rules
*/
rule = get_rule(0);
cl_assert(rule);
cl_assert_equal_s("pat0", rule->match.pattern);
cl_assert(rule->match.length == strlen("pat0"));
cl_assert(rule->assigns.length == 1);
assign = get_assign(rule,0);
cl_assert_equal_s("attr0", assign->name);
cl_assert(assign->name_hash == git_attr_file__name_hash(assign->name));
cl_assert(GIT_ATTR_IS_TRUE(assign->value));
rule = get_rule(1);
cl_assert_equal_s("pat1", rule->match.pattern);
cl_assert(rule->match.length == strlen("pat1"));
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_NEGATIVE) != 0);
rule = get_rule(2);
cl_assert_equal_s("pat2", rule->match.pattern);
cl_assert(rule->match.length == strlen("pat2"));
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_DIRECTORY) != 0);
rule = get_rule(3);
cl_assert_equal_s("pat3dir/pat3file", rule->match.pattern);
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_FULLPATH) != 0);
rule = get_rule(4);
cl_assert_equal_s("pat4.*", rule->match.pattern);
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_HASWILD) != 0);
rule = get_rule(5);
cl_assert_equal_s("*.pat5", rule->match.pattern);
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_HASWILD) != 0);
rule = get_rule(7);
cl_assert_equal_s("pat7[a-e]??[xyz]", rule->match.pattern);
cl_assert(rule->assigns.length == 1);
cl_assert((rule->match.flags & GIT_ATTR_FNMATCH_HASWILD) != 0);
assign = get_assign(rule,0);
cl_assert_equal_s("attr7", assign->name);
cl_assert(GIT_ATTR_IS_TRUE(assign->value));
rule = get_rule(8);
cl_assert_equal_s("pat8 with spaces", rule->match.pattern);
cl_assert(rule->match.length == strlen("pat8 with spaces"));
rule = get_rule(9);
cl_assert_equal_s("pat9", rule->match.pattern);
git_attr_file__free(file);
}
static void check_one_assign(
git_attr_file *file,
int rule_idx,
int assign_idx,
const char *pattern,
const char *name,
enum attr_expect_t expected,
const char *expected_str)
{
git_attr_rule *rule = get_rule(rule_idx);
git_attr_assignment *assign = get_assign(rule, assign_idx);
cl_assert_equal_s(pattern, rule->match.pattern);
cl_assert(rule->assigns.length == 1);
cl_assert_equal_s(name, assign->name);
cl_assert(assign->name_hash == git_attr_file__name_hash(assign->name));
attr_check_expected(expected, expected_str, assign->name, assign->value);
}
void test_attr_file__assign_variants(void)
{
git_attr_file *file;
git_attr_rule *rule;
git_attr_assignment *assign;
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr2")));
cl_assert_equal_s(cl_fixture("attr/attr2"), file->entry->path);
cl_assert(file->rules.length == 11);
check_one_assign(file, 0, 0, "pat0", "simple", EXPECT_TRUE, NULL);
check_one_assign(file, 1, 0, "pat1", "neg", EXPECT_FALSE, NULL);
check_one_assign(file, 2, 0, "*", "notundef", EXPECT_TRUE, NULL);
check_one_assign(file, 3, 0, "pat2", "notundef", EXPECT_UNDEFINED, NULL);
check_one_assign(file, 4, 0, "pat3", "assigned", EXPECT_STRING, "test-value");
check_one_assign(file, 5, 0, "pat4", "rule-with-more-chars", EXPECT_STRING, "value-with-more-chars");
check_one_assign(file, 6, 0, "pat5", "empty", EXPECT_TRUE, NULL);
check_one_assign(file, 7, 0, "pat6", "negempty", EXPECT_FALSE, NULL);
rule = get_rule(8);
cl_assert_equal_s("pat7", rule->match.pattern);
cl_assert(rule->assigns.length == 5);
/* assignments will be sorted by hash value, so we have to do
* lookups by search instead of by position
*/
assign = git_attr_rule__lookup_assignment(rule, "multiple");
cl_assert(assign);
cl_assert_equal_s("multiple", assign->name);
cl_assert(GIT_ATTR_IS_TRUE(assign->value));
assign = git_attr_rule__lookup_assignment(rule, "single");
cl_assert(assign);
cl_assert_equal_s("single", assign->name);
cl_assert(GIT_ATTR_IS_FALSE(assign->value));
assign = git_attr_rule__lookup_assignment(rule, "values");
cl_assert(assign);
cl_assert_equal_s("values", assign->name);
cl_assert_equal_s("1", assign->value);
assign = git_attr_rule__lookup_assignment(rule, "also");
cl_assert(assign);
cl_assert_equal_s("also", assign->name);
cl_assert_equal_s("a-really-long-value/*", assign->value);
assign = git_attr_rule__lookup_assignment(rule, "happy");
cl_assert(assign);
cl_assert_equal_s("happy", assign->name);
cl_assert_equal_s("yes!", assign->value);
assign = git_attr_rule__lookup_assignment(rule, "other");
cl_assert(!assign);
rule = get_rule(9);
cl_assert_equal_s("pat8", rule->match.pattern);
cl_assert(rule->assigns.length == 2);
assign = git_attr_rule__lookup_assignment(rule, "again");
cl_assert(assign);
cl_assert_equal_s("again", assign->name);
cl_assert(GIT_ATTR_IS_TRUE(assign->value));
assign = git_attr_rule__lookup_assignment(rule, "another");
cl_assert(assign);
cl_assert_equal_s("another", assign->name);
cl_assert_equal_s("12321", assign->value);
check_one_assign(file, 10, 0, "pat9", "at-eof", EXPECT_FALSE, NULL);
git_attr_file__free(file);
}
static void assert_examples(git_attr_file *file)
{
git_attr_rule *rule;
git_attr_assignment *assign;
rule = get_rule(0);
cl_assert_equal_s("*.java", rule->match.pattern);
cl_assert(rule->assigns.length == 3);
assign = git_attr_rule__lookup_assignment(rule, "diff");
cl_assert_equal_s("diff", assign->name);
cl_assert_equal_s("java", assign->value);
assign = git_attr_rule__lookup_assignment(rule, "crlf");
cl_assert_equal_s("crlf", assign->name);
cl_assert(GIT_ATTR_IS_FALSE(assign->value));
assign = git_attr_rule__lookup_assignment(rule, "myAttr");
cl_assert_equal_s("myAttr", assign->name);
cl_assert(GIT_ATTR_IS_TRUE(assign->value));
assign = git_attr_rule__lookup_assignment(rule, "missing");
cl_assert(assign == NULL);
rule = get_rule(1);
cl_assert_equal_s("NoMyAttr.java", rule->match.pattern);
cl_assert(rule->assigns.length == 1);
assign = get_assign(rule, 0);
cl_assert_equal_s("myAttr", assign->name);
cl_assert(GIT_ATTR_IS_UNSPECIFIED(assign->value));
rule = get_rule(2);
cl_assert_equal_s("README", rule->match.pattern);
cl_assert(rule->assigns.length == 1);
assign = get_assign(rule, 0);
cl_assert_equal_s("caveat", assign->name);
cl_assert_equal_s("unspecified", assign->value);
}
void test_attr_file__check_attr_examples(void)
{
git_attr_file *file;
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr3")));
cl_assert_equal_s(cl_fixture("attr/attr3"), file->entry->path);
cl_assert(file->rules.length == 3);
assert_examples(file);
git_attr_file__free(file);
}
void test_attr_file__whitespace(void)
{
git_attr_file *file;
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr4")));
cl_assert_equal_s(cl_fixture("attr/attr4"), file->entry->path);
cl_assert(file->rules.length == 3);
assert_examples(file);
git_attr_file__free(file);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/attr/macro.c
|
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#include "clar_libgit2.h"
#include "git2/sys/repository.h"
#include "attr.h"
static git_repository *g_repo = NULL;
void test_attr_macro__cleanup(void)
{
cl_git_sandbox_cleanup();
g_repo = NULL;
}
void test_attr_macro__macros(void)
{
const char *names[7] = { "rootattr", "binary", "diff", "crlf", "merge", "text", "frotz" };
const char *names2[5] = { "mymacro", "positive", "negative", "rootattr", "another" };
const char *names3[3] = { "macro2", "multi2", "multi3" };
const char *values[7];
g_repo = cl_git_sandbox_init("attr");
cl_git_pass(git_attr_get_many(values, g_repo, 0, "binfile", 7, names));
cl_assert(GIT_ATTR_IS_TRUE(values[0]));
cl_assert(GIT_ATTR_IS_TRUE(values[1]));
cl_assert(GIT_ATTR_IS_FALSE(values[2]));
cl_assert(GIT_ATTR_IS_FALSE(values[3]));
cl_assert(GIT_ATTR_IS_FALSE(values[4]));
cl_assert(GIT_ATTR_IS_FALSE(values[5]));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[6]));
cl_git_pass(git_attr_get_many(values, g_repo, 0, "macro_test", 5, names2));
cl_assert(GIT_ATTR_IS_TRUE(values[0]));
cl_assert(GIT_ATTR_IS_TRUE(values[1]));
cl_assert(GIT_ATTR_IS_FALSE(values[2]));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[3]));
cl_assert_equal_s("77", values[4]);
cl_git_pass(git_attr_get_many(values, g_repo, 0, "macro_test", 3, names3));
cl_assert(GIT_ATTR_IS_TRUE(values[0]));
cl_assert(GIT_ATTR_IS_FALSE(values[1]));
cl_assert_equal_s("answer", values[2]);
}
void test_attr_macro__bad_macros(void)
{
const char *names[6] = { "rootattr", "positive", "negative",
"firstmacro", "secondmacro", "thirdmacro" };
const char *values[6];
g_repo = cl_git_sandbox_init("attr");
cl_git_pass(git_attr_get_many(values, g_repo, 0, "macro_bad", 6, names));
/* these three just confirm that the "mymacro" rule ran */
cl_assert(GIT_ATTR_IS_UNSPECIFIED(values[0]));
cl_assert(GIT_ATTR_IS_TRUE(values[1]));
cl_assert(GIT_ATTR_IS_FALSE(values[2]));
/* file contains:
* # let's try some malicious macro defs
* [attr]firstmacro -thirdmacro -secondmacro
* [attr]secondmacro firstmacro -firstmacro
* [attr]thirdmacro secondmacro=hahaha -firstmacro
* macro_bad firstmacro secondmacro thirdmacro
*
* firstmacro assignment list ends up with:
* -thirdmacro -secondmacro
* secondmacro assignment list expands "firstmacro" and ends up with:
* -thirdmacro -secondmacro -firstmacro
* thirdmacro assignment don't expand so list ends up with:
* secondmacro="hahaha"
*
* macro_bad assignment list ends up with:
* -thirdmacro -secondmacro firstmacro &&
* -thirdmacro -secondmacro -firstmacro secondmacro &&
* secondmacro="hahaha" thirdmacro
*
* so summary results should be:
* -firstmacro secondmacro="hahaha" thirdmacro
*/
cl_assert(GIT_ATTR_IS_FALSE(values[3]));
cl_assert_equal_s("hahaha", values[4]);
cl_assert(GIT_ATTR_IS_TRUE(values[5]));
}
void test_attr_macro__macros_in_root_wd_apply(void)
{
const char *value;
g_repo = cl_git_sandbox_init("empty_standard_repo");
cl_git_pass(p_mkdir("empty_standard_repo/dir", 0777));
cl_git_rewritefile("empty_standard_repo/.gitattributes", "[attr]customattr key=value\n");
cl_git_rewritefile("empty_standard_repo/dir/.gitattributes", "file customattr\n");
cl_git_pass(git_attr_get(&value, g_repo, 0, "dir/file", "key"));
cl_assert_equal_s(value, "value");
}
void test_attr_macro__changing_macro_in_root_wd_updates_attributes(void)
{
const char *value;
g_repo = cl_git_sandbox_init("empty_standard_repo");
cl_git_rewritefile("empty_standard_repo/.gitattributes",
"[attr]customattr key=first\n"
"file customattr\n");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file", "key"));
cl_assert_equal_s(value, "first");
cl_git_rewritefile("empty_standard_repo/.gitattributes",
"[attr]customattr key=second\n"
"file customattr\n");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file", "key"));
cl_assert_equal_s(value, "second");
}
void test_attr_macro__macros_in_subdir_do_not_apply(void)
{
const char *value;
g_repo = cl_git_sandbox_init("empty_standard_repo");
cl_git_pass(p_mkdir("empty_standard_repo/dir", 0777));
cl_git_rewritefile("empty_standard_repo/dir/.gitattributes",
"[attr]customattr key=value\n"
"file customattr\n");
/* This should _not_ pass, as macros in subdirectories shall be ignored */
cl_git_pass(git_attr_get(&value, g_repo, 0, "dir/file", "key"));
cl_assert_equal_p(value, NULL);
}
void test_attr_macro__adding_macro_succeeds(void)
{
const char *value;
g_repo = cl_git_sandbox_init("empty_standard_repo");
cl_git_pass(git_attr_add_macro(g_repo, "macro", "key=value"));
cl_git_rewritefile("empty_standard_repo/.gitattributes", "file.txt macro\n");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file.txt", "key"));
cl_assert_equal_s(value, "value");
}
void test_attr_macro__adding_boolean_macros_succeeds(void)
{
const char *value;
g_repo = cl_git_sandbox_init("empty_standard_repo");
cl_git_pass(git_attr_add_macro(g_repo, "macro-pos", "positive"));
cl_git_pass(git_attr_add_macro(g_repo, "macro-neg", "-negative"));
cl_git_rewritefile("empty_standard_repo/.gitattributes", "file.txt macro-pos macro-neg\n");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file.txt", "positive"));
cl_assert(GIT_ATTR_IS_TRUE(value));
cl_git_pass(git_attr_get(&value, g_repo, 0, "file.txt", "negative"));
cl_assert(GIT_ATTR_IS_FALSE(value));
}
void test_attr_macro__redefining_macro_succeeds(void)
{
const char *value;
g_repo = cl_git_sandbox_init("empty_standard_repo");
cl_git_pass(git_attr_add_macro(g_repo, "macro", "key=value1"));
cl_git_pass(git_attr_add_macro(g_repo, "macro", "key=value2"));
cl_git_rewritefile("empty_standard_repo/.gitattributes", "file.txt macro");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file.txt", "key"));
cl_assert_equal_s(value, "value2");
}
void test_attr_macro__recursive_macro_resolves(void)
{
const char *value;
g_repo = cl_git_sandbox_init("empty_standard_repo");
cl_git_pass(git_attr_add_macro(g_repo, "expandme", "key=value"));
cl_git_pass(git_attr_add_macro(g_repo, "macro", "expandme"));
cl_git_rewritefile("empty_standard_repo/.gitattributes", "file.txt macro");
cl_git_pass(git_attr_get(&value, g_repo, 0, "file.txt", "key"));
cl_assert_equal_s(value, "value");
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/attr/lookup.c
|
#include "clar_libgit2.h"
#include "attr_file.h"
#include "attr_expect.h"
void test_attr_lookup__simple(void)
{
git_attr_file *file;
git_attr_path path;
const char *value = NULL;
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr0")));
cl_assert_equal_s(cl_fixture("attr/attr0"), file->entry->path);
cl_assert(file->rules.length == 1);
cl_git_pass(git_attr_path__init(&path, "test", NULL, GIT_DIR_FLAG_UNKNOWN));
cl_assert_equal_s("test", path.path);
cl_assert_equal_s("test", path.basename);
cl_assert(!path.is_dir);
cl_git_pass(git_attr_file__lookup_one(file,&path,"binary",&value));
cl_assert(GIT_ATTR_IS_TRUE(value));
cl_git_pass(git_attr_file__lookup_one(file,&path,"missing",&value));
cl_assert(!value);
git_attr_path__free(&path);
git_attr_file__free(file);
}
static void run_test_cases(git_attr_file *file, struct attr_expected *cases, int force_dir)
{
git_attr_path path;
const char *value = NULL;
struct attr_expected *c;
int error;
for (c = cases; c->path != NULL; c++) {
cl_git_pass(git_attr_path__init(&path, c->path, NULL, GIT_DIR_FLAG_UNKNOWN));
if (force_dir)
path.is_dir = 1;
error = git_attr_file__lookup_one(file,&path,c->attr,&value);
cl_git_pass(error);
attr_check_expected(c->expected, c->expected_str, c->attr, value);
git_attr_path__free(&path);
}
}
void test_attr_lookup__match_variants(void)
{
git_attr_file *file;
git_attr_path path;
struct attr_expected dir_cases[] = {
{ "pat2", "attr2", EXPECT_TRUE, NULL },
{ "/testing/for/pat2", "attr2", EXPECT_TRUE, NULL },
{ "/not/pat2/yousee", "attr2", EXPECT_UNDEFINED, NULL },
{ "/fun/fun/fun/pat4.dir", "attr4", EXPECT_TRUE, NULL },
{ "foo.pat5", "attr5", EXPECT_TRUE, NULL },
{ NULL, NULL, 0, NULL }
};
struct attr_expected cases[] = {
/* pat0 -> simple match */
{ "pat0", "attr0", EXPECT_TRUE, NULL },
{ "/testing/for/pat0", "attr0", EXPECT_TRUE, NULL },
{ "relative/to/pat0", "attr0", EXPECT_TRUE, NULL },
{ "this-contains-pat0-inside", "attr0", EXPECT_UNDEFINED, NULL },
{ "this-aint-right", "attr0", EXPECT_UNDEFINED, NULL },
{ "/this/pat0/dont/match", "attr0", EXPECT_UNDEFINED, NULL },
/* negative match */
{ "pat0", "attr1", EXPECT_TRUE, NULL },
{ "pat1", "attr1", EXPECT_UNDEFINED, NULL },
{ "/testing/for/pat1", "attr1", EXPECT_UNDEFINED, NULL },
{ "/testing/for/pat0", "attr1", EXPECT_TRUE, NULL },
{ "/testing/for/pat1/inside", "attr1", EXPECT_TRUE, NULL },
{ "misc", "attr1", EXPECT_TRUE, NULL },
/* dir match */
{ "pat2", "attr2", EXPECT_UNDEFINED, NULL },
{ "/testing/for/pat2", "attr2", EXPECT_UNDEFINED, NULL },
{ "/not/pat2/yousee", "attr2", EXPECT_UNDEFINED, NULL },
/* path match */
{ "pat3file", "attr3", EXPECT_UNDEFINED, NULL },
{ "/pat3dir/pat3file", "attr3", EXPECT_TRUE, NULL },
{ "pat3dir/pat3file", "attr3", EXPECT_TRUE, NULL },
/* pattern* match */
{ "pat4.txt", "attr4", EXPECT_TRUE, NULL },
{ "/fun/fun/fun/pat4.c", "attr4", EXPECT_TRUE, NULL },
{ "pat4.", "attr4", EXPECT_TRUE, NULL },
{ "pat4", "attr4", EXPECT_UNDEFINED, NULL },
/* *pattern match */
{ "foo.pat5", "attr5", EXPECT_TRUE, NULL },
{ "/this/is/ok.pat5", "attr5", EXPECT_TRUE, NULL },
{ "/this/is/bad.pat5/yousee.txt", "attr5", EXPECT_UNDEFINED, NULL },
{ "foo.pat5", "attr100", EXPECT_UNDEFINED, NULL },
/* glob match with slashes */
{ "foo.pat6", "attr6", EXPECT_UNDEFINED, NULL },
{ "pat6/pat6/foobar.pat6", "attr6", EXPECT_TRUE, NULL },
{ "pat6/pat6/.pat6", "attr6", EXPECT_TRUE, NULL },
{ "pat6/pat6/extra/foobar.pat6", "attr6", EXPECT_UNDEFINED, NULL },
{ "/prefix/pat6/pat6/foobar.pat6", "attr6", EXPECT_UNDEFINED, NULL },
{ "/pat6/pat6/foobar.pat6", "attr6", EXPECT_TRUE, NULL },
/* complex pattern */
{ "pat7a12z", "attr7", EXPECT_TRUE, NULL },
{ "pat7e__x", "attr7", EXPECT_TRUE, NULL },
{ "pat7b/1y", "attr7", EXPECT_UNDEFINED, NULL }, /* ? does not match / */
{ "pat7e_x", "attr7", EXPECT_UNDEFINED, NULL },
{ "pat7aaaa", "attr7", EXPECT_UNDEFINED, NULL },
{ "pat7zzzz", "attr7", EXPECT_UNDEFINED, NULL },
{ "/this/can/be/anything/pat7a12z", "attr7", EXPECT_TRUE, NULL },
{ "but/it/still/must/match/pat7aaaa", "attr7", EXPECT_UNDEFINED, NULL },
{ "pat7aaay.fail", "attr7", EXPECT_UNDEFINED, NULL },
/* pattern with spaces */
{ "pat8 with spaces", "attr8", EXPECT_TRUE, NULL },
{ "/gotta love/pat8 with spaces", "attr8", EXPECT_TRUE, NULL },
{ "failing pat8 with spaces", "attr8", EXPECT_UNDEFINED, NULL },
{ "spaces", "attr8", EXPECT_UNDEFINED, NULL },
/* pattern at eof */
{ "pat9", "attr9", EXPECT_TRUE, NULL },
{ "/eof/pat9", "attr9", EXPECT_TRUE, NULL },
{ "pat", "attr9", EXPECT_UNDEFINED, NULL },
{ "at9", "attr9", EXPECT_UNDEFINED, NULL },
{ "pat9.fail", "attr9", EXPECT_UNDEFINED, NULL },
/* sentinel at end */
{ NULL, NULL, 0, NULL }
};
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr1")));
cl_assert_equal_s(cl_fixture("attr/attr1"), file->entry->path);
cl_assert(file->rules.length == 10);
cl_git_pass(git_attr_path__init(&path, "/testing/for/pat0", NULL, GIT_DIR_FLAG_UNKNOWN));
cl_assert_equal_s("pat0", path.basename);
run_test_cases(file, cases, 0);
run_test_cases(file, dir_cases, 1);
git_attr_file__free(file);
git_attr_path__free(&path);
}
void test_attr_lookup__assign_variants(void)
{
git_attr_file *file;
struct attr_expected cases[] = {
/* pat0 -> simple assign */
{ "pat0", "simple", EXPECT_TRUE, NULL },
{ "/testing/pat0", "simple", EXPECT_TRUE, NULL },
{ "pat0", "fail", EXPECT_UNDEFINED, NULL },
{ "/testing/pat0", "fail", EXPECT_UNDEFINED, NULL },
/* negative assign */
{ "pat1", "neg", EXPECT_FALSE, NULL },
{ "/testing/pat1", "neg", EXPECT_FALSE, NULL },
{ "pat1", "fail", EXPECT_UNDEFINED, NULL },
{ "/testing/pat1", "fail", EXPECT_UNDEFINED, NULL },
/* forced undef */
{ "pat1", "notundef", EXPECT_TRUE, NULL },
{ "pat2", "notundef", EXPECT_UNDEFINED, NULL },
{ "/lead/in/pat1", "notundef", EXPECT_TRUE, NULL },
{ "/lead/in/pat2", "notundef", EXPECT_UNDEFINED, NULL },
/* assign value */
{ "pat3", "assigned", EXPECT_STRING, "test-value" },
{ "pat3", "notassigned", EXPECT_UNDEFINED, NULL },
/* assign value */
{ "pat4", "rule-with-more-chars", EXPECT_STRING, "value-with-more-chars" },
{ "pat4", "notassigned-rule-with-more-chars", EXPECT_UNDEFINED, NULL },
/* empty assignments */
{ "pat5", "empty", EXPECT_TRUE, NULL },
{ "pat6", "negempty", EXPECT_FALSE, NULL },
/* multiple assignment */
{ "pat7", "multiple", EXPECT_TRUE, NULL },
{ "pat7", "single", EXPECT_FALSE, NULL },
{ "pat7", "values", EXPECT_STRING, "1" },
{ "pat7", "also", EXPECT_STRING, "a-really-long-value/*" },
{ "pat7", "happy", EXPECT_STRING, "yes!" },
{ "pat8", "again", EXPECT_TRUE, NULL },
{ "pat8", "another", EXPECT_STRING, "12321" },
/* bad assignment */
{ "patbad0", "simple", EXPECT_UNDEFINED, NULL },
{ "patbad0", "notundef", EXPECT_TRUE, NULL },
{ "patbad1", "simple", EXPECT_UNDEFINED, NULL },
/* eof assignment */
{ "pat9", "at-eof", EXPECT_FALSE, NULL },
/* sentinel at end */
{ NULL, NULL, 0, NULL }
};
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr2")));
cl_assert(file->rules.length == 11);
run_test_cases(file, cases, 0);
git_attr_file__free(file);
}
void test_attr_lookup__check_attr_examples(void)
{
git_attr_file *file;
struct attr_expected cases[] = {
{ "foo.java", "diff", EXPECT_STRING, "java" },
{ "foo.java", "crlf", EXPECT_FALSE, NULL },
{ "foo.java", "myAttr", EXPECT_TRUE, NULL },
{ "foo.java", "other", EXPECT_UNDEFINED, NULL },
{ "/prefix/dir/foo.java", "diff", EXPECT_STRING, "java" },
{ "/prefix/dir/foo.java", "crlf", EXPECT_FALSE, NULL },
{ "/prefix/dir/foo.java", "myAttr", EXPECT_TRUE, NULL },
{ "/prefix/dir/foo.java", "other", EXPECT_UNDEFINED, NULL },
{ "NoMyAttr.java", "crlf", EXPECT_FALSE, NULL },
{ "NoMyAttr.java", "myAttr", EXPECT_UNDEFINED, NULL },
{ "NoMyAttr.java", "other", EXPECT_UNDEFINED, NULL },
{ "/prefix/dir/NoMyAttr.java", "crlf", EXPECT_FALSE, NULL },
{ "/prefix/dir/NoMyAttr.java", "myAttr", EXPECT_UNDEFINED, NULL },
{ "/prefix/dir/NoMyAttr.java", "other", EXPECT_UNDEFINED, NULL },
{ "README", "caveat", EXPECT_STRING, "unspecified" },
{ "/specific/path/README", "caveat", EXPECT_STRING, "unspecified" },
{ "README", "missing", EXPECT_UNDEFINED, NULL },
{ "/specific/path/README", "missing", EXPECT_UNDEFINED, NULL },
/* sentinel at end */
{ NULL, NULL, 0, NULL }
};
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr3")));
cl_assert(file->rules.length == 3);
run_test_cases(file, cases, 0);
git_attr_file__free(file);
}
void test_attr_lookup__from_buffer(void)
{
git_attr_file *file;
git_attr_file_source source = {0};
struct attr_expected cases[] = {
{ "abc", "foo", EXPECT_TRUE, NULL },
{ "abc", "bar", EXPECT_TRUE, NULL },
{ "abc", "baz", EXPECT_TRUE, NULL },
{ "aaa", "foo", EXPECT_TRUE, NULL },
{ "aaa", "bar", EXPECT_UNDEFINED, NULL },
{ "aaa", "baz", EXPECT_TRUE, NULL },
{ "qqq", "foo", EXPECT_UNDEFINED, NULL },
{ "qqq", "bar", EXPECT_UNDEFINED, NULL },
{ "qqq", "baz", EXPECT_TRUE, NULL },
{ NULL, NULL, 0, NULL }
};
cl_git_pass(git_attr_file__new(&file, NULL, &source));
cl_git_pass(git_attr_file__parse_buffer(NULL, file, "a* foo\nabc bar\n* baz", true));
cl_assert(file->rules.length == 3);
run_test_cases(file, cases, 0);
git_attr_file__free(file);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/attr/flags.c
|
#include "clar_libgit2.h"
#include "git2/attr.h"
void test_attr_flags__cleanup(void)
{
cl_git_sandbox_cleanup();
}
void test_attr_flags__bare(void)
{
git_repository *repo = cl_git_sandbox_init("testrepo.git");
const char *value;
cl_assert(git_repository_is_bare(repo));
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM, "README.md", "diff"));
cl_assert(GIT_ATTR_IS_UNSPECIFIED(value));
}
void test_attr_flags__index_vs_workdir(void)
{
git_repository *repo = cl_git_sandbox_init("attr_index");
const char *value;
cl_assert(!git_repository_is_bare(repo));
/* wd then index */
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"README.md", "bar"));
cl_assert(GIT_ATTR_IS_FALSE(value));
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"README.md", "blargh"));
cl_assert_equal_s(value, "goop");
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"README.txt", "foo"));
cl_assert(GIT_ATTR_IS_FALSE(value));
/* index then wd */
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"README.md", "bar"));
cl_assert(GIT_ATTR_IS_TRUE(value));
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"README.md", "blargh"));
cl_assert_equal_s(value, "garble");
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"README.txt", "foo"));
cl_assert(GIT_ATTR_IS_TRUE(value));
}
void test_attr_flags__subdir(void)
{
git_repository *repo = cl_git_sandbox_init("attr_index");
const char *value;
/* wd then index */
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"sub/sub/README.md", "bar"));
cl_assert_equal_s(value, "1234");
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"sub/sub/README.txt", "another"));
cl_assert_equal_s(value, "one");
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"sub/sub/README.txt", "again"));
cl_assert(GIT_ATTR_IS_TRUE(value));
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_FILE_THEN_INDEX,
"sub/sub/README.txt", "beep"));
cl_assert_equal_s(value, "10");
/* index then wd */
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"sub/sub/README.md", "bar"));
cl_assert_equal_s(value, "1337");
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"sub/sub/README.txt", "another"));
cl_assert_equal_s(value, "one");
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"sub/sub/README.txt", "again"));
cl_assert(GIT_ATTR_IS_TRUE(value));
cl_git_pass(git_attr_get(
&value, repo, GIT_ATTR_CHECK_NO_SYSTEM | GIT_ATTR_CHECK_INDEX_THEN_FILE,
"sub/sub/README.txt", "beep"));
cl_assert_equal_s(value, "5");
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/stash/drop.c
|
#include "clar_libgit2.h"
#include "futils.h"
#include "stash_helpers.h"
#include "refs.h"
static git_repository *repo;
static git_signature *signature;
void test_stash_drop__initialize(void)
{
cl_git_pass(git_repository_init(&repo, "stash", 0));
cl_git_pass(git_signature_new(&signature, "nulltoken", "[email protected]", 1323847743, 60)); /* Wed Dec 14 08:29:03 2011 +0100 */
}
void test_stash_drop__cleanup(void)
{
git_signature_free(signature);
signature = NULL;
git_repository_free(repo);
repo = NULL;
cl_git_pass(git_futils_rmdir_r("stash", NULL, GIT_RMDIR_REMOVE_FILES));
}
void test_stash_drop__cannot_drop_from_an_empty_stash(void)
{
cl_git_fail_with(git_stash_drop(repo, 0), GIT_ENOTFOUND);
}
static void push_three_states(void)
{
git_oid oid;
git_index *index;
cl_git_mkfile("stash/zero.txt", "content\n");
cl_git_pass(git_repository_index(&index, repo));
cl_git_pass(git_index_add_bypath(index, "zero.txt"));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Initial commit");
cl_assert(git_path_exists("stash/zero.txt"));
git_index_free(index);
cl_git_mkfile("stash/one.txt", "content\n");
cl_git_pass(git_stash_save(
&oid, repo, signature, "First", GIT_STASH_INCLUDE_UNTRACKED));
cl_assert(!git_path_exists("stash/one.txt"));
cl_assert(git_path_exists("stash/zero.txt"));
cl_git_mkfile("stash/two.txt", "content\n");
cl_git_pass(git_stash_save(
&oid, repo, signature, "Second", GIT_STASH_INCLUDE_UNTRACKED));
cl_assert(!git_path_exists("stash/two.txt"));
cl_assert(git_path_exists("stash/zero.txt"));
cl_git_mkfile("stash/three.txt", "content\n");
cl_git_pass(git_stash_save(
&oid, repo, signature, "Third", GIT_STASH_INCLUDE_UNTRACKED));
cl_assert(!git_path_exists("stash/three.txt"));
cl_assert(git_path_exists("stash/zero.txt"));
}
void test_stash_drop__cannot_drop_a_non_existing_stashed_state(void)
{
push_three_states();
cl_git_fail_with(git_stash_drop(repo, 666), GIT_ENOTFOUND);
cl_git_fail_with(git_stash_drop(repo, 42), GIT_ENOTFOUND);
cl_git_fail_with(git_stash_drop(repo, 3), GIT_ENOTFOUND);
}
void test_stash_drop__can_purge_the_stash_from_the_top(void)
{
push_three_states();
cl_git_pass(git_stash_drop(repo, 0));
cl_git_pass(git_stash_drop(repo, 0));
cl_git_pass(git_stash_drop(repo, 0));
cl_git_fail_with(git_stash_drop(repo, 0), GIT_ENOTFOUND);
}
void test_stash_drop__can_purge_the_stash_from_the_bottom(void)
{
push_three_states();
cl_git_pass(git_stash_drop(repo, 2));
cl_git_pass(git_stash_drop(repo, 1));
cl_git_pass(git_stash_drop(repo, 0));
cl_git_fail_with(git_stash_drop(repo, 0), GIT_ENOTFOUND);
}
void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void)
{
git_reference *stash;
git_reflog *reflog;
const git_reflog_entry *entry;
git_oid oid;
size_t count;
push_three_states();
cl_git_pass(git_reference_lookup(&stash, repo, GIT_REFS_STASH_FILE));
cl_git_pass(git_reflog_read(&reflog, repo, GIT_REFS_STASH_FILE));
entry = git_reflog_entry_byindex(reflog, 1);
git_oid_cpy(&oid, git_reflog_entry_id_old(entry));
count = git_reflog_entrycount(reflog);
git_reflog_free(reflog);
cl_git_pass(git_stash_drop(repo, 1));
cl_git_pass(git_reflog_read(&reflog, repo, GIT_REFS_STASH_FILE));
entry = git_reflog_entry_byindex(reflog, 0);
cl_assert_equal_oid(&oid, git_reflog_entry_id_old(entry));
cl_assert_equal_sz(count - 1, git_reflog_entrycount(reflog));
git_reflog_free(reflog);
git_reference_free(stash);
}
void test_stash_drop__dropping_the_last_entry_removes_the_stash(void)
{
git_reference *stash;
push_three_states();
cl_git_pass(git_reference_lookup(&stash, repo, GIT_REFS_STASH_FILE));
git_reference_free(stash);
cl_git_pass(git_stash_drop(repo, 0));
cl_git_pass(git_stash_drop(repo, 0));
cl_git_pass(git_stash_drop(repo, 0));
cl_git_fail_with(
git_reference_lookup(&stash, repo, GIT_REFS_STASH_FILE), GIT_ENOTFOUND);
}
void retrieve_top_stash_id(git_oid *out)
{
git_object *top_stash;
cl_git_pass(git_revparse_single(&top_stash, repo, "stash@{0}"));
cl_git_pass(git_reference_name_to_id(out, repo, GIT_REFS_STASH_FILE));
cl_assert_equal_oid(out, git_object_id(top_stash));
git_object_free(top_stash);
}
void test_stash_drop__dropping_the_top_stash_updates_the_stash_reference(void)
{
git_object *next_top_stash;
git_oid oid;
push_three_states();
retrieve_top_stash_id(&oid);
cl_git_pass(git_revparse_single(&next_top_stash, repo, "stash@{1}"));
cl_assert(git_oid_cmp(&oid, git_object_id(next_top_stash)));
cl_git_pass(git_stash_drop(repo, 0));
retrieve_top_stash_id(&oid);
cl_assert_equal_oid(&oid, git_object_id(next_top_stash));
git_object_free(next_top_stash);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/stash/submodules.c
|
#include "clar_libgit2.h"
#include "stash_helpers.h"
#include "../submodule/submodule_helpers.h"
static git_repository *repo;
static git_signature *signature;
static git_oid stash_tip_oid;
static git_submodule *sm;
void test_stash_submodules__initialize(void)
{
cl_git_pass(git_signature_new(&signature, "nulltoken", "[email protected]", 1323847743, 60)); /* Wed Dec 14 08:29:03 2011 +0100 */
repo = setup_fixture_submodules();
cl_git_pass(git_submodule_lookup(&sm, repo, "testrepo"));
}
void test_stash_submodules__cleanup(void)
{
git_submodule_free(sm);
sm = NULL;
git_signature_free(signature);
signature = NULL;
}
void test_stash_submodules__does_not_stash_modified_submodules(void)
{
static git_index *smindex;
static git_repository *smrepo;
assert_status(repo, "modified", GIT_STATUS_WT_MODIFIED);
/* modify file in submodule */
cl_git_rewritefile("submodules/testrepo/README", "heyheyhey");
assert_status(repo, "testrepo", GIT_STATUS_WT_MODIFIED);
/* add file to index in submodule */
cl_git_pass(git_submodule_open(&smrepo, sm));
cl_git_pass(git_repository_index(&smindex, smrepo));
cl_git_pass(git_index_add_bypath(smindex, "README"));
/* commit changed index of submodule */
cl_repo_commit_from_index(NULL, smrepo, NULL, 1372350000, "Modify it");
assert_status(repo, "testrepo", GIT_STATUS_WT_MODIFIED);
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
assert_status(repo, "testrepo", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "modified", GIT_STATUS_CURRENT);
git_index_free(smindex);
git_repository_free(smrepo);
}
void test_stash_submodules__stash_is_empty_with_modified_submodules(void)
{
static git_index *smindex;
static git_repository *smrepo;
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
assert_status(repo, "modified", GIT_STATUS_CURRENT);
/* modify file in submodule */
cl_git_rewritefile("submodules/testrepo/README", "heyheyhey");
assert_status(repo, "testrepo", GIT_STATUS_WT_MODIFIED);
/* add file to index in submodule */
cl_git_pass(git_submodule_open(&smrepo, sm));
cl_git_pass(git_repository_index(&smindex, smrepo));
cl_git_pass(git_index_add_bypath(smindex, "README"));
/* commit changed index of submodule */
cl_repo_commit_from_index(NULL, smrepo, NULL, 1372350000, "Modify it");
assert_status(repo, "testrepo", GIT_STATUS_WT_MODIFIED);
cl_git_fail_with(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT), GIT_ENOTFOUND);
git_index_free(smindex);
git_repository_free(smrepo);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/stash/stash_helpers.h
|
void setup_stash(
git_repository *repo,
git_signature *signature);
void assert_status(
git_repository *repo,
const char *path,
int status_flags);
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/stash/save.c
|
#include "clar_libgit2.h"
#include "futils.h"
#include "stash_helpers.h"
static git_repository *repo;
static git_signature *signature;
static git_oid stash_tip_oid;
/*
* Friendly reminder, in order to ease the reading of the following tests:
*
* "stash" points to the worktree commit
* "stash^1" points to the base commit (HEAD when the stash was created)
* "stash^2" points to the index commit
* "stash^3" points to the untracked commit
*/
void test_stash_save__initialize(void)
{
cl_git_pass(git_repository_init(&repo, "stash", 0));
cl_git_pass(git_signature_new(&signature, "nulltoken", "[email protected]", 1323847743, 60)); /* Wed Dec 14 08:29:03 2011 +0100 */
setup_stash(repo, signature);
}
void test_stash_save__cleanup(void)
{
git_signature_free(signature);
signature = NULL;
git_repository_free(repo);
repo = NULL;
cl_git_pass(git_futils_rmdir_r("stash", NULL, GIT_RMDIR_REMOVE_FILES));
cl_fixture_cleanup("sorry-it-is-a-non-bare-only-party");
}
static void assert_object_oid(const char* revision, const char* expected_oid, git_object_t type)
{
int result;
git_object *obj;
result = git_revparse_single(&obj, repo, revision);
if (!expected_oid) {
cl_assert_equal_i(GIT_ENOTFOUND, result);
return;
} else
cl_assert_equal_i(0, result);
cl_git_pass(git_oid_streq(git_object_id(obj), expected_oid));
cl_assert_equal_i(type, git_object_type(obj));
git_object_free(obj);
}
static void assert_blob_oid(const char* revision, const char* expected_oid)
{
assert_object_oid(revision, expected_oid, GIT_OBJECT_BLOB);
}
void test_stash_save__does_not_keep_index_by_default(void)
{
/*
$ git stash
$ git show refs/stash:what
see you later
$ git show refs/stash:how
not so small and
$ git show refs/stash:who
funky world
$ git show refs/stash:when
fatal: Path 'when' exists on disk, but not in 'stash'.
$ git show refs/stash^2:what
goodbye
$ git show refs/stash^2:how
not so small and
$ git show refs/stash^2:who
world
$ git show refs/stash^2:when
fatal: Path 'when' exists on disk, but not in 'stash^2'.
$ git status --short
?? when
*/
unsigned int status;
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
cl_git_pass(git_status_file(&status, repo, "when"));
assert_blob_oid("refs/stash:what", "bc99dc98b3eba0e9157e94769cd4d49cb49de449"); /* see you later */
assert_blob_oid("refs/stash:how", "e6d64adb2c7f3eb8feb493b556cc8070dca379a3"); /* not so small and */
assert_blob_oid("refs/stash:who", "a0400d4954659306a976567af43125a0b1aa8595"); /* funky world */
assert_blob_oid("refs/stash:when", NULL);
assert_blob_oid("refs/stash:why", "88c2533e21f098b89c91a431d8075cbdbe422a51"); /* would anybody use stash? */
assert_blob_oid("refs/stash:where", "e3d6434ec12eb76af8dfa843a64ba6ab91014a0b"); /* .... */
assert_blob_oid("refs/stash:.gitignore", "ac4d88de61733173d9959e4b77c69b9f17a00980");
assert_blob_oid("refs/stash:just.ignore", NULL);
assert_blob_oid("refs/stash^2:what", "dd7e1c6f0fefe118f0b63d9f10908c460aa317a6"); /* goodbye */
assert_blob_oid("refs/stash^2:how", "e6d64adb2c7f3eb8feb493b556cc8070dca379a3"); /* not so small and */
assert_blob_oid("refs/stash^2:who", "cc628ccd10742baea8241c5924df992b5c019f71"); /* world */
assert_blob_oid("refs/stash^2:when", NULL);
assert_blob_oid("refs/stash^2:why", "88c2533e21f098b89c91a431d8075cbdbe422a51"); /* would anybody use stash? */
assert_blob_oid("refs/stash^2:where", "e08f7fbb9a42a0c5367cf8b349f1f08c3d56bd72"); /* ???? */
assert_blob_oid("refs/stash^2:.gitignore", "ac4d88de61733173d9959e4b77c69b9f17a00980");
assert_blob_oid("refs/stash^2:just.ignore", NULL);
assert_blob_oid("refs/stash^3", NULL);
cl_assert_equal_i(GIT_STATUS_WT_NEW, status);
}
void test_stash_save__can_keep_index(void)
{
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_KEEP_INDEX));
assert_status(repo, "what", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "how", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "who", GIT_STATUS_CURRENT);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "just.ignore", GIT_STATUS_IGNORED);
}
static void assert_commit_message_contains(const char *revision, const char *fragment)
{
git_commit *commit;
cl_git_pass(git_revparse_single((git_object**)&commit, repo, revision));
cl_assert(strstr(git_commit_message(commit), fragment) != NULL);
git_commit_free(commit);
}
void test_stash_save__can_include_untracked_files(void)
{
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED));
assert_commit_message_contains("refs/stash^3", "untracked files on master: ");
assert_blob_oid("refs/stash^3:what", NULL);
assert_blob_oid("refs/stash^3:how", NULL);
assert_blob_oid("refs/stash^3:who", NULL);
assert_blob_oid("refs/stash^3:when", "b6ed15e81e2593d7bb6265eb4a991d29dc3e628b");
assert_blob_oid("refs/stash^3:just.ignore", NULL);
}
void test_stash_save__untracked_skips_ignored(void)
{
cl_git_append2file("stash/.gitignore", "bundle/vendor/\n");
cl_must_pass(p_mkdir("stash/bundle", 0777));
cl_must_pass(p_mkdir("stash/bundle/vendor", 0777));
cl_git_mkfile("stash/bundle/vendor/blah", "contents\n");
cl_assert(git_path_exists("stash/when")); /* untracked */
cl_assert(git_path_exists("stash/just.ignore")); /* ignored */
cl_assert(git_path_exists("stash/bundle/vendor/blah")); /* ignored */
cl_git_pass(git_stash_save(
&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED));
cl_assert(!git_path_exists("stash/when"));
cl_assert(git_path_exists("stash/bundle/vendor/blah"));
cl_assert(git_path_exists("stash/just.ignore"));
}
void test_stash_save__can_include_untracked_and_ignored_files(void)
{
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED | GIT_STASH_INCLUDE_IGNORED));
assert_commit_message_contains("refs/stash^3", "untracked files on master: ");
assert_blob_oid("refs/stash^3:what", NULL);
assert_blob_oid("refs/stash^3:how", NULL);
assert_blob_oid("refs/stash^3:who", NULL);
assert_blob_oid("refs/stash^3:when", "b6ed15e81e2593d7bb6265eb4a991d29dc3e628b");
assert_blob_oid("refs/stash^3:just.ignore", "78925fb1236b98b37a35e9723033e627f97aa88b");
cl_assert(!git_path_exists("stash/just.ignore"));
}
/*
* Note: this test was flaky prior to fixing #4101 -- run it several
* times to get a failure. The issues is that whether the fast
* (stat-only) codepath is used inside stash's diff operation depends
* on whether files are "racily clean", and there doesn't seem to be
* an easy way to force the exact required state.
*/
void test_stash_save__untracked_regression(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
const char *paths[] = {"what", "where", "how", "why"};
git_reference *head;
git_commit *head_commit;
git_buf untracked_dir;
const char* workdir = git_repository_workdir(repo);
git_buf_init(&untracked_dir, 0);
git_buf_printf(&untracked_dir, "%sz", workdir);
cl_assert(!p_mkdir(untracked_dir.ptr, 0777));
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT));
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
opts.paths.strings = (char **)paths;
opts.paths.count = 4;
cl_git_pass(git_checkout_tree(repo, (git_object*)head_commit, &opts));
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
assert_commit_message_contains("refs/stash", "WIP on master");
git_reference_free(head);
git_commit_free(head_commit);
git_buf_dispose(&untracked_dir);
}
#define MESSAGE "Look Ma! I'm on TV!"
void test_stash_save__can_accept_a_message(void)
{
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, MESSAGE, GIT_STASH_DEFAULT));
assert_commit_message_contains("refs/stash^2", "index on master: ");
assert_commit_message_contains("refs/stash", "On master: " MESSAGE);
}
void test_stash_save__cannot_stash_against_an_unborn_branch(void)
{
git_reference *head;
cl_git_pass(git_reference_symbolic_create(&head, repo, "HEAD", "refs/heads/unborn", 1, NULL));
cl_assert_equal_i(GIT_EUNBORNBRANCH,
git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
git_reference_free(head);
}
void test_stash_save__cannot_stash_against_a_bare_repository(void)
{
git_repository *local;
cl_git_pass(git_repository_init(&local, "sorry-it-is-a-non-bare-only-party", 1));
cl_assert_equal_i(GIT_EBAREREPO,
git_stash_save(&stash_tip_oid, local, signature, NULL, GIT_STASH_DEFAULT));
git_repository_free(local);
}
void test_stash_save__can_stash_against_a_detached_head(void)
{
git_repository_detach_head(repo);
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
assert_commit_message_contains("refs/stash^2", "index on (no branch): ");
assert_commit_message_contains("refs/stash", "WIP on (no branch): ");
}
void test_stash_save__stashing_updates_the_reflog(void)
{
assert_object_oid("refs/stash@{0}", NULL, GIT_OBJECT_COMMIT);
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
assert_object_oid("refs/stash@{0}", git_oid_tostr_s(&stash_tip_oid), GIT_OBJECT_COMMIT);
assert_object_oid("refs/stash@{1}", NULL, GIT_OBJECT_COMMIT);
}
void test_stash_save__multiline_message(void)
{
const char *msg = "This\n\nis a multiline message\n";
const git_reflog_entry *entry;
git_reflog *reflog;
assert_object_oid("refs/stash@{0}", NULL, GIT_OBJECT_COMMIT);
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, msg, GIT_STASH_DEFAULT));
cl_git_pass(git_reflog_read(&reflog, repo, "refs/stash"));
cl_assert(entry = git_reflog_entry_byindex(reflog, 0));
cl_assert_equal_s(git_reflog_entry_message(entry), "On master: This is a multiline message");
assert_object_oid("refs/stash@{0}", git_oid_tostr_s(&stash_tip_oid), GIT_OBJECT_COMMIT);
assert_commit_message_contains("refs/stash@{0}", msg);
git_reflog_free(reflog);
}
void test_stash_save__cannot_stash_when_there_are_no_local_change(void)
{
git_index *index;
git_oid stash_tip_oid;
cl_git_pass(git_repository_index(&index, repo));
/*
* 'what', 'where' and 'who' are being committed.
* 'when' remains untracked.
*/
cl_git_pass(git_index_add_bypath(index, "what"));
cl_git_pass(git_index_add_bypath(index, "where"));
cl_git_pass(git_index_add_bypath(index, "who"));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Initial commit");
git_index_free(index);
cl_assert_equal_i(GIT_ENOTFOUND,
git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
p_unlink("stash/when");
cl_assert_equal_i(GIT_ENOTFOUND,
git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED));
}
void test_stash_save__can_stage_normal_then_stage_untracked(void)
{
/*
* $ git ls-tree stash@{1}^0
* 100644 blob ac4d88de61733173d9959e4b77c69b9f17a00980 .gitignore
* 100644 blob e6d64adb2c7f3eb8feb493b556cc8070dca379a3 how
* 100644 blob bc99dc98b3eba0e9157e94769cd4d49cb49de449 what
* 100644 blob a0400d4954659306a976567af43125a0b1aa8595 who
*
* $ git ls-tree stash@{1}^1
* 100644 blob ac4d88de61733173d9959e4b77c69b9f17a00980 .gitignore
* 100644 blob ac790413e2d7a26c3767e78c57bb28716686eebc how
* 100644 blob ce013625030ba8dba906f756967f9e9ca394464a what
* 100644 blob cc628ccd10742baea8241c5924df992b5c019f71 who
*
* $ git ls-tree stash@{1}^2
* 100644 blob ac4d88de61733173d9959e4b77c69b9f17a00980 .gitignore
* 100644 blob e6d64adb2c7f3eb8feb493b556cc8070dca379a3 how
* 100644 blob dd7e1c6f0fefe118f0b63d9f10908c460aa317a6 what
* 100644 blob cc628ccd10742baea8241c5924df992b5c019f71 who
*
* $ git ls-tree stash@{1}^3
* fatal: Not a valid object name stash@{1}^3
*
* $ git ls-tree stash@{0}^0
* 100644 blob ac4d88de61733173d9959e4b77c69b9f17a00980 .gitignore
* 100644 blob ac790413e2d7a26c3767e78c57bb28716686eebc how
* 100644 blob ce013625030ba8dba906f756967f9e9ca394464a what
* 100644 blob cc628ccd10742baea8241c5924df992b5c019f71 who
*
* $ git ls-tree stash@{0}^1
* 100644 blob ac4d88de61733173d9959e4b77c69b9f17a00980 .gitignore
* 100644 blob ac790413e2d7a26c3767e78c57bb28716686eebc how
* 100644 blob ce013625030ba8dba906f756967f9e9ca394464a what
* 100644 blob cc628ccd10742baea8241c5924df992b5c019f71 who
*
* $ git ls-tree stash@{0}^2
* 100644 blob ac4d88de61733173d9959e4b77c69b9f17a00980 .gitignore
* 100644 blob ac790413e2d7a26c3767e78c57bb28716686eebc how
* 100644 blob ce013625030ba8dba906f756967f9e9ca394464a what
* 100644 blob cc628ccd10742baea8241c5924df992b5c019f71 who
*
* $ git ls-tree stash@{0}^3
* 100644 blob b6ed15e81e2593d7bb6265eb4a991d29dc3e628b when
*/
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "how", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "who", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "just.ignore", GIT_STATUS_IGNORED);
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
assert_status(repo, "what", GIT_STATUS_CURRENT);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_CURRENT);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "just.ignore", GIT_STATUS_IGNORED);
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED));
assert_status(repo, "what", GIT_STATUS_CURRENT);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_CURRENT);
assert_status(repo, "when", GIT_ENOTFOUND);
assert_status(repo, "just.ignore", GIT_STATUS_IGNORED);
assert_blob_oid("stash@{1}^0:what", "bc99dc98b3eba0e9157e94769cd4d49cb49de449"); /* see you later */
assert_blob_oid("stash@{1}^0:how", "e6d64adb2c7f3eb8feb493b556cc8070dca379a3"); /* not so small and */
assert_blob_oid("stash@{1}^0:who", "a0400d4954659306a976567af43125a0b1aa8595"); /* funky world */
assert_blob_oid("stash@{1}^0:when", NULL);
assert_blob_oid("stash@{1}^2:what", "dd7e1c6f0fefe118f0b63d9f10908c460aa317a6"); /* goodbye */
assert_blob_oid("stash@{1}^2:how", "e6d64adb2c7f3eb8feb493b556cc8070dca379a3"); /* not so small and */
assert_blob_oid("stash@{1}^2:who", "cc628ccd10742baea8241c5924df992b5c019f71"); /* world */
assert_blob_oid("stash@{1}^2:when", NULL);
assert_object_oid("stash@{1}^3", NULL, GIT_OBJECT_COMMIT);
assert_blob_oid("stash@{0}^0:what", "ce013625030ba8dba906f756967f9e9ca394464a"); /* hello */
assert_blob_oid("stash@{0}^0:how", "ac790413e2d7a26c3767e78c57bb28716686eebc"); /* small */
assert_blob_oid("stash@{0}^0:who", "cc628ccd10742baea8241c5924df992b5c019f71"); /* world */
assert_blob_oid("stash@{0}^0:when", NULL);
assert_blob_oid("stash@{0}^2:what", "ce013625030ba8dba906f756967f9e9ca394464a"); /* hello */
assert_blob_oid("stash@{0}^2:how", "ac790413e2d7a26c3767e78c57bb28716686eebc"); /* small */
assert_blob_oid("stash@{0}^2:who", "cc628ccd10742baea8241c5924df992b5c019f71"); /* world */
assert_blob_oid("stash@{0}^2:when", NULL);
assert_blob_oid("stash@{0}^3:when", "b6ed15e81e2593d7bb6265eb4a991d29dc3e628b"); /* now */
}
#define EMPTY_TREE "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
void test_stash_save__including_untracked_without_any_untracked_file_creates_an_empty_tree(void)
{
cl_must_pass(p_unlink("stash/when"));
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "how", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "who", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "when", GIT_ENOTFOUND);
assert_status(repo, "just.ignore", GIT_STATUS_IGNORED);
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED));
assert_object_oid("stash^3^{tree}", EMPTY_TREE, GIT_OBJECT_TREE);
}
void test_stash_save__ignored_directory(void)
{
cl_git_pass(p_mkdir("stash/ignored_directory", 0777));
cl_git_pass(p_mkdir("stash/ignored_directory/sub", 0777));
cl_git_mkfile("stash/ignored_directory/sub/some_file", "stuff");
assert_status(repo, "ignored_directory/sub/some_file", GIT_STATUS_WT_NEW);
cl_git_pass(git_ignore_add_rule(repo, "ignored_directory/"));
assert_status(repo, "ignored_directory/sub/some_file", GIT_STATUS_IGNORED);
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED | GIT_STASH_INCLUDE_IGNORED));
cl_assert(!git_path_exists("stash/ignored_directory/sub/some_file"));
cl_assert(!git_path_exists("stash/ignored_directory/sub"));
cl_assert(!git_path_exists("stash/ignored_directory"));
}
void test_stash_save__skip_submodules(void)
{
git_repository *untracked_repo;
cl_git_pass(git_repository_init(&untracked_repo, "stash/untracked_repo", false));
cl_git_mkfile("stash/untracked_repo/content", "stuff");
git_repository_free(untracked_repo);
assert_status(repo, "untracked_repo/", GIT_STATUS_WT_NEW);
cl_git_pass(git_stash_save(
&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED));
assert_status(repo, "untracked_repo/", GIT_STATUS_WT_NEW);
}
void test_stash_save__deleted_in_index_modified_in_workdir(void)
{
git_index *index;
git_repository_index(&index, repo);
cl_git_pass(git_index_remove_bypath(index, "who"));
cl_git_pass(git_index_write(index));
assert_status(repo, "who", GIT_STATUS_WT_NEW | GIT_STATUS_INDEX_DELETED);
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
assert_blob_oid("stash@{0}^0:who", "a0400d4954659306a976567af43125a0b1aa8595");
assert_blob_oid("stash@{0}^2:who", NULL);
git_index_free(index);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/stash/apply.c
|
#include "clar_libgit2.h"
#include "futils.h"
#include "stash_helpers.h"
static git_signature *signature;
static git_repository *repo;
static git_index *repo_index;
void test_stash_apply__initialize(void)
{
git_oid oid;
repo = cl_git_sandbox_init_new("stash");
cl_git_pass(git_repository_index(&repo_index, repo));
cl_git_pass(git_signature_new(&signature, "nulltoken", "[email protected]", 1323847743, 60)); /* Wed Dec 14 08:29:03 2011 +0100 */
cl_git_mkfile("stash/what", "hello\n");
cl_git_mkfile("stash/how", "small\n");
cl_git_mkfile("stash/who", "world\n");
cl_git_mkfile("stash/where", "meh\n");
cl_git_pass(git_index_add_bypath(repo_index, "what"));
cl_git_pass(git_index_add_bypath(repo_index, "how"));
cl_git_pass(git_index_add_bypath(repo_index, "who"));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Initial commit");
cl_git_rewritefile("stash/what", "goodbye\n");
cl_git_rewritefile("stash/who", "funky world\n");
cl_git_mkfile("stash/when", "tomorrow\n");
cl_git_mkfile("stash/why", "would anybody use stash?\n");
cl_git_mkfile("stash/where", "????\n");
cl_git_pass(git_index_add_bypath(repo_index, "who"));
cl_git_pass(git_index_add_bypath(repo_index, "why"));
cl_git_pass(git_index_add_bypath(repo_index, "where"));
cl_git_pass(git_index_write(repo_index));
cl_git_rewritefile("stash/where", "....\n");
/* Pre-stash state */
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_STATUS_INDEX_NEW);
assert_status(repo, "where", GIT_STATUS_INDEX_NEW|GIT_STATUS_WT_MODIFIED);
cl_git_pass(git_stash_save(&oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED));
/* Post-stash state */
assert_status(repo, "what", GIT_STATUS_CURRENT);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_CURRENT);
assert_status(repo, "when", GIT_ENOTFOUND);
assert_status(repo, "why", GIT_ENOTFOUND);
assert_status(repo, "where", GIT_ENOTFOUND);
}
void test_stash_apply__cleanup(void)
{
git_signature_free(signature);
signature = NULL;
git_index_free(repo_index);
repo_index = NULL;
cl_git_sandbox_cleanup();
}
void test_stash_apply__with_default(void)
{
git_buf where = GIT_BUF_INIT;
cl_git_pass(git_stash_apply(repo, 0, NULL));
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_STATUS_INDEX_NEW);
assert_status(repo, "where", GIT_STATUS_INDEX_NEW);
cl_git_pass(git_futils_readbuffer(&where, "stash/where"));
cl_assert_equal_s("....\n", where.ptr);
git_buf_dispose(&where);
}
void test_stash_apply__with_existing_file(void)
{
cl_git_mkfile("stash/where", "oops!\n");
cl_git_fail(git_stash_apply(repo, 0, NULL));
}
void test_stash_apply__merges_new_file(void)
{
const git_index_entry *ancestor, *our, *their;
cl_git_mkfile("stash/where", "committed before stash\n");
cl_git_pass(git_index_add_bypath(repo_index, "where"));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Other commit");
cl_git_pass(git_stash_apply(repo, 0, NULL));
cl_assert_equal_i(1, git_index_has_conflicts(repo_index));
assert_status(repo, "what", GIT_STATUS_INDEX_MODIFIED);
cl_git_pass(git_index_conflict_get(&ancestor, &our, &their, repo_index, "where")); /* unmerged */
assert_status(repo, "who", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_STATUS_INDEX_NEW);
}
void test_stash_apply__with_reinstate_index(void)
{
git_buf where = GIT_BUF_INIT;
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
opts.flags = GIT_STASH_APPLY_REINSTATE_INDEX;
cl_git_pass(git_stash_apply(repo, 0, &opts));
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_STATUS_INDEX_NEW);
assert_status(repo, "where", GIT_STATUS_INDEX_NEW | GIT_STATUS_WT_MODIFIED);
cl_git_pass(git_futils_readbuffer(&where, "stash/where"));
cl_assert_equal_s("....\n", where.ptr);
git_buf_dispose(&where);
}
void test_stash_apply__conflict_index_with_default(void)
{
const git_index_entry *ancestor;
const git_index_entry *our;
const git_index_entry *their;
cl_git_rewritefile("stash/who", "nothing\n");
cl_git_pass(git_index_add_bypath(repo_index, "who"));
cl_git_pass(git_index_write(repo_index));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Other commit");
cl_git_pass(git_stash_apply(repo, 0, NULL));
cl_assert_equal_i(git_index_has_conflicts(repo_index), 1);
assert_status(repo, "what", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "how", GIT_STATUS_CURRENT);
cl_git_pass(git_index_conflict_get(&ancestor, &our, &their, repo_index, "who")); /* unmerged */
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_STATUS_INDEX_NEW);
}
void test_stash_apply__conflict_index_with_reinstate_index(void)
{
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
opts.flags = GIT_STASH_APPLY_REINSTATE_INDEX;
cl_git_rewritefile("stash/who", "nothing\n");
cl_git_pass(git_index_add_bypath(repo_index, "who"));
cl_git_pass(git_index_write(repo_index));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Other commit");
cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_CURRENT);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_CURRENT);
assert_status(repo, "when", GIT_ENOTFOUND);
assert_status(repo, "why", GIT_ENOTFOUND);
}
void test_stash_apply__conflict_untracked_with_default(void)
{
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
cl_git_mkfile("stash/when", "nothing\n");
cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_CURRENT);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_CURRENT);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_ENOTFOUND);
}
void test_stash_apply__conflict_untracked_with_reinstate_index(void)
{
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
opts.flags = GIT_STASH_APPLY_REINSTATE_INDEX;
cl_git_mkfile("stash/when", "nothing\n");
cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_CURRENT);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_CURRENT);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_ENOTFOUND);
}
void test_stash_apply__conflict_workdir_with_default(void)
{
cl_git_rewritefile("stash/what", "ciao\n");
cl_git_fail_with(git_stash_apply(repo, 0, NULL), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_CURRENT);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_ENOTFOUND);
}
void test_stash_apply__conflict_workdir_with_reinstate_index(void)
{
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
opts.flags = GIT_STASH_APPLY_REINSTATE_INDEX;
cl_git_rewritefile("stash/what", "ciao\n");
cl_git_fail_with(git_stash_apply(repo, 0, &opts), GIT_ECONFLICT);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_CURRENT);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_ENOTFOUND);
}
void test_stash_apply__conflict_commit_with_default(void)
{
const git_index_entry *ancestor;
const git_index_entry *our;
const git_index_entry *their;
cl_git_rewritefile("stash/what", "ciao\n");
cl_git_pass(git_index_add_bypath(repo_index, "what"));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Other commit");
cl_git_pass(git_stash_apply(repo, 0, NULL));
cl_assert_equal_i(git_index_has_conflicts(repo_index), 1);
cl_git_pass(git_index_conflict_get(&ancestor, &our, &their, repo_index, "what")); /* unmerged */
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_STATUS_INDEX_NEW);
}
void test_stash_apply__conflict_commit_with_reinstate_index(void)
{
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
const git_index_entry *ancestor;
const git_index_entry *our;
const git_index_entry *their;
opts.flags = GIT_STASH_APPLY_REINSTATE_INDEX;
cl_git_rewritefile("stash/what", "ciao\n");
cl_git_pass(git_index_add_bypath(repo_index, "what"));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Other commit");
cl_git_pass(git_stash_apply(repo, 0, &opts));
cl_assert_equal_i(git_index_has_conflicts(repo_index), 1);
cl_git_pass(git_index_conflict_get(&ancestor, &our, &their, repo_index, "what")); /* unmerged */
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_STATUS_INDEX_NEW);
}
void test_stash_apply__fails_with_uncommitted_changes_in_index(void)
{
cl_git_rewritefile("stash/who", "nothing\n");
cl_git_pass(git_index_add_bypath(repo_index, "who"));
cl_git_pass(git_index_write(repo_index));
cl_git_fail_with(git_stash_apply(repo, 0, NULL), GIT_EUNCOMMITTED);
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_CURRENT);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_INDEX_MODIFIED);
assert_status(repo, "when", GIT_ENOTFOUND);
assert_status(repo, "why", GIT_ENOTFOUND);
}
void test_stash_apply__pop(void)
{
cl_git_pass(git_stash_pop(repo, 0, NULL));
cl_git_fail_with(git_stash_pop(repo, 0, NULL), GIT_ENOTFOUND);
}
struct seen_paths {
bool what;
bool how;
bool who;
bool when;
};
int checkout_notify(
git_checkout_notify_t why,
const char *path,
const git_diff_file *baseline,
const git_diff_file *target,
const git_diff_file *workdir,
void *payload)
{
struct seen_paths *seen_paths = (struct seen_paths *)payload;
GIT_UNUSED(why);
GIT_UNUSED(baseline);
GIT_UNUSED(target);
GIT_UNUSED(workdir);
if (strcmp(path, "what") == 0)
seen_paths->what = 1;
else if (strcmp(path, "how") == 0)
seen_paths->how = 1;
else if (strcmp(path, "who") == 0)
seen_paths->who = 1;
else if (strcmp(path, "when") == 0)
seen_paths->when = 1;
return 0;
}
void test_stash_apply__executes_notify_cb(void)
{
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
struct seen_paths seen_paths = {0};
opts.checkout_options.notify_cb = checkout_notify;
opts.checkout_options.notify_flags = GIT_CHECKOUT_NOTIFY_ALL;
opts.checkout_options.notify_payload = &seen_paths;
cl_git_pass(git_stash_apply(repo, 0, &opts));
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_STATUS_INDEX_NEW);
assert_status(repo, "where", GIT_STATUS_INDEX_NEW);
cl_assert_equal_b(true, seen_paths.what);
cl_assert_equal_b(false, seen_paths.how);
cl_assert_equal_b(true, seen_paths.who);
cl_assert_equal_b(true, seen_paths.when);
}
int progress_cb(
git_stash_apply_progress_t progress,
void *payload)
{
git_stash_apply_progress_t *p = (git_stash_apply_progress_t *)payload;
cl_assert_equal_i((*p)+1, progress);
*p = progress;
return 0;
}
void test_stash_apply__calls_progress_cb(void)
{
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
git_stash_apply_progress_t progress = GIT_STASH_APPLY_PROGRESS_NONE;
opts.progress_cb = progress_cb;
opts.progress_payload = &progress;
cl_git_pass(git_stash_apply(repo, 0, &opts));
cl_assert_equal_i(progress, GIT_STASH_APPLY_PROGRESS_DONE);
}
int aborting_progress_cb(
git_stash_apply_progress_t progress,
void *payload)
{
GIT_UNUSED(payload);
if (progress == GIT_STASH_APPLY_PROGRESS_ANALYZE_MODIFIED)
return -44;
return 0;
}
void test_stash_apply__progress_cb_can_abort(void)
{
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
opts.progress_cb = aborting_progress_cb;
cl_git_fail_with(-44, git_stash_apply(repo, 0, &opts));
}
void test_stash_apply__uses_reflog_like_indices_1(void)
{
git_oid oid;
cl_git_mkfile("stash/untracked", "untracked\n");
cl_git_pass(git_stash_save(&oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED));
assert_status(repo, "untracked", GIT_ENOTFOUND);
/* stash@{1} is the oldest (first) stash we made */
cl_git_pass(git_stash_apply(repo, 1, NULL));
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "what", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "how", GIT_STATUS_CURRENT);
assert_status(repo, "who", GIT_STATUS_WT_MODIFIED);
assert_status(repo, "when", GIT_STATUS_WT_NEW);
assert_status(repo, "why", GIT_STATUS_INDEX_NEW);
assert_status(repo, "where", GIT_STATUS_INDEX_NEW);
}
void test_stash_apply__uses_reflog_like_indices_2(void)
{
git_oid oid;
cl_git_mkfile("stash/untracked", "untracked\n");
cl_git_pass(git_stash_save(&oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED));
assert_status(repo, "untracked", GIT_ENOTFOUND);
/* stash@{0} is the newest stash we made immediately above */
cl_git_pass(git_stash_apply(repo, 0, NULL));
cl_assert_equal_i(git_index_has_conflicts(repo_index), 0);
assert_status(repo, "untracked", GIT_STATUS_WT_NEW);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/stash/foreach.c
|
#include "clar_libgit2.h"
#include "futils.h"
#include "stash_helpers.h"
struct callback_data
{
char **oids;
int invokes;
};
static git_repository *repo;
static git_signature *signature;
static git_oid stash_tip_oid;
struct callback_data data;
#define REPO_NAME "stash"
void test_stash_foreach__initialize(void)
{
cl_git_pass(git_signature_new(
&signature,
"nulltoken",
"[email protected]",
1323847743, 60)); /* Wed Dec 14 08:29:03 2011 +0100 */
memset(&data, 0, sizeof(struct callback_data));
}
void test_stash_foreach__cleanup(void)
{
git_signature_free(signature);
signature = NULL;
git_repository_free(repo);
repo = NULL;
cl_git_pass(git_futils_rmdir_r(REPO_NAME, NULL, GIT_RMDIR_REMOVE_FILES));
}
static int callback_cb(
size_t index,
const char* message,
const git_oid *stash_oid,
void *payload)
{
struct callback_data *data = (struct callback_data *)payload;
GIT_UNUSED(index);
GIT_UNUSED(message);
cl_assert_equal_i(0, git_oid_streq(stash_oid, data->oids[data->invokes++]));
return 0;
}
void test_stash_foreach__enumerating_a_empty_repository_doesnt_fail(void)
{
char *oids[] = { NULL };
data.oids = oids;
cl_git_pass(git_repository_init(&repo, REPO_NAME, 0));
cl_git_pass(git_stash_foreach(repo, callback_cb, &data));
cl_assert_equal_i(0, data.invokes);
}
void test_stash_foreach__can_enumerate_a_repository(void)
{
char *oids_default[] = {
"493568b7a2681187aaac8a58d3f1eab1527cba84", NULL };
char *oids_untracked[] = {
"7f89a8b15c878809c5c54d1ff8f8c9674154017b",
"493568b7a2681187aaac8a58d3f1eab1527cba84", NULL };
char *oids_ignored[] = {
"c95599a8fef20a7e57582c6727b1a0d02e0a5828",
"7f89a8b15c878809c5c54d1ff8f8c9674154017b",
"493568b7a2681187aaac8a58d3f1eab1527cba84", NULL };
cl_git_pass(git_repository_init(&repo, REPO_NAME, 0));
setup_stash(repo, signature);
cl_git_pass(git_stash_save(
&stash_tip_oid,
repo,
signature,
NULL,
GIT_STASH_DEFAULT));
data.oids = oids_default;
cl_git_pass(git_stash_foreach(repo, callback_cb, &data));
cl_assert_equal_i(1, data.invokes);
/* ensure stash_foreach operates with INCLUDE_UNTRACKED */
cl_git_pass(git_stash_save(
&stash_tip_oid,
repo,
signature,
NULL,
GIT_STASH_INCLUDE_UNTRACKED));
data.oids = oids_untracked;
data.invokes = 0;
cl_git_pass(git_stash_foreach(repo, callback_cb, &data));
cl_assert_equal_i(2, data.invokes);
/* ensure stash_foreach operates with INCLUDE_IGNORED */
cl_git_pass(git_stash_save(
&stash_tip_oid,
repo,
signature,
NULL,
GIT_STASH_INCLUDE_IGNORED));
data.oids = oids_ignored;
data.invokes = 0;
cl_git_pass(git_stash_foreach(repo, callback_cb, &data));
cl_assert_equal_i(3, data.invokes);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/stash/stash_helpers.c
|
#include "clar_libgit2.h"
#include "futils.h"
#include "stash_helpers.h"
void setup_stash(git_repository *repo, git_signature *signature)
{
git_index *index;
cl_git_pass(git_repository_index(&index, repo));
cl_git_mkfile("stash/what", "hello\n"); /* ce013625030ba8dba906f756967f9e9ca394464a */
cl_git_mkfile("stash/how", "small\n"); /* ac790413e2d7a26c3767e78c57bb28716686eebc */
cl_git_mkfile("stash/who", "world\n"); /* cc628ccd10742baea8241c5924df992b5c019f71 */
cl_git_mkfile("stash/when", "now\n"); /* b6ed15e81e2593d7bb6265eb4a991d29dc3e628b */
cl_git_mkfile("stash/just.ignore", "me\n"); /* 78925fb1236b98b37a35e9723033e627f97aa88b */
cl_git_mkfile("stash/.gitignore", "*.ignore\n");
cl_git_pass(git_index_add_bypath(index, "what"));
cl_git_pass(git_index_add_bypath(index, "how"));
cl_git_pass(git_index_add_bypath(index, "who"));
cl_git_pass(git_index_add_bypath(index, ".gitignore"));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Initial commit");
cl_git_rewritefile("stash/what", "goodbye\n"); /* dd7e1c6f0fefe118f0b63d9f10908c460aa317a6 */
cl_git_rewritefile("stash/how", "not so small and\n"); /* e6d64adb2c7f3eb8feb493b556cc8070dca379a3 */
cl_git_rewritefile("stash/who", "funky world\n"); /* a0400d4954659306a976567af43125a0b1aa8595 */
cl_git_mkfile("stash/why", "would anybody use stash?\n"); /* 88c2533e21f098b89c91a431d8075cbde422a51 */
cl_git_mkfile("stash/where", "????\n"); /* e08f7fbb9a42a0c5367cf8b349f1f08c3d56bd72 */
cl_git_pass(git_index_add_bypath(index, "what"));
cl_git_pass(git_index_add_bypath(index, "how"));
cl_git_pass(git_index_add_bypath(index, "why"));
cl_git_pass(git_index_add_bypath(index, "where"));
cl_git_pass(git_index_write(index));
cl_git_rewritefile("stash/what", "see you later\n"); /* bc99dc98b3eba0e9157e94769cd4d49cb49de449 */
cl_git_mkfile("stash/where", "....\n"); /* e3d6434ec12eb76af8dfa843a64ba6ab91014a0b */
git_index_free(index);
}
void assert_status(
git_repository *repo,
const char *path,
int status_flags)
{
unsigned int status;
if (status_flags < 0)
cl_assert_equal_i(status_flags, git_status_file(&status, repo, path));
else {
cl_git_pass(git_status_file(&status, repo, path));
cl_assert_equal_i((unsigned int)status_flags, status);
}
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/perf/helper__perf__timer.h
|
#if defined(GIT_WIN32)
struct perf__timer
{
LARGE_INTEGER sum;
LARGE_INTEGER time_started;
};
#define PERF_TIMER_INIT {0}
#else
struct perf__timer
{
uint32_t sum;
uint32_t time_started;
};
#define PERF_TIMER_INIT {0}
#endif
typedef struct perf__timer perf_timer;
void perf__timer__start(perf_timer *t);
void perf__timer__stop(perf_timer *t);
void perf__timer__report(perf_timer *t, const char *fmt, ...);
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/perf/merge.c
|
#include "clar_libgit2.h"
#include "helper__perf__do_merge.h"
/* This test requires a large repo with many files.
* It doesn't care about the contents, just the size.
*
* For now, we use the LibGit2 repo containing the
* source tree because it is already here.
*
* `find . | wc -l` reports 5128.
*
*/
#define SRC_REPO (cl_fixture("../.."))
/* We need 2 arbitrary commits within that repo
* that have a large number of changed files.
* Again, we don't care about the actual contents,
* just the size.
*
* For now, we use these public branches:
* maint/v0.21 d853fb9f24e0fe63b3dce9fbc04fd9cfe17a030b Always checkout with case sensitive iterator
* maint/v0.22 1ce9ea3ba9b4fa666602d52a5281d41a482cc58b checkout tests: cleanup realpath impl on Win32
*
*/
#define ID_BRANCH_A "d853fb9f24e0fe63b3dce9fbc04fd9cfe17a030b"
#define ID_BRANCH_B "1ce9ea3ba9b4fa666602d52a5281d41a482cc58b"
void test_perf_merge__m1(void)
{
perf__do_merge(SRC_REPO, "m1", ID_BRANCH_A, ID_BRANCH_B);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/perf/helper__perf__timer.c
|
#include "clar_libgit2.h"
#include "helper__perf__timer.h"
#if defined(GIT_WIN32)
void perf__timer__start(perf_timer *t)
{
QueryPerformanceCounter(&t->time_started);
}
void perf__timer__stop(perf_timer *t)
{
LARGE_INTEGER time_now;
QueryPerformanceCounter(&time_now);
t->sum.QuadPart += (time_now.QuadPart - t->time_started.QuadPart);
}
void perf__timer__report(perf_timer *t, const char *fmt, ...)
{
va_list arglist;
LARGE_INTEGER freq;
double fraction;
QueryPerformanceFrequency(&freq);
fraction = ((double)t->sum.QuadPart) / ((double)freq.QuadPart);
printf("%10.3f: ", fraction);
va_start(arglist, fmt);
vprintf(fmt, arglist);
va_end(arglist);
printf("\n");
}
#else
#include <sys/time.h>
static uint32_t now_in_ms(void)
{
struct timeval now;
gettimeofday(&now, NULL);
return (uint32_t)((now.tv_sec * 1000) + (now.tv_usec / 1000));
}
void perf__timer__start(perf_timer *t)
{
t->time_started = now_in_ms();
}
void perf__timer__stop(perf_timer *t)
{
uint32_t now = now_in_ms();
t->sum += (now - t->time_started);
}
void perf__timer__report(perf_timer *t, const char *fmt, ...)
{
va_list arglist;
printf("%10.3f: ", ((double)t->sum) / 1000);
va_start(arglist, fmt);
vprintf(fmt, arglist);
va_end(arglist);
printf("\n");
}
#endif
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/perf/helper__perf__do_merge.c
|
#include "clar_libgit2.h"
#include "helper__perf__do_merge.h"
#include "helper__perf__timer.h"
static git_repository * g_repo;
void perf__do_merge(const char *fixture,
const char *test_name,
const char *id_a,
const char *id_b)
{
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
git_clone_options clone_opts = GIT_CLONE_OPTIONS_INIT;
git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT;
git_oid oid_a;
git_oid oid_b;
git_reference *ref_branch_a = NULL;
git_reference *ref_branch_b = NULL;
git_commit *commit_a = NULL;
git_commit *commit_b = NULL;
git_annotated_commit *annotated_commits[1] = { NULL };
perf_timer t_total = PERF_TIMER_INIT;
perf_timer t_clone = PERF_TIMER_INIT;
perf_timer t_checkout = PERF_TIMER_INIT;
perf_timer t_merge = PERF_TIMER_INIT;
perf__timer__start(&t_total);
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
clone_opts.checkout_opts = checkout_opts;
perf__timer__start(&t_clone);
cl_git_pass(git_clone(&g_repo, fixture, test_name, &clone_opts));
perf__timer__stop(&t_clone);
git_oid_fromstr(&oid_a, id_a);
cl_git_pass(git_commit_lookup(&commit_a, g_repo, &oid_a));
cl_git_pass(git_branch_create(&ref_branch_a, g_repo,
"A", commit_a,
0));
perf__timer__start(&t_checkout);
cl_git_pass(git_checkout_tree(g_repo, (git_object*)commit_a, &checkout_opts));
perf__timer__stop(&t_checkout);
cl_git_pass(git_repository_set_head(g_repo, git_reference_name(ref_branch_a)));
git_oid_fromstr(&oid_b, id_b);
cl_git_pass(git_commit_lookup(&commit_b, g_repo, &oid_b));
cl_git_pass(git_branch_create(&ref_branch_b, g_repo,
"B", commit_b,
0));
cl_git_pass(git_annotated_commit_lookup(&annotated_commits[0], g_repo, &oid_b));
perf__timer__start(&t_merge);
cl_git_pass(git_merge(g_repo,
(const git_annotated_commit **)annotated_commits, 1,
&merge_opts, &checkout_opts));
perf__timer__stop(&t_merge);
git_reference_free(ref_branch_a);
git_reference_free(ref_branch_b);
git_commit_free(commit_a);
git_commit_free(commit_b);
git_annotated_commit_free(annotated_commits[0]);
git_repository_free(g_repo);
perf__timer__stop(&t_total);
perf__timer__report(&t_clone, "%s: clone", test_name);
perf__timer__report(&t_checkout, "%s: checkout", test_name);
perf__timer__report(&t_merge, "%s: merge", test_name);
perf__timer__report(&t_total, "%s: total", test_name);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/perf/helper__perf__do_merge.h
|
void perf__do_merge(const char *fixture,
const char *test_name,
const char *id_a,
const char *id_b);
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/pack_data.h
|
static const char *packed_objects[] = {
"0266163a49e280c4f5ed1e08facd36a2bd716bcf",
"53fc32d17276939fc79ed05badaef2db09990016",
"6336846bd5c88d32f93ae57d846683e61ab5c530",
"6dcf9bf7541ee10456529833502442f385010c3d",
"bed08a0b30b72a9d4aed7f1af8c8ca124e8d64b9",
"e90810b8df3e80c413d903f631643c716887138d",
"fc3c3a2083e9f6f89e6bd53e9420e70d1e357c9b",
"fc58168adf502d0c0ef614c3111a7038fc8c09c8",
"fd0ec0333948dfe23265ac46be0205a436a8c3a5",
"fd8430bc864cfcd5f10e5590f8a447e01b942bfe",
"fd899f45951c15c1c5f7c34b1c864e91bd6556c6",
"fda23b974899e7e1f938619099280bfda13bdca9",
"fdbec189efb657c8325962b494875987881a356b",
"fe1ca6bd22b5d8353ce6c2f3aba80805c438a7a5",
"fe3a6a42c87ff1239370c741a265f3997add87c1",
"deb106bfd2d36ecf9f0079224c12022201a39ad1",
"dec93efc79e60f2680de3e666755d335967eec30",
"def425bf8568b9c1e20879bf5be6f9c52b7361c4",
"df48000ac4f48570054e3a71a81916357997b680",
"dfae6ed8f6dd8acc3b40a31811ea316239223559",
"dff79e27d3d2cdc09790ded80fe2ea8ff5d61034",
"e00e46abe4c542e17c8bc83d72cf5be8018d7b0e",
"e01b107b4f77f8f98645adac0206a504f2d29d7c",
"e032d863f512c47b479bd984f8b6c8061f66b7d4",
"e044baa468a1c74f9f9da36805445f6888358b49",
"e04529998989ba8ae3419538dd57969af819b241",
"e0637ddfbea67c8d7f557c709e095af8906e9176",
"e0743ad4031231e71700abdc6fdbe94f189d20e5",
"cf33ac7a3d8b2b8f6bb266518aadbf59de397608",
"cf5f7235b9c9689b133f6ea12015720b411329bd",
"cf6cccf1297284833a9a03138a1f5738fa1c6c94",
"cf7992bde17ce7a79cab5f0c1fcbe8a0108721ed",
"cfe3a027ab12506d4144ee8a35669ae8fc4b7ab1",
"cfe96f31dfad7bab49977aa1df7302f7fafcb025",
"cff54d138945ef4de384e9d2759291d0c13ea90a",
"d01f7573ac34c2f502bd1cf18cde73480c741151",
"d03f567593f346a1ca96a57f8191def098d126e3",
"d047b47aadf88501238f36f5c17dd0a50dc62087",
"d0a0d63086fae3b0682af7261df21f7d0f7f066d",
"d0a44bd6ed0be21b725a96c0891bbc79bc1a540c",
"d0d7e736e536a41bcb885005f8bf258c61cad682",
"d0e7959d4b95ffec6198df6f5a7ae259b23a5f50",
"bf2fe2acca17d13356ce802ba9dc8343f710dfb7",
"bf55f407d6d9418e51f42ea7a3a6aadf17388349",
"bf92206f8b633b88a66dca4a911777630b06fbac",
"bfaf8c42eb8842abe206179fee864cfba87e3ca9",
"bfe05675d4e8f6b59d50932add8790f1a06b10ee",
"bff8618112330763327cfa6ce6e914db84f51ddf",
"bff873e9853ed99fed52c25f7ad29f78b27dcec2",
"c01c3fae7251098d7af1b459bcd0786e81d4616d",
"c0220fca67f48b8a5d4163d53b1486224be3a198",
"c02d0b160b82ee72469c269f13de4c26a7ea09cb",
"c059510ad1b45ab58390e042d7dee1ac46703854",
"c07204a1897aeeaa3c248d29dbfa9b033baf9755",
"c073337a4dd7276931b4b3fdbc3f0040e9441793",
"0fd7e4bfba5b3a82be88d1057757ca8b2c5e6d26",
"100746511cc45c9f1ad6721c4ef5be49222fee4d",
"1088490171d9b984d68b8b9be9ca003f4eafff59",
"1093c8ff4cb78fcf5f79dbbeedcb6e824bd4e253",
"10aa3fa72afab7ee31e116ae06442fe0f7b79df2",
"10b759e734e8299aa0dca08be935d95d886127b6",
"111d5ccf0bb010c4e8d7af3eedfa12ef4c5e265b",
"11261fbff21758444d426356ff6327ee01e90752",
"112998d425717bb922ce74e8f6f0f831d8dc4510",
"2ef4e5d838b6507bd61d457cf6466662b791c5c0",
"2ef4faa0f82efa00eeac6cae9e8b2abccc8566ee",
"2f06098183b0d7be350acbe39cdbaccff2df0c4a",
"2f1c5d509ac5bffb3c62f710a1c2c542e126dfd1",
"2f205b20fc16423c42b3ba51b2ea78d7b9ff3578",
"2f9b6b6e3d9250ba09360734aa47973a993b59d1",
"30c62a2d5a8d644f1311d4f7fe3f6a788e4c8188",
"31438e245492d85fd6da4d1406eba0fbde8332a4",
"3184a3abdfea231992254929ff4e275898e5bbf6",
"3188ffdbb3a3d52e0f78f30c484533899224436e",
"32581d0093429770d044a60eb0e9cc0462bedb13",
"32679a9544d83e5403202c4d5efb61ad02492847",
"4e7e9f60b7e2049b7f5697daf133161a18ef688f",
"4e8cda27ddc8be7db875ceb0f360c37734724c6d",
"4ea481c61c59ab55169b7cbaae536ad50b49d6f0",
"4f0adcd0e61eabe06fe32be66b16559537124b7a",
"4f1355c91100d12f9e7202f91b245df0c110867c",
"4f6eadeb08b9d0d1e8b1b3eac8a34940adf29a2d",
"4f9339df943c53117a5fc8e86e2f38716ff3a668",
"4fc3874b118752e40de556b1c3e7b4a9f1737d00",
"4ff1dd0992dd6baafdb5e166be6f9f23b59bdf87",
"5018a35e0b7e2eec7ce5050baf9c7343f3f74164",
"50298f44a45eda3a29dae82dbe911b5aa176ac07",
"502acd164fb115768d723144da2e7bb5a24891bb",
"50330c02bd4fd95c9db1fcf2f97f4218e42b7226",
"5052bf355d9f8c52446561a39733a8767bf31e37",
"6f2cd729ae42988c1dd43588d3a6661ba48ad7a0",
"6f4e2c42d9138bfbf3e0f908f1308828cc6f2178",
"6f6a17db05a83620cef4572761831c20a70ba9b9",
"6faad60901e36538634f0d8b8ff3f21f83503c71",
"6fc72e46de3df0c3842dab302bbacf697a63abab",
"6fdccd49f442a7204399ca9b418f017322dbded8",
"6fe7568fc3861c334cb008fd85d57d9647249ef5",
"700f55d91d7b55665594676a4bada1f1457a0598",
"702bd70595a7b19afc48a1f784a6505be68469d4",
"7033f9ee0e52b08cb5679cd49b7b7999eaf9eaf8",
"70957110ce446c4e250f865760fb3da513cdcc92",
"8ec696a4734f16479d091bc70574d23dd9fe7443",
"8ed341c55ed4d6f4cdc8bf4f0ca18a08c93f6962",
"8edc2805f1f11b63e44bf81f4557f8b473612b69",
"8ef9060a954118a698fc10e20acdc430566a100f",
"8f0c4b543f4bb6eb1518ecfc3d4699e43108d393",
"8fac94df3035405c2e60b3799153ce7c428af6b9",
"904c0ac12b23548de524adae712241b423d765a3",
"90bbaa9a809c3a768d873a9cc7d52b4f3bf3d1b9",
"90d4d2f0fc362beabbbf76b4ffda0828229c198d",
"90f9ff6755330b685feff6c3d81782ee3592ab04",
"91822c50ebe4f9bf5bbb8308ecf9f6557062775c",
"91d973263a55708fa8255867b3202d81ef9c2868",
"af292c99c6148d772af3315a1c74e83330e7ead7",
"af3b99d5be330dbbce0b9250c3a5fb05911908cc",
"af55d0cdeb280af2db8697e5afa506e081012719",
"af795e498d411142ddb073e8ca2c5447c3295a4c",
"afadc73a392f8cc8e2cc77dd62a7433dd3bafa8c",
"affd84ed8ec7ce67612fe3c12a80f8164b101f6a",
"b0941f9c70ffe67f0387a827b338e64ecf3190f0",
"b0a3077f9ef6e093f8d9869bdb0c07095bd722cb",
"b0a8568a7614806378a54db5706ee3b06ae58693",
"b0fb7372f242233d1d35ce7d8e74d3990cbc5841",
"b10489944b9ead17427551759d180d10203e06ba",
"b196a807b323f2748ffc6b1d42cd0812d04c9a40",
"b1bb1d888f0c5e19278536d49fa77db035fac7ae"
};
static const char *loose_objects[] = {
"45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
"a8233120f6ad708f843d861ce2b7228ec4e3dec6",
"fd093bff70906175335656e6ce6ae05783708765",
"c47800c7266a2be04c571c04d5a6614691ea99bd",
"a71586c1dfe8a71c6cbf6c129f404c5642ff31bd",
"8496071c1b46c854b31185ea97743be6a8774479",
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
"814889a078c031f61ed08ab5fa863aea9314344d",
"5b5b025afb0b4c913b4c338a42934a3863bf3644",
"1385f264afb75a56a5bec74243be9b367ba4ca08",
"f60079018b664e4e79329a7ef9559c8d9e0378d1",
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644",
"75057dd4114e74cca1d750d0aee1647c903cb60a",
"fa49b077972391ad58037050f2a75f74e3671e92",
"9fd738e8f7967c078dceed8190330fc8648ee56a",
"1810dff58d8a660512d4832e740f692884338ccd",
"181037049a54a1eb5fab404658a3a250b44335d7",
"a4a7dce85cf63874e984719f4fdd239f5145052f",
"4a202b346bb0fb0db7eff3cffeb3c70babbd2045"
};
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/largefiles.c
|
#include "clar_libgit2.h"
#include "git2/odb_backend.h"
#include "hash.h"
#include "odb.h"
#define LARGEFILE_SIZE 5368709122
static git_repository *repo;
static git_odb *odb;
void test_odb_largefiles__initialize(void)
{
repo = cl_git_sandbox_init("testrepo.git");
cl_git_pass(git_repository_odb(&odb, repo));
}
void test_odb_largefiles__cleanup(void)
{
git_odb_free(odb);
cl_git_sandbox_cleanup();
}
static void writefile(git_oid *oid)
{
static git_odb_stream *stream;
git_buf buf = GIT_BUF_INIT;
size_t i;
for (i = 0; i < 3041; i++)
cl_git_pass(git_buf_puts(&buf, "Hello, world.\n"));
cl_git_pass(git_odb_open_wstream(&stream, odb, LARGEFILE_SIZE, GIT_OBJECT_BLOB));
for (i = 0; i < 126103; i++)
cl_git_pass(git_odb_stream_write(stream, buf.ptr, buf.size));
cl_git_pass(git_odb_stream_finalize_write(oid, stream));
git_odb_stream_free(stream);
git_buf_dispose(&buf);
}
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_OBJECT_BLOB));
cl_assert_equal_oid(&expected, &oid);
}
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_object_t 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_OBJECT_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_odb_largefiles__read_into_memory(void)
{
git_oid oid;
git_odb_object *obj;
#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();
writefile(&oid);
cl_git_pass(git_odb_read(&obj, odb, &oid));
git_odb_object_free(obj);
}
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_object_t 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_OBJECT_BLOB, type);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/alternates.c
|
#include "clar_libgit2.h"
#include "odb.h"
#include "filebuf.h"
static git_buf destpath, filepath;
static const char *paths[] = {
"A.git", "B.git", "C.git", "D.git", "E.git", "F.git", "G.git"
};
static git_filebuf file;
static git_repository *repo;
void test_odb_alternates__cleanup(void)
{
size_t i;
git_buf_dispose(&destpath);
git_buf_dispose(&filepath);
for (i = 0; i < ARRAY_SIZE(paths); i++)
cl_fixture_cleanup(paths[i]);
}
static void init_linked_repo(const char *path, const char *alternate)
{
git_buf_clear(&destpath);
git_buf_clear(&filepath);
cl_git_pass(git_repository_init(&repo, path, 1));
cl_git_pass(git_path_prettify(&destpath, alternate, NULL));
cl_git_pass(git_buf_joinpath(&destpath, destpath.ptr, "objects"));
cl_git_pass(git_buf_joinpath(&filepath, git_repository_path(repo), "objects/info"));
cl_git_pass(git_futils_mkdir(filepath.ptr, 0755, GIT_MKDIR_PATH));
cl_git_pass(git_buf_joinpath(&filepath, filepath.ptr , "alternates"));
cl_git_pass(git_filebuf_open(&file, git_buf_cstr(&filepath), 0, 0666));
git_filebuf_printf(&file, "%s\n", git_buf_cstr(&destpath));
cl_git_pass(git_filebuf_commit(&file));
git_repository_free(repo);
}
void test_odb_alternates__chained(void)
{
git_commit *commit;
git_oid oid;
/* Set the alternate A -> testrepo.git */
init_linked_repo(paths[0], cl_fixture("testrepo.git"));
/* Set the alternate B -> A */
init_linked_repo(paths[1], paths[0]);
/* Now load B and see if we can find an object from testrepo.git */
cl_git_pass(git_repository_open(&repo, paths[1]));
git_oid_fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
git_commit_free(commit);
git_repository_free(repo);
}
void test_odb_alternates__long_chain(void)
{
git_commit *commit;
git_oid oid;
size_t i;
/* Set the alternate A -> testrepo.git */
init_linked_repo(paths[0], cl_fixture("testrepo.git"));
/* Set up the five-element chain */
for (i = 1; i < ARRAY_SIZE(paths); i++) {
init_linked_repo(paths[i], paths[i-1]);
}
/* Now load the last one and see if we can find an object from testrepo.git */
cl_git_pass(git_repository_open(&repo, paths[ARRAY_SIZE(paths)-1]));
git_oid_fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
cl_git_fail(git_commit_lookup(&commit, repo, &oid));
git_repository_free(repo);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/loose.c
|
#include "clar_libgit2.h"
#include "odb.h"
#include "git2/odb_backend.h"
#include "posix.h"
#include "loose_data.h"
#include "repository.h"
#ifdef __ANDROID_API__
# define S_IREAD S_IRUSR
# define S_IWRITE S_IWUSR
#endif
static void write_object_files(object_data *d)
{
int fd;
if (p_mkdir(d->dir, GIT_OBJECT_DIR_MODE) < 0)
cl_assert(errno == EEXIST);
cl_assert((fd = p_creat(d->file, S_IREAD | S_IWRITE)) >= 0);
cl_must_pass(p_write(fd, d->bytes, d->blen));
p_close(fd);
}
static void cmp_objects(git_rawobj *o, object_data *d)
{
cl_assert(o->type == git_object_string2type(d->type));
cl_assert(o->len == d->dlen);
if (o->len > 0)
cl_assert(memcmp(o->data, d->data, o->len) == 0);
}
static void test_read_object(object_data *data)
{
git_oid id;
git_odb_object *obj;
git_odb *odb;
git_rawobj tmp;
write_object_files(data);
cl_git_pass(git_odb_open(&odb, "test-objects"));
cl_git_pass(git_oid_fromstr(&id, data->id));
cl_git_pass(git_odb_read(&obj, odb, &id));
tmp.data = obj->buffer;
tmp.len = obj->cached.size;
tmp.type = obj->cached.type;
cmp_objects(&tmp, data);
git_odb_object_free(obj);
git_odb_free(odb);
}
static void test_read_header(object_data *data)
{
git_oid id;
git_odb *odb;
size_t len;
git_object_t type;
write_object_files(data);
cl_git_pass(git_odb_open(&odb, "test-objects"));
cl_git_pass(git_oid_fromstr(&id, data->id));
cl_git_pass(git_odb_read_header(&len, &type, odb, &id));
cl_assert_equal_sz(data->dlen, len);
cl_assert_equal_i(git_object_string2type(data->type), type);
git_odb_free(odb);
}
static void test_readstream_object(object_data *data, size_t blocksize)
{
git_oid id;
git_odb *odb;
git_odb_stream *stream;
git_rawobj tmp;
char buf[2048], *ptr = buf;
size_t remain;
int ret;
write_object_files(data);
cl_git_pass(git_odb_open(&odb, "test-objects"));
cl_git_pass(git_oid_fromstr(&id, data->id));
cl_git_pass(git_odb_open_rstream(&stream, &tmp.len, &tmp.type, odb, &id));
remain = tmp.len;
while (remain) {
cl_assert((ret = git_odb_stream_read(stream, ptr, blocksize)) >= 0);
if (ret == 0)
break;
cl_assert(remain >= (size_t)ret);
remain -= ret;
ptr += ret;
}
cl_assert(remain == 0);
tmp.data = buf;
cmp_objects(&tmp, data);
git_odb_stream_free(stream);
git_odb_free(odb);
}
void test_odb_loose__initialize(void)
{
p_fsync__cnt = 0;
cl_must_pass(p_mkdir("test-objects", GIT_OBJECT_DIR_MODE));
}
void test_odb_loose__cleanup(void)
{
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_FSYNC_GITDIR, 0));
cl_fixture_cleanup("test-objects");
}
void test_odb_loose__exists(void)
{
git_oid id, id2;
git_odb *odb;
write_object_files(&one);
cl_git_pass(git_odb_open(&odb, "test-objects"));
cl_git_pass(git_oid_fromstr(&id, one.id));
cl_assert(git_odb_exists(odb, &id));
cl_git_pass(git_oid_fromstrp(&id, "8b137891"));
cl_git_pass(git_odb_exists_prefix(&id2, odb, &id, 8));
cl_assert_equal_i(0, git_oid_streq(&id2, one.id));
/* Test for a missing object */
cl_git_pass(git_oid_fromstr(&id, "8b137891791fe96927ad78e64b0aad7bded08baa"));
cl_assert(!git_odb_exists(odb, &id));
cl_git_pass(git_oid_fromstrp(&id, "8b13789a"));
cl_assert_equal_i(GIT_ENOTFOUND, git_odb_exists_prefix(&id2, odb, &id, 8));
git_odb_free(odb);
}
void test_odb_loose__simple_reads(void)
{
test_read_object(&commit);
test_read_object(&tree);
test_read_object(&tag);
test_read_object(&zero);
test_read_object(&one);
test_read_object(&two);
test_read_object(&some);
}
void test_odb_loose__streaming_reads(void)
{
size_t blocksizes[] = { 1, 2, 4, 16, 99, 1024, 123456789 };
size_t i;
for (i = 0; i < ARRAY_SIZE(blocksizes); i++) {
test_readstream_object(&commit, blocksizes[i]);
test_readstream_object(&tree, blocksizes[i]);
test_readstream_object(&tag, blocksizes[i]);
test_readstream_object(&zero, blocksizes[i]);
test_readstream_object(&one, blocksizes[i]);
test_readstream_object(&two, blocksizes[i]);
test_readstream_object(&some, blocksizes[i]);
}
}
void test_odb_loose__read_header(void)
{
test_read_header(&commit);
test_read_header(&tree);
test_read_header(&tag);
test_read_header(&zero);
test_read_header(&one);
test_read_header(&two);
test_read_header(&some);
}
void test_write_object_permission(
mode_t dir_mode, mode_t file_mode,
mode_t expected_dir_mode, mode_t expected_file_mode)
{
git_odb *odb;
git_odb_backend *backend;
git_oid oid;
struct stat statbuf;
mode_t mask, os_mask;
/* Windows does not return group/user bits from stat,
* files are never executable.
*/
#ifdef GIT_WIN32
os_mask = 0600;
#else
os_mask = 0777;
#endif
mask = p_umask(0);
p_umask(mask);
cl_git_pass(git_odb_new(&odb));
cl_git_pass(git_odb_backend_loose(&backend, "test-objects", -1, 0, dir_mode, file_mode));
cl_git_pass(git_odb_add_backend(odb, backend, 1));
cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJECT_BLOB));
cl_git_pass(p_stat("test-objects/67", &statbuf));
cl_assert_equal_i(statbuf.st_mode & os_mask, (expected_dir_mode & ~mask) & os_mask);
cl_git_pass(p_stat("test-objects/67/b808feb36201507a77f85e6d898f0a2836e4a5", &statbuf));
cl_assert_equal_i(statbuf.st_mode & os_mask, (expected_file_mode & ~mask) & os_mask);
git_odb_free(odb);
}
void test_odb_loose__permissions_standard(void)
{
test_write_object_permission(0, 0, GIT_OBJECT_DIR_MODE, GIT_OBJECT_FILE_MODE);
}
void test_odb_loose_permissions_readonly(void)
{
test_write_object_permission(0777, 0444, 0777, 0444);
}
void test_odb_loose__permissions_readwrite(void)
{
test_write_object_permission(0777, 0666, 0777, 0666);
}
static void write_object_to_loose_odb(int fsync)
{
git_odb *odb;
git_odb_backend *backend;
git_oid oid;
cl_git_pass(git_odb_new(&odb));
cl_git_pass(git_odb_backend_loose(&backend, "test-objects", -1, fsync, 0777, 0666));
cl_git_pass(git_odb_add_backend(odb, backend, 1));
cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJECT_BLOB));
git_odb_free(odb);
}
void test_odb_loose__does_not_fsync_by_default(void)
{
write_object_to_loose_odb(0);
cl_assert_equal_sz(0, p_fsync__cnt);
}
void test_odb_loose__fsync_obeys_odb_option(void)
{
write_object_to_loose_odb(1);
cl_assert(p_fsync__cnt > 0);
}
void test_odb_loose__fsync_obeys_global_setting(void)
{
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_FSYNC_GITDIR, 1));
write_object_to_loose_odb(0);
cl_assert(p_fsync__cnt > 0);
}
void test_odb_loose__fsync_obeys_repo_setting(void)
{
git_repository *repo;
git_odb *odb;
git_oid oid;
cl_git_pass(git_repository_init(&repo, "test-objects", 1));
cl_git_pass(git_repository_odb__weakptr(&odb, repo));
cl_git_pass(git_odb_write(&oid, odb, "No fsync here\n", 14, GIT_OBJECT_BLOB));
cl_assert(p_fsync__cnt == 0);
git_repository_free(repo);
cl_git_pass(git_repository_open(&repo, "test-objects"));
cl_repo_set_bool(repo, "core.fsyncObjectFiles", true);
cl_git_pass(git_repository_odb__weakptr(&odb, repo));
cl_git_pass(git_odb_write(&oid, odb, "Now fsync\n", 10, GIT_OBJECT_BLOB));
cl_assert(p_fsync__cnt > 0);
git_repository_free(repo);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/emptyobjects.c
|
#include "clar_libgit2.h"
#include "odb.h"
#include "filebuf.h"
#define TEST_REPO_PATH "redundant.git"
git_repository *g_repo;
git_odb *g_odb;
void test_odb_emptyobjects__initialize(void)
{
g_repo = cl_git_sandbox_init(TEST_REPO_PATH);
cl_git_pass(git_repository_odb(&g_odb, g_repo));
}
void test_odb_emptyobjects__cleanup(void)
{
git_odb_free(g_odb);
cl_git_sandbox_cleanup();
}
void test_odb_emptyobjects__blob_notfound(void)
{
git_oid id, written_id;
git_blob *blob;
cl_git_pass(git_oid_fromstr(&id, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"));
cl_git_fail_with(GIT_ENOTFOUND, git_blob_lookup(&blob, g_repo, &id));
cl_git_pass(git_odb_write(&written_id, g_odb, "", 0, GIT_OBJECT_BLOB));
cl_assert(git_path_exists(TEST_REPO_PATH "/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391"));
}
void test_odb_emptyobjects__read_tree(void)
{
git_oid id;
git_tree *tree;
cl_git_pass(git_oid_fromstr(&id, "4b825dc642cb6eb9a060e54bf8d69288fbee4904"));
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
cl_assert_equal_i(GIT_OBJECT_TREE, git_object_type((git_object *) tree));
cl_assert_equal_i(0, git_tree_entrycount(tree));
cl_assert_equal_p(NULL, git_tree_entry_byname(tree, "foo"));
git_tree_free(tree);
}
void test_odb_emptyobjects__read_tree_odb(void)
{
git_oid id;
git_odb_object *tree_odb;
cl_git_pass(git_oid_fromstr(&id, "4b825dc642cb6eb9a060e54bf8d69288fbee4904"));
cl_git_pass(git_odb_read(&tree_odb, g_odb, &id));
cl_assert(git_odb_object_data(tree_odb));
cl_assert_equal_s("", git_odb_object_data(tree_odb));
cl_assert_equal_i(0, git_odb_object_size(tree_odb));
git_odb_object_free(tree_odb);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/sorting.c
|
#include "clar_libgit2.h"
#include "git2/sys/odb_backend.h"
#include "odb.h"
typedef struct {
git_odb_backend base;
size_t position;
} fake_backend;
static git_odb_backend *new_backend(size_t position)
{
fake_backend *b;
b = git__calloc(1, sizeof(fake_backend));
if (b == NULL)
return NULL;
b->base.free = (void (*)(git_odb_backend *)) git__free;
b->base.version = GIT_ODB_BACKEND_VERSION;
b->position = position;
return (git_odb_backend *)b;
}
static void check_backend_sorting(git_odb *odb)
{
size_t i, max_i = git_odb_num_backends(odb);
fake_backend *internal;
for (i = 0; i < max_i; ++i) {
cl_git_pass(git_odb_get_backend((git_odb_backend **)&internal, odb, i));
cl_assert(internal != NULL);
cl_assert_equal_sz(i, internal->position);
}
}
static git_odb *_odb;
void test_odb_sorting__initialize(void)
{
cl_git_pass(git_odb_new(&_odb));
}
void test_odb_sorting__cleanup(void)
{
git_odb_free(_odb);
_odb = NULL;
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_ODB_LOOSE_PRIORITY,
GIT_ODB_DEFAULT_LOOSE_PRIORITY));
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_ODB_PACKED_PRIORITY,
GIT_ODB_DEFAULT_PACKED_PRIORITY));
}
void test_odb_sorting__basic_backends_sorting(void)
{
cl_git_pass(git_odb_add_backend(_odb, new_backend(0), 5));
cl_git_pass(git_odb_add_backend(_odb, new_backend(2), 3));
cl_git_pass(git_odb_add_backend(_odb, new_backend(1), 4));
cl_git_pass(git_odb_add_backend(_odb, new_backend(3), 1));
check_backend_sorting(_odb);
}
void test_odb_sorting__alternate_backends_sorting(void)
{
cl_git_pass(git_odb_add_backend(_odb, new_backend(1), 5));
cl_git_pass(git_odb_add_backend(_odb, new_backend(5), 3));
cl_git_pass(git_odb_add_backend(_odb, new_backend(3), 4));
cl_git_pass(git_odb_add_backend(_odb, new_backend(7), 1));
cl_git_pass(git_odb_add_alternate(_odb, new_backend(0), 5));
cl_git_pass(git_odb_add_alternate(_odb, new_backend(4), 3));
cl_git_pass(git_odb_add_alternate(_odb, new_backend(2), 4));
cl_git_pass(git_odb_add_alternate(_odb, new_backend(6), 1));
check_backend_sorting(_odb);
}
void test_odb_sorting__override_default_backend_priority(void)
{
git_odb *new_odb;
git_odb_backend *loose, *packed, *backend;
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_ODB_LOOSE_PRIORITY, 5));
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_ODB_PACKED_PRIORITY, 3));
git_odb_backend_pack(&packed, "./testrepo.git/objects");
git_odb_backend_loose(&loose, "./testrepo.git/objects", -1, 0, 0, 0);
cl_git_pass(git_odb_open(&new_odb, cl_fixture("testrepo.git/objects")));
cl_assert_equal_sz(2, git_odb_num_backends(new_odb));
cl_git_pass(git_odb_get_backend(&backend, new_odb, 0));
cl_assert_equal_p(loose->read, backend->read);
cl_git_pass(git_odb_get_backend(&backend, new_odb, 1));
cl_assert_equal_p(packed->read, backend->read);
git_odb_free(new_odb);
loose->free(loose);
packed->free(packed);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/streamwrite.c
|
#include "clar_libgit2.h"
#include "git2/odb_backend.h"
static git_repository *repo;
static git_odb *odb;
static git_odb_stream *stream;
void test_odb_streamwrite__initialize(void)
{
repo = cl_git_sandbox_init("testrepo.git");
cl_git_pass(git_repository_odb(&odb, repo));
cl_git_pass(git_odb_open_wstream(&stream, odb, 14, GIT_OBJECT_BLOB));
cl_assert_equal_sz(14, stream->declared_size);
}
void test_odb_streamwrite__cleanup(void)
{
git_odb_stream_free(stream);
git_odb_free(odb);
cl_git_sandbox_cleanup();
}
void test_odb_streamwrite__can_accept_chunks(void)
{
git_oid oid;
cl_git_pass(git_odb_stream_write(stream, "deadbeef", 8));
cl_assert_equal_sz(8, stream->received_bytes);
cl_git_pass(git_odb_stream_write(stream, "deadbeef", 6));
cl_assert_equal_sz(8 + 6, stream->received_bytes);
cl_git_pass(git_odb_stream_finalize_write(&oid, stream));
}
void test_odb_streamwrite__can_detect_missing_bytes(void)
{
git_oid oid;
cl_git_pass(git_odb_stream_write(stream, "deadbeef", 8));
cl_assert_equal_sz(8, stream->received_bytes);
cl_git_pass(git_odb_stream_write(stream, "deadbeef", 4));
cl_assert_equal_sz(8 + 4, stream->received_bytes);
cl_git_fail(git_odb_stream_finalize_write(&oid, stream));
}
void test_odb_streamwrite__can_detect_additional_bytes(void)
{
cl_git_pass(git_odb_stream_write(stream, "deadbeef", 8));
cl_assert_equal_sz(8, stream->received_bytes);
cl_git_fail(git_odb_stream_write(stream, "deadbeef", 7));
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/mixed.c
|
#include "clar_libgit2.h"
#include "odb.h"
static git_odb *_odb;
void test_odb_mixed__initialize(void)
{
cl_git_pass(git_odb_open(&_odb, cl_fixture("duplicate.git/objects")));
}
void test_odb_mixed__cleanup(void)
{
git_odb_free(_odb);
_odb = NULL;
}
void test_odb_mixed__dup_oid(void) {
const char hex[] = "ce013625030ba8dba906f756967f9e9ca394464a";
const char short_hex[] = "ce01362";
git_oid oid;
git_odb_object *obj;
cl_git_pass(git_oid_fromstr(&oid, hex));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, GIT_OID_HEXSZ));
git_odb_object_free(obj);
cl_git_pass(git_odb_exists_prefix(NULL, _odb, &oid, GIT_OID_HEXSZ));
cl_git_pass(git_oid_fromstrn(&oid, short_hex, sizeof(short_hex) - 1));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, sizeof(short_hex) - 1));
git_odb_object_free(obj);
cl_git_pass(git_odb_exists_prefix(NULL, _odb, &oid, sizeof(short_hex) - 1));
}
/* some known sha collisions of file content:
* 'aabqhq' and 'aaazvc' with prefix 'dea509d0' (+ '9' and + 'b')
* 'aaeufo' and 'aaaohs' with prefix '81b5bff5' (+ 'f' and + 'b')
* 'aafewy' and 'aaepta' with prefix '739e3c4c'
* 'aahsyn' and 'aadrjg' with prefix '0ddeaded' (+ '9' and + 'e')
*/
void test_odb_mixed__dup_oid_prefix_0(void) {
char hex[10];
git_oid oid, found;
git_odb_object *obj;
/* ambiguous in the same pack file */
strncpy(hex, "dea509d0", sizeof(hex));
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
strncpy(hex, "dea509d09", sizeof(hex));
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
cl_assert_equal_oid(&found, git_odb_object_id(obj));
git_odb_object_free(obj);
strncpy(hex, "dea509d0b", sizeof(hex));
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
git_odb_object_free(obj);
/* ambiguous in different pack files */
strncpy(hex, "81b5bff5", sizeof(hex));
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
strncpy(hex, "81b5bff5b", sizeof(hex));
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
cl_assert_equal_oid(&found, git_odb_object_id(obj));
git_odb_object_free(obj);
strncpy(hex, "81b5bff5f", sizeof(hex));
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
git_odb_object_free(obj);
/* ambiguous in pack file and loose */
strncpy(hex, "0ddeaded", sizeof(hex));
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_assert_equal_i(
GIT_EAMBIGUOUS, git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
strncpy(hex, "0ddeaded9", sizeof(hex));
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
cl_assert_equal_oid(&found, git_odb_object_id(obj));
git_odb_object_free(obj);
strncpy(hex, "0ddeadede", sizeof(hex));
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
git_odb_object_free(obj);
}
struct expand_id_test_data {
char *lookup_id;
char *expected_id;
git_object_t expected_type;
};
struct expand_id_test_data expand_id_test_data[] = {
/* some prefixes and their expected values */
{ "dea509d0", NULL, GIT_OBJECT_ANY },
{ "00000000", NULL, GIT_OBJECT_ANY },
{ "dea509d0", NULL, GIT_OBJECT_ANY },
{ "dea509d09", "dea509d097ce692e167dfc6a48a7a280cc5e877e", GIT_OBJECT_BLOB },
{ "dea509d0b", "dea509d0b3cb8ee0650f6ca210bc83f4678851ba", GIT_OBJECT_BLOB },
{ "ce0136250", "ce013625030ba8dba906f756967f9e9ca394464a", GIT_OBJECT_BLOB },
{ "0ddeaded", NULL, GIT_OBJECT_ANY },
{ "4d5979b", "4d5979b468252190cb572ae758aca36928e8a91e", GIT_OBJECT_TREE },
{ "0ddeaded", NULL, GIT_OBJECT_ANY },
{ "0ddeadede", "0ddeadede9e6d6ccddce0ee1e5749eed0485e5ea", GIT_OBJECT_BLOB },
{ "0ddeaded9", "0ddeaded9502971eefe1e41e34d0e536853ae20f", GIT_OBJECT_BLOB },
{ "f00b4e", NULL, GIT_OBJECT_ANY },
/* this OID is too short and should be ambiguous! */
{ "f00", NULL, GIT_OBJECT_ANY },
/* some full-length object ids */
{ "0000000000000000000000000000000000000000", NULL, GIT_OBJECT_ANY },
{
"dea509d097ce692e167dfc6a48a7a280cc5e877e",
"dea509d097ce692e167dfc6a48a7a280cc5e877e",
GIT_OBJECT_BLOB
},
{ "f00f00f00f00f00f00f00f00f00f00f00f00f00f", NULL, GIT_OBJECT_ANY },
{
"4d5979b468252190cb572ae758aca36928e8a91e",
"4d5979b468252190cb572ae758aca36928e8a91e",
GIT_OBJECT_TREE
},
/*
* ensure we're not leaking the return error code for the
* last lookup if the last object is invalid
*/
{ "0ddeadedfff", NULL, GIT_OBJECT_ANY },
};
static void setup_prefix_query(
git_odb_expand_id **out_ids,
size_t *out_num)
{
git_odb_expand_id *ids;
size_t num, i;
num = ARRAY_SIZE(expand_id_test_data);
cl_assert((ids = git__calloc(num, sizeof(git_odb_expand_id))));
for (i = 0; i < num; i++) {
git_odb_expand_id *id = &ids[i];
size_t len = strlen(expand_id_test_data[i].lookup_id);
git_oid_fromstrn(&id->id, expand_id_test_data[i].lookup_id, len);
id->length = (unsigned short)len;
id->type = expand_id_test_data[i].expected_type;
}
*out_ids = ids;
*out_num = num;
}
static void assert_found_objects(git_odb_expand_id *ids)
{
size_t num, i;
num = ARRAY_SIZE(expand_id_test_data);
for (i = 0; i < num; i++) {
git_oid expected_id = {{0}};
size_t expected_len = 0;
git_object_t expected_type = 0;
if (expand_id_test_data[i].expected_id) {
git_oid_fromstr(&expected_id, expand_id_test_data[i].expected_id);
expected_len = GIT_OID_HEXSZ;
expected_type = expand_id_test_data[i].expected_type;
}
cl_assert_equal_oid(&expected_id, &ids[i].id);
cl_assert_equal_i(expected_len, ids[i].length);
cl_assert_equal_i(expected_type, ids[i].type);
}
}
static void assert_notfound_objects(git_odb_expand_id *ids)
{
git_oid expected_id = {{0}};
size_t num, i;
num = ARRAY_SIZE(expand_id_test_data);
for (i = 0; i < num; i++) {
cl_assert_equal_oid(&expected_id, &ids[i].id);
cl_assert_equal_i(0, ids[i].length);
cl_assert_equal_i(0, ids[i].type);
}
}
void test_odb_mixed__expand_ids(void)
{
git_odb_expand_id *ids;
size_t i, num;
/* test looking for the actual (correct) types */
setup_prefix_query(&ids, &num);
cl_git_pass(git_odb_expand_ids(_odb, ids, num));
assert_found_objects(ids);
git__free(ids);
/* test looking for an explicit `type == 0` */
setup_prefix_query(&ids, &num);
for (i = 0; i < num; i++)
ids[i].type = 0;
cl_git_pass(git_odb_expand_ids(_odb, ids, num));
assert_found_objects(ids);
git__free(ids);
/* test looking for an explicit GIT_OBJECT_ANY */
setup_prefix_query(&ids, &num);
for (i = 0; i < num; i++)
ids[i].type = GIT_OBJECT_ANY;
cl_git_pass(git_odb_expand_ids(_odb, ids, num));
assert_found_objects(ids);
git__free(ids);
/* test looking for the completely wrong type */
setup_prefix_query(&ids, &num);
for (i = 0; i < num; i++)
ids[i].type = (ids[i].type == GIT_OBJECT_BLOB) ?
GIT_OBJECT_TREE : GIT_OBJECT_BLOB;
cl_git_pass(git_odb_expand_ids(_odb, ids, num));
assert_notfound_objects(ids);
git__free(ids);
}
void test_odb_mixed__expand_ids_cached(void)
{
git_odb_expand_id *ids;
size_t i, num;
/* test looking for the actual (correct) types after accessing the object */
setup_prefix_query(&ids, &num);
for (i = 0; i < num; i++) {
git_odb_object *obj;
if (ids[i].type == GIT_OBJECT_ANY)
continue;
cl_git_pass(git_odb_read_prefix(&obj, _odb, &ids[i].id, ids[i].length));
git_odb_object_free(obj);
}
cl_git_pass(git_odb_expand_ids(_odb, ids, num));
assert_found_objects(ids);
git__free(ids);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/freshen.c
|
#include "clar_libgit2.h"
#include "odb.h"
#include "posix.h"
static git_repository *repo;
static git_odb *odb;
void test_odb_freshen__initialize(void)
{
repo = cl_git_sandbox_init("testrepo.git");
cl_git_pass(git_repository_odb(&odb, repo));
}
void test_odb_freshen__cleanup(void)
{
git_odb_free(odb);
cl_git_sandbox_cleanup();
}
static void set_time_wayback(struct stat *out, const char *fn)
{
git_buf fullpath = GIT_BUF_INIT;
struct p_timeval old[2];
old[0].tv_sec = 1234567890;
old[0].tv_usec = 0;
old[1].tv_sec = 1234567890;
old[1].tv_usec = 0;
git_buf_joinpath(&fullpath, "testrepo.git/objects", fn);
cl_must_pass(p_utimes(git_buf_cstr(&fullpath), old));
cl_must_pass(p_lstat(git_buf_cstr(&fullpath), out));
git_buf_dispose(&fullpath);
}
#define LOOSE_STR "my new file\n"
#define LOOSE_BLOB_ID "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"
#define LOOSE_BLOB_FN "a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd"
void test_odb_freshen__loose_blob(void)
{
git_oid expected_id, id;
struct stat before, after;
cl_git_pass(git_oid_fromstr(&expected_id, LOOSE_BLOB_ID));
set_time_wayback(&before, LOOSE_BLOB_FN);
/* make sure we freshen a blob */
cl_git_pass(git_blob_create_from_buffer(&id, repo, LOOSE_STR, CONST_STRLEN(LOOSE_STR)));
cl_assert_equal_oid(&expected_id, &id);
cl_must_pass(p_lstat("testrepo.git/objects/" LOOSE_BLOB_FN, &after));
cl_assert(before.st_atime < after.st_atime);
cl_assert(before.st_mtime < after.st_mtime);
}
#define UNIQUE_STR "doesnt exist in the odb yet\n"
#define UNIQUE_BLOB_ID "78a87d0b8878c5953b9a63015ff4e22a3d898826"
#define UNIQUE_BLOB_FN "78/a87d0b8878c5953b9a63015ff4e22a3d898826"
void test_odb_freshen__readonly_object(void)
{
git_oid expected_id, id;
struct stat before, after;
cl_git_pass(git_oid_fromstr(&expected_id, UNIQUE_BLOB_ID));
cl_git_pass(git_blob_create_from_buffer(&id, repo, UNIQUE_STR, CONST_STRLEN(UNIQUE_STR)));
cl_assert_equal_oid(&expected_id, &id);
set_time_wayback(&before, UNIQUE_BLOB_FN);
cl_assert((before.st_mode & S_IWUSR) == 0);
cl_git_pass(git_blob_create_from_buffer(&id, repo, UNIQUE_STR, CONST_STRLEN(UNIQUE_STR)));
cl_assert_equal_oid(&expected_id, &id);
cl_must_pass(p_lstat("testrepo.git/objects/" UNIQUE_BLOB_FN, &after));
cl_assert(before.st_atime < after.st_atime);
cl_assert(before.st_mtime < after.st_mtime);
}
#define LOOSE_TREE_ID "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162"
#define LOOSE_TREE_FN "94/4c0f6e4dfa41595e6eb3ceecdb14f50fe18162"
void test_odb_freshen__loose_tree(void)
{
git_oid expected_id, id;
git_tree *tree;
struct stat before, after;
cl_git_pass(git_oid_fromstr(&expected_id, LOOSE_TREE_ID));
set_time_wayback(&before, LOOSE_TREE_FN);
cl_git_pass(git_tree_lookup(&tree, repo, &expected_id));
cl_git_pass(git_tree_create_updated(&id, repo, tree, 0, NULL));
/* make sure we freshen a tree */
cl_assert_equal_oid(&expected_id, &id);
cl_must_pass(p_lstat("testrepo.git/objects/" LOOSE_TREE_FN, &after));
cl_assert(before.st_atime < after.st_atime);
cl_assert(before.st_mtime < after.st_mtime);
git_tree_free(tree);
}
void test_odb_freshen__tree_during_commit(void)
{
git_oid tree_id, parent_id, commit_id;
git_tree *tree;
git_commit *parent;
git_signature *signature;
struct stat before, after;
cl_git_pass(git_oid_fromstr(&tree_id, LOOSE_TREE_ID));
cl_git_pass(git_tree_lookup(&tree, repo, &tree_id));
set_time_wayback(&before, LOOSE_TREE_FN);
cl_git_pass(git_oid_fromstr(&parent_id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
cl_git_pass(git_commit_lookup(&parent, repo, &parent_id));
cl_git_pass(git_signature_new(&signature,
"Refresher", "[email protected]", 1488547083, 0));
cl_git_pass(git_commit_create(&commit_id, repo, NULL,
signature, signature, NULL, "New commit pointing to old tree",
tree, 1, (const git_commit **)&parent));
/* make sure we freshen the tree the commit points to */
cl_must_pass(p_lstat("testrepo.git/objects/" LOOSE_TREE_FN, &after));
cl_assert(before.st_atime < after.st_atime);
cl_assert(before.st_mtime < after.st_mtime);
git_signature_free(signature);
git_commit_free(parent);
git_tree_free(tree);
}
#define PACKED_STR "Testing a readme.txt\n"
#define PACKED_ID "6336846bd5c88d32f93ae57d846683e61ab5c530"
#define PACKED_FN "pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack"
void test_odb_freshen__packed_object(void)
{
git_oid expected_id, id;
struct stat before, after;
struct p_timeval old_times[2];
cl_git_pass(git_oid_fromstr(&expected_id, PACKED_ID));
old_times[0].tv_sec = 1234567890;
old_times[0].tv_usec = 0;
old_times[1].tv_sec = 1234567890;
old_times[1].tv_usec = 0;
/* set time to way back */
cl_must_pass(p_utimes("testrepo.git/objects/pack/" PACKED_FN, old_times));
cl_must_pass(p_lstat("testrepo.git/objects/pack/" PACKED_FN, &before));
/* ensure that packfile is freshened */
cl_git_pass(git_odb_write(&id, odb, PACKED_STR,
CONST_STRLEN(PACKED_STR), GIT_OBJECT_BLOB));
cl_assert_equal_oid(&expected_id, &id);
cl_must_pass(p_lstat("testrepo.git/objects/pack/" PACKED_FN, &after));
cl_assert(before.st_atime < after.st_atime);
cl_assert(before.st_mtime < after.st_mtime);
memcpy(&before, &after, sizeof(struct stat));
/* ensure that the pack file is not freshened again immediately */
cl_git_pass(git_odb_write(&id, odb, PACKED_STR,
CONST_STRLEN(PACKED_STR), GIT_OBJECT_BLOB));
cl_assert_equal_oid(&expected_id, &id);
cl_must_pass(p_lstat("testrepo.git/objects/pack/" PACKED_FN, &after));
cl_assert(before.st_atime == after.st_atime);
cl_assert(before.st_atime_nsec == after.st_atime_nsec);
cl_assert(before.st_mtime == after.st_mtime);
cl_assert(before.st_mtime_nsec == after.st_mtime_nsec);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/foreach.c
|
#include "clar_libgit2.h"
#include "odb.h"
#include "git2/odb_backend.h"
#include "pack.h"
#include "buffer.h"
static git_odb *_odb;
static git_repository *_repo;
void test_odb_foreach__cleanup(void)
{
git_odb_free(_odb);
git_repository_free(_repo);
_odb = NULL;
_repo = NULL;
}
static int foreach_cb(const git_oid *oid, void *data)
{
int *nobj = data;
(*nobj)++;
GIT_UNUSED(oid);
return 0;
}
/*
* $ git --git-dir tests/resources/testrepo.git count-objects --verbose
* count: 60
* size: 240
* in-pack: 1640
* packs: 3
* size-pack: 425
* prune-packable: 0
* garbage: 0
*/
void test_odb_foreach__foreach(void)
{
int nobj = 0;
cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git")));
git_repository_odb(&_odb, _repo);
cl_git_pass(git_odb_foreach(_odb, foreach_cb, &nobj));
cl_assert_equal_i(60 + 1640, nobj); /* count + in-pack */
}
void test_odb_foreach__one_pack(void)
{
git_odb_backend *backend = NULL;
int nobj = 0;
cl_git_pass(git_odb_new(&_odb));
cl_git_pass(git_odb_backend_one_pack(&backend, cl_fixture("testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx")));
cl_git_pass(git_odb_add_backend(_odb, backend, 1));
_repo = NULL;
cl_git_pass(git_odb_foreach(_odb, foreach_cb, &nobj));
cl_assert(nobj == 1628);
}
static int foreach_stop_cb(const git_oid *oid, void *data)
{
int *nobj = data;
(*nobj)++;
GIT_UNUSED(oid);
return (*nobj == 1000) ? -321 : 0;
}
static int foreach_stop_first_cb(const git_oid *oid, void *data)
{
int *nobj = data;
(*nobj)++;
GIT_UNUSED(oid);
return -123;
}
static int foreach_stop_cb_positive_ret(const git_oid *oid, void *data)
{
int *nobj = data;
(*nobj)++;
GIT_UNUSED(oid);
return (*nobj == 1000) ? 321 : 0;
}
void test_odb_foreach__interrupt_foreach(void)
{
int nobj = 0;
git_oid id;
cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git")));
git_repository_odb(&_odb, _repo);
cl_assert_equal_i(-321, git_odb_foreach(_odb, foreach_stop_cb, &nobj));
cl_assert(nobj == 1000);
nobj = 0;
cl_assert_equal_i(321, git_odb_foreach(_odb, foreach_stop_cb_positive_ret, &nobj));
cl_assert(nobj == 1000);
git_odb_free(_odb);
git_repository_free(_repo);
cl_git_pass(git_repository_init(&_repo, "onlyloose.git", true));
git_repository_odb(&_odb, _repo);
cl_git_pass(git_odb_write(&id, _odb, "", 0, GIT_OBJECT_BLOB));
cl_assert_equal_i(-123, git_odb_foreach(_odb, foreach_stop_first_cb, &nobj));
}
void test_odb_foreach__files_in_objects_dir(void)
{
git_repository *repo;
git_odb *odb;
git_buf buf = GIT_BUF_INIT;
int nobj = 0;
cl_fixture_sandbox("testrepo.git");
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
cl_git_pass(git_buf_joinpath(&buf, git_repository_path(repo), "objects/somefile"));
cl_git_mkfile(buf.ptr, "");
git_buf_dispose(&buf);
cl_git_pass(git_repository_odb(&odb, repo));
cl_git_pass(git_odb_foreach(odb, foreach_cb, &nobj));
cl_assert_equal_i(60 + 1640, nobj); /* count + in-pack */
git_odb_free(odb);
git_repository_free(repo);
cl_fixture_cleanup("testrepo.git");
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/loose_data.h
|
typedef struct object_data {
unsigned char *bytes; /* (compressed) bytes stored in object store */
size_t blen; /* length of data in object store */
char *id; /* object id (sha1) */
char *type; /* object type */
char *dir; /* object store (fan-out) directory name */
char *file; /* object store filename */
unsigned char *data; /* (uncompressed) object data */
size_t dlen; /* length of (uncompressed) object data */
} object_data;
/* one == 8b137891791fe96927ad78e64b0aad7bded08bdc */
static unsigned char one_bytes[] = {
0x31, 0x78, 0x9c, 0xe3, 0x02, 0x00, 0x00, 0x0b,
0x00, 0x0b,
};
static unsigned char one_data[] = {
0x0a,
};
static object_data one = {
one_bytes,
sizeof(one_bytes),
"8b137891791fe96927ad78e64b0aad7bded08bdc",
"blob",
"test-objects/8b",
"test-objects/8b/137891791fe96927ad78e64b0aad7bded08bdc",
one_data,
sizeof(one_data),
};
/* commit == 3d7f8a6af076c8c3f20071a8935cdbe8228594d1 */
static unsigned char commit_bytes[] = {
0x78, 0x01, 0x85, 0x50, 0xc1, 0x6a, 0xc3, 0x30,
0x0c, 0xdd, 0xd9, 0x5f, 0xa1, 0xfb, 0x96, 0x12,
0xbb, 0x29, 0x71, 0x46, 0x19, 0x2b, 0x3d, 0x97,
0x1d, 0xd6, 0x7d, 0x80, 0x1d, 0xcb, 0x89, 0x21,
0xb6, 0x82, 0xed, 0x40, 0xf3, 0xf7, 0xf3, 0x48,
0x29, 0x3b, 0x6d, 0xd2, 0xe5, 0xbd, 0x27, 0xbd,
0x27, 0x50, 0x4f, 0xde, 0xbb, 0x0c, 0xfb, 0x43,
0xf3, 0x94, 0x23, 0x22, 0x18, 0x6b, 0x85, 0x51,
0x5d, 0xad, 0xc5, 0xa1, 0x41, 0xae, 0x51, 0x4b,
0xd9, 0x19, 0x6e, 0x4b, 0x0b, 0x29, 0x35, 0x72,
0x59, 0xef, 0x5b, 0x29, 0x8c, 0x65, 0x6a, 0xc9,
0x23, 0x45, 0x38, 0xc1, 0x17, 0x5c, 0x7f, 0xc0,
0x71, 0x13, 0xde, 0xf1, 0xa6, 0xfc, 0x3c, 0xe1,
0xae, 0x27, 0xff, 0x06, 0x5c, 0x88, 0x56, 0xf2,
0x46, 0x74, 0x2d, 0x3c, 0xd7, 0xa5, 0x58, 0x51,
0xcb, 0xb9, 0x8c, 0x11, 0xce, 0xf0, 0x01, 0x97,
0x0d, 0x1e, 0x1f, 0xea, 0x3f, 0x6e, 0x76, 0x02,
0x0a, 0x58, 0x4d, 0x2e, 0x20, 0x6c, 0x1e, 0x48,
0x8b, 0xf7, 0x2a, 0xae, 0x8c, 0x5d, 0x47, 0x04,
0x4d, 0x66, 0x05, 0xb2, 0x90, 0x0b, 0xbe, 0xcf,
0x3d, 0xa6, 0xa4, 0x06, 0x7c, 0x29, 0x3c, 0x64,
0xe5, 0x82, 0x0b, 0x03, 0xd8, 0x25, 0x96, 0x8d,
0x08, 0x78, 0x9b, 0x27, 0x15, 0x54, 0x76, 0x14,
0xd8, 0xdd, 0x35, 0x2f, 0x71, 0xa6, 0x84, 0x8f,
0x90, 0x51, 0x85, 0x01, 0x13, 0xb8, 0x90, 0x23,
0x99, 0xa5, 0x47, 0x03, 0x7a, 0xfd, 0x15, 0xbf,
0x63, 0xec, 0xd3, 0x0d, 0x01, 0x4d, 0x45, 0xb6,
0xd2, 0xeb, 0xeb, 0xdf, 0xef, 0x60, 0xdf, 0xef,
0x1f, 0x78, 0x35,
};
static unsigned char commit_data[] = {
0x74, 0x72, 0x65, 0x65, 0x20, 0x64, 0x66, 0x66,
0x32, 0x64, 0x61, 0x39, 0x30, 0x62, 0x32, 0x35,
0x34, 0x65, 0x31, 0x62, 0x65, 0x62, 0x38, 0x38,
0x39, 0x64, 0x31, 0x66, 0x31, 0x66, 0x31, 0x32,
0x38, 0x38, 0x62, 0x65, 0x31, 0x38, 0x30, 0x33,
0x37, 0x38, 0x32, 0x64, 0x66, 0x0a, 0x61, 0x75,
0x74, 0x68, 0x6f, 0x72, 0x20, 0x41, 0x20, 0x55,
0x20, 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61,
0x75, 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78,
0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
0x6d, 0x3e, 0x20, 0x31, 0x32, 0x32, 0x37, 0x38,
0x31, 0x34, 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30,
0x30, 0x30, 0x30, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
0x69, 0x74, 0x74, 0x65, 0x72, 0x20, 0x43, 0x20,
0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
0x30, 0x0a, 0x0a, 0x41, 0x20, 0x6f, 0x6e, 0x65,
0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f,
0x6d, 0x6d, 0x69, 0x74, 0x20, 0x73, 0x75, 0x6d,
0x6d, 0x61, 0x72, 0x79, 0x0a, 0x0a, 0x54, 0x68,
0x65, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x6f,
0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x63, 0x6f,
0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67,
0x20, 0x66, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72,
0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6f, 0x66, 0x20,
0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70,
0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74,
0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67,
0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x72, 0x6f,
0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79,
0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d,
0x6d, 0x69, 0x74, 0x2e, 0x0a, 0x0a, 0x53, 0x69,
0x67, 0x6e, 0x65, 0x64, 0x2d, 0x6f, 0x66, 0x2d,
0x62, 0x79, 0x3a, 0x20, 0x41, 0x20, 0x55, 0x20,
0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61, 0x75,
0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78, 0x61,
0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
0x3e, 0x0a,
};
static object_data commit = {
commit_bytes,
sizeof(commit_bytes),
"3d7f8a6af076c8c3f20071a8935cdbe8228594d1",
"commit",
"test-objects/3d",
"test-objects/3d/7f8a6af076c8c3f20071a8935cdbe8228594d1",
commit_data,
sizeof(commit_data),
};
/* tree == dff2da90b254e1beb889d1f1f1288be1803782df */
static unsigned char tree_bytes[] = {
0x78, 0x01, 0x2b, 0x29, 0x4a, 0x4d, 0x55, 0x30,
0x34, 0x32, 0x63, 0x30, 0x34, 0x30, 0x30, 0x33,
0x31, 0x51, 0xc8, 0xcf, 0x4b, 0x65, 0xe8, 0x16,
0xae, 0x98, 0x58, 0x29, 0xff, 0x32, 0x53, 0x7d,
0x6d, 0xc5, 0x33, 0x6f, 0xae, 0xb5, 0xd5, 0xf7,
0x2e, 0x74, 0xdf, 0x81, 0x4a, 0x17, 0xe7, 0xe7,
0xa6, 0x32, 0xfc, 0x6d, 0x31, 0xd8, 0xd3, 0xe6,
0xf3, 0xe7, 0xea, 0x47, 0xbe, 0xd0, 0x09, 0x3f,
0x96, 0xb8, 0x3f, 0x90, 0x9e, 0xa2, 0xfd, 0x0f,
0x2a, 0x5f, 0x52, 0x9e, 0xcf, 0x50, 0x31, 0x43,
0x52, 0x29, 0xd1, 0x5a, 0xeb, 0x77, 0x82, 0x2a,
0x8b, 0xfe, 0xb7, 0xbd, 0xed, 0x5d, 0x07, 0x67,
0xfa, 0xb5, 0x42, 0xa5, 0xab, 0x52, 0x8b, 0xf2,
0x19, 0x9e, 0xcd, 0x7d, 0x34, 0x7b, 0xd3, 0xc5,
0x6b, 0xce, 0xde, 0xdd, 0x9a, 0xeb, 0xca, 0xa3,
0x6e, 0x1c, 0x7a, 0xd2, 0x13, 0x3c, 0x11, 0x00,
0xe2, 0xaa, 0x38, 0x57,
};
static unsigned char tree_data[] = {
0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x6f,
0x6e, 0x65, 0x00, 0x8b, 0x13, 0x78, 0x91, 0x79,
0x1f, 0xe9, 0x69, 0x27, 0xad, 0x78, 0xe6, 0x4b,
0x0a, 0xad, 0x7b, 0xde, 0xd0, 0x8b, 0xdc, 0x31,
0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x73, 0x6f,
0x6d, 0x65, 0x00, 0xfd, 0x84, 0x30, 0xbc, 0x86,
0x4c, 0xfc, 0xd5, 0xf1, 0x0e, 0x55, 0x90, 0xf8,
0xa4, 0x47, 0xe0, 0x1b, 0x94, 0x2b, 0xfe, 0x31,
0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x74, 0x77,
0x6f, 0x00, 0x78, 0x98, 0x19, 0x22, 0x61, 0x3b,
0x2a, 0xfb, 0x60, 0x25, 0x04, 0x2f, 0xf6, 0xbd,
0x87, 0x8a, 0xc1, 0x99, 0x4e, 0x85, 0x31, 0x30,
0x30, 0x36, 0x34, 0x34, 0x20, 0x7a, 0x65, 0x72,
0x6f, 0x00, 0xe6, 0x9d, 0xe2, 0x9b, 0xb2, 0xd1,
0xd6, 0x43, 0x4b, 0x8b, 0x29, 0xae, 0x77, 0x5a,
0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91,
};
static object_data tree = {
tree_bytes,
sizeof(tree_bytes),
"dff2da90b254e1beb889d1f1f1288be1803782df",
"tree",
"test-objects/df",
"test-objects/df/f2da90b254e1beb889d1f1f1288be1803782df",
tree_data,
sizeof(tree_data),
};
/* tag == 09d373e1dfdc16b129ceec6dd649739911541e05 */
static unsigned char tag_bytes[] = {
0x78, 0x01, 0x35, 0x4e, 0xcb, 0x0a, 0xc2, 0x40,
0x10, 0xf3, 0xbc, 0x5f, 0x31, 0x77, 0xa1, 0xec,
0xa3, 0xed, 0x6e, 0x41, 0x44, 0xf0, 0x2c, 0x5e,
0xfc, 0x81, 0xe9, 0x76, 0xb6, 0xad, 0xb4, 0xb4,
0x6c, 0x07, 0xd1, 0xbf, 0x77, 0x44, 0x0d, 0x39,
0x84, 0x10, 0x92, 0x30, 0xf6, 0x60, 0xbc, 0xdb,
0x2d, 0xed, 0x9d, 0x22, 0x83, 0xeb, 0x7c, 0x0a,
0x58, 0x63, 0xd2, 0xbe, 0x8e, 0x21, 0xba, 0x64,
0xb5, 0xf6, 0x06, 0x43, 0xe3, 0xaa, 0xd8, 0xb5,
0x14, 0xac, 0x0d, 0x55, 0x53, 0x76, 0x46, 0xf1,
0x6b, 0x25, 0x88, 0xcb, 0x3c, 0x8f, 0xac, 0x58,
0x3a, 0x1e, 0xba, 0xd0, 0x85, 0xd8, 0xd8, 0xf7,
0x94, 0xe1, 0x0c, 0x57, 0xb8, 0x8c, 0xcc, 0x22,
0x0f, 0xdf, 0x90, 0xc8, 0x13, 0x3d, 0x71, 0x5e,
0x27, 0x2a, 0xc4, 0x39, 0x82, 0xb1, 0xd6, 0x07,
0x53, 0xda, 0xc6, 0xc3, 0x5e, 0x0b, 0x94, 0xba,
0x0d, 0xe3, 0x06, 0x42, 0x1e, 0x08, 0x3e, 0x95,
0xbf, 0x4b, 0x69, 0xc9, 0x90, 0x69, 0x22, 0xdc,
0xe8, 0xbf, 0xf2, 0x06, 0x42, 0x9a, 0x36, 0xb1,
};
static unsigned char tag_data[] = {
0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x33,
0x64, 0x37, 0x66, 0x38, 0x61, 0x36, 0x61, 0x66,
0x30, 0x37, 0x36, 0x63, 0x38, 0x63, 0x33, 0x66,
0x32, 0x30, 0x30, 0x37, 0x31, 0x61, 0x38, 0x39,
0x33, 0x35, 0x63, 0x64, 0x62, 0x65, 0x38, 0x32,
0x32, 0x38, 0x35, 0x39, 0x34, 0x64, 0x31, 0x0a,
0x74, 0x79, 0x70, 0x65, 0x20, 0x63, 0x6f, 0x6d,
0x6d, 0x69, 0x74, 0x0a, 0x74, 0x61, 0x67, 0x20,
0x76, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x0a, 0x74,
0x61, 0x67, 0x67, 0x65, 0x72, 0x20, 0x43, 0x20,
0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
0x30, 0x0a, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20,
0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
0x61, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63,
0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65,
0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x76, 0x30,
0x2e, 0x30, 0x2e, 0x31, 0x0a,
};
static object_data tag = {
tag_bytes,
sizeof(tag_bytes),
"09d373e1dfdc16b129ceec6dd649739911541e05",
"tag",
"test-objects/09",
"test-objects/09/d373e1dfdc16b129ceec6dd649739911541e05",
tag_data,
sizeof(tag_data),
};
/* zero == e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 */
static unsigned char zero_bytes[] = {
0x78, 0x01, 0x4b, 0xca, 0xc9, 0x4f, 0x52, 0x30,
0x60, 0x00, 0x00, 0x09, 0xb0, 0x01, 0xf0,
};
static unsigned char zero_data[] = {
0x00 /* dummy data */
};
static object_data zero = {
zero_bytes,
sizeof(zero_bytes),
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
"blob",
"test-objects/e6",
"test-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391",
zero_data,
0,
};
/* two == 78981922613b2afb6025042ff6bd878ac1994e85 */
static unsigned char two_bytes[] = {
0x78, 0x01, 0x4b, 0xca, 0xc9, 0x4f, 0x52, 0x30,
0x62, 0x48, 0xe4, 0x02, 0x00, 0x0e, 0x64, 0x02,
0x5d,
};
static unsigned char two_data[] = {
0x61, 0x0a,
};
static object_data two = {
two_bytes,
sizeof(two_bytes),
"78981922613b2afb6025042ff6bd878ac1994e85",
"blob",
"test-objects/78",
"test-objects/78/981922613b2afb6025042ff6bd878ac1994e85",
two_data,
sizeof(two_data),
};
/* some == fd8430bc864cfcd5f10e5590f8a447e01b942bfe */
static unsigned char some_bytes[] = {
0x78, 0x01, 0x7d, 0x54, 0xc1, 0x4e, 0xe3, 0x30,
0x10, 0xdd, 0x33, 0x5f, 0x31, 0xc7, 0x5d, 0x94,
0xa5, 0x84, 0xd5, 0x22, 0xad, 0x7a, 0x0a, 0x15,
0x85, 0x48, 0xd0, 0x56, 0x49, 0x2a, 0xd4, 0xa3,
0x13, 0x4f, 0x88, 0x85, 0x63, 0x47, 0xb6, 0x43,
0xc9, 0xdf, 0xef, 0x8c, 0x69, 0x17, 0x56, 0x0b,
0x7b, 0xaa, 0x62, 0x7b, 0xde, 0xbc, 0xf7, 0xe6,
0x4d, 0x6b, 0x6d, 0x6b, 0x48, 0xd3, 0xcb, 0x5f,
0x5f, 0x66, 0xa7, 0x27, 0x70, 0x0a, 0x55, 0xa7,
0x3c, 0xb4, 0x4a, 0x23, 0xf0, 0xaf, 0x43, 0x04,
0x6f, 0xdb, 0xb0, 0x17, 0x0e, 0xe7, 0x30, 0xd9,
0x11, 0x1a, 0x61, 0xc0, 0xa1, 0x54, 0x3e, 0x38,
0x55, 0x8f, 0x81, 0x9e, 0x05, 0x10, 0x46, 0xce,
0xac, 0x83, 0xde, 0x4a, 0xd5, 0x4e, 0x0c, 0x42,
0x67, 0xa3, 0x91, 0xe8, 0x20, 0x74, 0x08, 0x01,
0x5d, 0xef, 0xc1, 0xb6, 0xf1, 0xe3, 0x66, 0xb5,
0x85, 0x1b, 0x34, 0xe8, 0x84, 0x86, 0xcd, 0x58,
0x6b, 0xd5, 0xc0, 0x9d, 0x6a, 0xd0, 0x78, 0x4c,
0xe0, 0x19, 0x9d, 0x57, 0xd6, 0xc0, 0x45, 0xc2,
0x18, 0xc2, 0xc3, 0xc0, 0x0f, 0x7c, 0x87, 0x12,
0xea, 0x29, 0x56, 0x2f, 0x99, 0x4f, 0x79, 0xe0,
0x03, 0x4b, 0x4b, 0x4d, 0x44, 0xa0, 0x92, 0x33,
0x2a, 0xe0, 0x9a, 0xdc, 0x80, 0x90, 0x52, 0xf1,
0x11, 0x04, 0x1b, 0x4b, 0x06, 0xea, 0xae, 0x3c,
0xe3, 0x7a, 0x50, 0x74, 0x4a, 0x84, 0xfe, 0xc3,
0x81, 0x41, 0xf8, 0x89, 0x18, 0x43, 0x67, 0x9d,
0x87, 0x47, 0xf5, 0x8c, 0x51, 0xf6, 0x68, 0xb4,
0xea, 0x55, 0x20, 0x2a, 0x6f, 0x80, 0xdc, 0x42,
0x2b, 0xf3, 0x14, 0x2b, 0x1a, 0xdb, 0x0f, 0xe4,
0x9a, 0x64, 0x84, 0xa3, 0x90, 0xa8, 0xf9, 0x8f,
0x9d, 0x86, 0x9e, 0xd3, 0xab, 0x5a, 0x99, 0xc8,
0xd9, 0xc3, 0x5e, 0x85, 0x0e, 0x2c, 0xb5, 0x73,
0x30, 0x38, 0xfb, 0xe8, 0x44, 0xef, 0x5f, 0x95,
0x1b, 0xc9, 0xd0, 0xef, 0x3c, 0x26, 0x32, 0x1e,
0xff, 0x2d, 0xb6, 0x23, 0x7b, 0x3f, 0xd1, 0x3c,
0x78, 0x1a, 0x0d, 0xcb, 0xe6, 0xf6, 0xd4, 0x44,
0x99, 0x47, 0x1a, 0x9e, 0xed, 0x23, 0xb5, 0x91,
0x6a, 0xdf, 0x53, 0x39, 0x03, 0xf8, 0x5a, 0xb1,
0x0f, 0x1f, 0xce, 0x81, 0x11, 0xde, 0x01, 0x7a,
0x90, 0x16, 0xc4, 0x30, 0xe8, 0x89, 0xed, 0x7b,
0x65, 0x4b, 0xd7, 0x03, 0x36, 0xc1, 0xcf, 0xa1,
0xa5, 0xb1, 0xe3, 0x8b, 0xe8, 0x07, 0x4d, 0xf3,
0x23, 0x25, 0x13, 0x35, 0x27, 0xf5, 0x8c, 0x11,
0xd3, 0xa0, 0x9a, 0xa8, 0xf5, 0x38, 0x7d, 0xce,
0x55, 0xc2, 0x71, 0x79, 0x13, 0xc7, 0xa3, 0xda,
0x77, 0x68, 0xc0, 0xd8, 0x10, 0xdd, 0x24, 0x8b,
0x15, 0x59, 0xc5, 0x10, 0xe2, 0x20, 0x99, 0x8e,
0xf0, 0x05, 0x9b, 0x31, 0x88, 0x5a, 0xe3, 0xd9,
0x37, 0xba, 0xe2, 0xdb, 0xbf, 0x92, 0xfa, 0x66,
0x16, 0x97, 0x47, 0xd9, 0x9d, 0x1d, 0x28, 0x7c,
0x9d, 0x08, 0x1c, 0xc7, 0xbd, 0xd2, 0x1a, 0x6a,
0x04, 0xf2, 0xa2, 0x1d, 0x75, 0x02, 0x14, 0x5d,
0xc6, 0x78, 0xc8, 0xab, 0xdb, 0xf5, 0xb6, 0x82,
0x6c, 0xb5, 0x83, 0x87, 0xac, 0x28, 0xb2, 0x55,
0xb5, 0x9b, 0xc7, 0xc1, 0xb0, 0xb7, 0xf8, 0x4c,
0xbc, 0x38, 0x0e, 0x8a, 0x04, 0x2a, 0x62, 0x41,
0x6b, 0xe0, 0x84, 0x09, 0x13, 0xe9, 0xe1, 0xea,
0xfb, 0xeb, 0x62, 0x71, 0x4b, 0x25, 0xd9, 0x55,
0x7e, 0x97, 0x57, 0x3b, 0x20, 0x33, 0x96, 0x79,
0xb5, 0xba, 0x2e, 0x4b, 0x58, 0xae, 0x0b, 0xc8,
0x60, 0x93, 0x15, 0x55, 0xbe, 0xd8, 0xde, 0x65,
0x05, 0x6c, 0xb6, 0xc5, 0x66, 0x5d, 0x5e, 0x93,
0xf7, 0x25, 0x65, 0x98, 0x41, 0x29, 0x86, 0x0c,
0xf2, 0xf1, 0x14, 0xa2, 0xb3, 0xbd, 0x75, 0x08,
0x12, 0x83, 0x50, 0xda, 0x1f, 0x23, 0xbe, 0xa3,
0x1d, 0xf4, 0x9d, 0x1d, 0xb5, 0x84, 0x4e, 0x50,
0x38, 0x1d, 0x36, 0x48, 0x21, 0x95, 0xd1, 0xac,
0x81, 0x99, 0x1d, 0xc1, 0x3f, 0x41, 0xe6, 0x9e,
0x42, 0x5b, 0x0a, 0x48, 0xcc, 0x5f, 0xe0, 0x7d,
0x3f, 0xc4, 0x6f, 0x0e, 0xfe, 0xc0, 0x2d, 0xfe,
0x01, 0x2c, 0xd6, 0x9b, 0x5d, 0xbe, 0xba, 0x21,
0xca, 0x79, 0xcb, 0xe3, 0x49, 0x60, 0xef, 0x68,
0x05, 0x28, 0x9b, 0x8c, 0xc1, 0x12, 0x3e, 0xdb,
0xc7, 0x04, 0x7e, 0xa6, 0x74, 0x29, 0xcc, 0x13,
0xed, 0x07, 0x94, 0x81, 0xd6, 0x96, 0xaa, 0x97,
0xaa, 0xa5, 0xc0, 0x2f, 0xb5, 0xb5, 0x2e, 0xe6,
0xfc, 0xca, 0xfa, 0x60, 0x4d, 0x02, 0xf7, 0x19,
0x9c, 0x5f, 0xa4, 0xe9, 0xf9, 0xf7, 0xf4, 0xc7,
0x79, 0x9a, 0xc0, 0xb6, 0xcc, 0x58, 0xec, 0xec,
0xe4, 0x37, 0x22, 0xfa, 0x8b, 0x53,
};
static unsigned char some_data[] = {
0x2f, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x54, 0x68,
0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20,
0x69, 0x73, 0x20, 0x66, 0x72, 0x65, 0x65, 0x20,
0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
0x3b, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61,
0x6e, 0x20, 0x72, 0x65, 0x64, 0x69, 0x73, 0x74,
0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x69,
0x74, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72,
0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0a,
0x20, 0x2a, 0x20, 0x69, 0x74, 0x20, 0x75, 0x6e,
0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20,
0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x6f, 0x66,
0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x2c,
0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x20, 0x32, 0x2c, 0x0a, 0x20, 0x2a, 0x20, 0x61,
0x73, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73,
0x68, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x2a, 0x0a,
0x20, 0x2a, 0x20, 0x49, 0x6e, 0x20, 0x61, 0x64,
0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74,
0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x65,
0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e,
0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
0x20, 0x47, 0x4e, 0x55, 0x20, 0x47, 0x65, 0x6e,
0x65, 0x72, 0x61, 0x6c, 0x20, 0x50, 0x75, 0x62,
0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69, 0x63, 0x65,
0x6e, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x2a, 0x20,
0x74, 0x68, 0x65, 0x20, 0x61, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x73, 0x20, 0x67, 0x69, 0x76, 0x65,
0x20, 0x79, 0x6f, 0x75, 0x20, 0x75, 0x6e, 0x6c,
0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x70,
0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x20, 0x74, 0x6f, 0x20, 0x6c, 0x69, 0x6e,
0x6b, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x0a, 0x20,
0x2a, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69,
0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x69,
0x6e, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6d, 0x62,
0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x74,
0x68, 0x65, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x67,
0x72, 0x61, 0x6d, 0x73, 0x2c, 0x0a, 0x20, 0x2a,
0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20,
0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
0x74, 0x65, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65,
0x20, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x69,
0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6e,
0x79, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x2a,
0x20, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x20,
0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65,
0x20, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20,
0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
0x65, 0x2e, 0x20, 0x20, 0x28, 0x54, 0x68, 0x65,
0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
0x20, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72,
0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
0x64, 0x6f, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79,
0x20, 0x69, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65,
0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x65, 0x63,
0x74, 0x73, 0x3b, 0x20, 0x66, 0x6f, 0x72, 0x20,
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c,
0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x63, 0x6f,
0x76, 0x65, 0x72, 0x0a, 0x20, 0x2a, 0x20, 0x6d,
0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74,
0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c,
0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x69, 0x73,
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x6e,
0x6f, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x6b, 0x65,
0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x0a, 0x20,
0x2a, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x62,
0x69, 0x6e, 0x65, 0x64, 0x20, 0x65, 0x78, 0x65,
0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e,
0x29, 0x0a, 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20,
0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
0x65, 0x20, 0x69, 0x73, 0x20, 0x64, 0x69, 0x73,
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20,
0x68, 0x6f, 0x70, 0x65, 0x20, 0x74, 0x68, 0x61,
0x74, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c,
0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65,
0x66, 0x75, 0x6c, 0x2c, 0x20, 0x62, 0x75, 0x74,
0x0a, 0x20, 0x2a, 0x20, 0x57, 0x49, 0x54, 0x48,
0x4f, 0x55, 0x54, 0x20, 0x41, 0x4e, 0x59, 0x20,
0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x59,
0x3b, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75,
0x74, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x74,
0x68, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69,
0x65, 0x64, 0x20, 0x77, 0x61, 0x72, 0x72, 0x61,
0x6e, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x0a, 0x20,
0x2a, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41,
0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54,
0x59, 0x20, 0x6f, 0x72, 0x20, 0x46, 0x49, 0x54,
0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52,
0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49,
0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55,
0x52, 0x50, 0x4f, 0x53, 0x45, 0x2e, 0x20, 0x20,
0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20,
0x47, 0x4e, 0x55, 0x0a, 0x20, 0x2a, 0x20, 0x47,
0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69,
0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x66, 0x6f,
0x72, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x64,
0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a,
0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x59, 0x6f,
0x75, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64,
0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x72, 0x65,
0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x20, 0x61,
0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x6f, 0x66,
0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
0x20, 0x2a, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68,
0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,
0x61, 0x6d, 0x3b, 0x20, 0x73, 0x65, 0x65, 0x20,
0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65,
0x20, 0x43, 0x4f, 0x50, 0x59, 0x49, 0x4e, 0x47,
0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f,
0x74, 0x2c, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65,
0x20, 0x74, 0x6f, 0x0a, 0x20, 0x2a, 0x20, 0x74,
0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x35, 0x31, 0x20,
0x46, 0x72, 0x61, 0x6e, 0x6b, 0x6c, 0x69, 0x6e,
0x20, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x2c,
0x20, 0x46, 0x69, 0x66, 0x74, 0x68, 0x20, 0x46,
0x6c, 0x6f, 0x6f, 0x72, 0x2c, 0x0a, 0x20, 0x2a,
0x20, 0x42, 0x6f, 0x73, 0x74, 0x6f, 0x6e, 0x2c,
0x20, 0x4d, 0x41, 0x20, 0x30, 0x32, 0x31, 0x31,
0x30, 0x2d, 0x31, 0x33, 0x30, 0x31, 0x2c, 0x20,
0x55, 0x53, 0x41, 0x2e, 0x0a, 0x20, 0x2a, 0x2f,
0x0a,
};
static object_data some = {
some_bytes,
sizeof(some_bytes),
"fd8430bc864cfcd5f10e5590f8a447e01b942bfe",
"blob",
"test-objects/fd",
"test-objects/fd/8430bc864cfcd5f10e5590f8a447e01b942bfe",
some_data,
sizeof(some_data),
};
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/packed_one.c
|
#include "clar_libgit2.h"
#include "git2/odb_backend.h"
#include "pack_data_one.h"
#include "pack.h"
static git_odb *_odb;
void test_odb_packed_one__initialize(void)
{
git_odb_backend *backend = NULL;
cl_git_pass(git_odb_new(&_odb));
cl_git_pass(git_odb_backend_one_pack(&backend, cl_fixture("testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx")));
cl_git_pass(git_odb_add_backend(_odb, backend, 1));
}
void test_odb_packed_one__cleanup(void)
{
git_odb_free(_odb);
_odb = NULL;
}
void test_odb_packed_one__mass_read(void)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(packed_objects_one); ++i) {
git_oid id;
git_odb_object *obj;
cl_git_pass(git_oid_fromstr(&id, packed_objects_one[i]));
cl_assert(git_odb_exists(_odb, &id) == 1);
cl_git_pass(git_odb_read(&obj, _odb, &id));
git_odb_object_free(obj);
}
}
void test_odb_packed_one__read_header_0(void)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(packed_objects_one); ++i) {
git_oid id;
git_odb_object *obj;
size_t len;
git_object_t type;
cl_git_pass(git_oid_fromstr(&id, packed_objects_one[i]));
cl_git_pass(git_odb_read(&obj, _odb, &id));
cl_git_pass(git_odb_read_header(&len, &type, _odb, &id));
cl_assert(obj->cached.size == len);
cl_assert(obj->cached.type == type);
git_odb_object_free(obj);
}
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/packed.c
|
#include "clar_libgit2.h"
#include "odb.h"
#include "pack_data.h"
static git_odb *_odb;
void test_odb_packed__initialize(void)
{
cl_git_pass(git_odb_open(&_odb, cl_fixture("testrepo.git/objects")));
}
void test_odb_packed__cleanup(void)
{
git_odb_free(_odb);
_odb = NULL;
}
void test_odb_packed__mass_read(void)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(packed_objects); ++i) {
git_oid id;
git_odb_object *obj;
cl_git_pass(git_oid_fromstr(&id, packed_objects[i]));
cl_assert(git_odb_exists(_odb, &id) == 1);
cl_git_pass(git_odb_read(&obj, _odb, &id));
git_odb_object_free(obj);
}
}
void test_odb_packed__read_header_0(void)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(packed_objects); ++i) {
git_oid id;
git_odb_object *obj;
size_t len;
git_object_t type;
cl_git_pass(git_oid_fromstr(&id, packed_objects[i]));
cl_git_pass(git_odb_read(&obj, _odb, &id));
cl_git_pass(git_odb_read_header(&len, &type, _odb, &id));
cl_assert(obj->cached.size == len);
cl_assert(obj->cached.type == type);
git_odb_object_free(obj);
}
}
void test_odb_packed__read_header_1(void)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(loose_objects); ++i) {
git_oid id;
git_odb_object *obj;
size_t len;
git_object_t type;
cl_git_pass(git_oid_fromstr(&id, loose_objects[i]));
cl_assert(git_odb_exists(_odb, &id) == 1);
cl_git_pass(git_odb_read(&obj, _odb, &id));
cl_git_pass(git_odb_read_header(&len, &type, _odb, &id));
cl_assert(obj->cached.size == len);
cl_assert(obj->cached.type == type);
git_odb_object_free(obj);
}
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/pack_data_one.h
|
/* Just a few to make sure it's working, the rest is tested already */
static const char *packed_objects_one[] = {
"9fcf811e00fa469688943a9152c16d4ee90fb9a9",
"a93f42a5b5e9de40fa645a9ff1e276a021c9542b",
"12bf5f3e3470d90db177ccf1b5e8126409377fc6",
"ed1ea164cdbe3c4b200fb4fa19861ea90eaee222",
"dfae6ed8f6dd8acc3b40a31811ea316239223559",
"aefe66d192771201e369fde830530f4475beec30",
"775e4b4c1296e9e3104f2a36ca9cf9356a130959",
"412ec4e4a6a7419bc1be00561fe474e54cb499fe",
"236e7579fed7763be77209efb8708960982f3cb3",
"09fe9364461cf60dd1c46b0e9545b1e47bb1a297",
"d76d8a6390d1cf32138d98a91b1eb7e0275a12f5",
"d0fdf2dcff2f548952eec536ccc6d266550041bc",
"a20d733a9fa79fa5b4cbb9639864f93325ec27a6",
"785d3fe8e7db5ade2c2242fecd46c32a7f4dc59f",
"4d8d0fd9cb6045075385701c3f933ec13345e9c4",
"0cfd861bd547b6520d1fc2e190e8359e0a9c9b90"
};
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/backend/simple.c
|
#include "clar_libgit2.h"
#include "repository.h"
#include "backend_helpers.h"
#define EMPTY_HASH "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
static git_repository *_repo;
static git_odb *_odb;
static git_odb_object *_obj;
static git_oid _oid;
static void setup_backend(const fake_object *objs)
{
git_odb_backend *backend;
cl_git_pass(build_fake_backend(&backend, objs));
cl_git_pass(git_repository_odb__weakptr(&_odb, _repo));
cl_git_pass(git_odb_add_backend(_odb, backend, 10));
}
static void assert_object_contains(git_odb_object *obj, const char *expected)
{
const char *actual = (const char *) git_odb_object_data(obj);
cl_assert_equal_s(actual, expected);
}
void test_odb_backend_simple__initialize(void)
{
_repo = cl_git_sandbox_init("testrepo.git");
_odb = NULL;
_obj = NULL;
}
void test_odb_backend_simple__cleanup(void)
{
git_odb_object_free(_obj);
cl_git_sandbox_cleanup();
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 1));
}
void test_odb_backend_simple__read_of_object_succeeds(void)
{
const fake_object objs[] = {
{ "f6ea0495187600e7b2288c8ac19c5886383a4632", "foobar" },
{ NULL, NULL }
};
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
cl_git_pass(git_odb_read(&_obj, _odb, &_oid));
assert_object_contains(_obj, objs[0].content);
}
void test_odb_backend_simple__read_of_nonexisting_object_fails(void)
{
const fake_object objs[] = {
{ "f6ea0495187600e7b2288c8ac19c5886383a4632", "foobar" },
{ NULL, NULL }
};
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633"));
cl_git_fail_with(GIT_ENOTFOUND, git_odb_read(&_obj, _odb, &_oid));
}
void test_odb_backend_simple__read_with_hash_mismatch_fails(void)
{
const fake_object objs[] = {
{ "1234567890123456789012345678901234567890", "nonmatching content" },
{ NULL, NULL }
};
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
cl_git_fail_with(GIT_EMISMATCH, git_odb_read(&_obj, _odb, &_oid));
}
void test_odb_backend_simple__read_with_hash_mismatch_succeeds_without_verification(void)
{
const fake_object objs[] = {
{ "1234567890123456789012345678901234567890", "nonmatching content" },
{ NULL, NULL }
};
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 0));
cl_git_pass(git_odb_read(&_obj, _odb, &_oid));
assert_object_contains(_obj, objs[0].content);
}
void test_odb_backend_simple__read_prefix_succeeds(void)
{
const fake_object objs[] = {
{ "f6ea0495187600e7b2288c8ac19c5886383a4632", "foobar" },
{ NULL, NULL }
};
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4632"));
cl_git_pass(git_odb_read(&_obj, _odb, &_oid));
assert_object_contains(_obj, objs[0].content);
}
void test_odb_backend_simple__read_prefix_of_nonexisting_object_fails(void)
{
const fake_object objs[] = {
{ "f6ea0495187600e7b2288c8ac19c5886383a4632", "foobar" },
{ NULL, NULL }
};
char *hash = "f6ea0495187600e8";
setup_backend(objs);
cl_git_pass(git_oid_fromstrn(&_oid, hash, strlen(hash)));
cl_git_fail_with(GIT_ENOTFOUND, git_odb_read(&_obj, _odb, &_oid));
}
void test_odb_backend_simple__read_with_ambiguous_prefix_fails(void)
{
const fake_object objs[] = {
{ "1234567890111111111111111111111111111111", "first content" },
{ "1234567890222222222222222222222222222222", "second content" },
{ NULL, NULL }
};
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
cl_git_fail_with(GIT_EAMBIGUOUS, git_odb_read_prefix(&_obj, _odb, &_oid, 7));
}
void test_odb_backend_simple__read_with_highly_ambiguous_prefix(void)
{
const fake_object objs[] = {
{ "1234567890111111111111111111111111111111", "first content" },
{ "1234567890111111111111111111111111111112", "second content" },
{ NULL, NULL }
};
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 0));
cl_git_fail_with(GIT_EAMBIGUOUS, git_odb_read_prefix(&_obj, _odb, &_oid, 39));
cl_git_pass(git_odb_read_prefix(&_obj, _odb, &_oid, 40));
assert_object_contains(_obj, objs[0].content);
}
void test_odb_backend_simple__exists_succeeds(void)
{
const fake_object objs[] = {
{ "f6ea0495187600e7b2288c8ac19c5886383a4632", "foobar" },
{ NULL, NULL }
};
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
cl_assert(git_odb_exists(_odb, &_oid));
}
void test_odb_backend_simple__exists_fails_for_nonexisting_object(void)
{
const fake_object objs[] = {
{ "f6ea0495187600e7b2288c8ac19c5886383a4632", "foobar" },
{ NULL, NULL }
};
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633"));
cl_assert(git_odb_exists(_odb, &_oid) == 0);
}
void test_odb_backend_simple__exists_prefix_succeeds(void)
{
const fake_object objs[] = {
{ "1234567890111111111111111111111111111111", "first content" },
{ "1234567890222222222222222222222222222222", "second content" },
{ NULL, NULL }
};
git_oid found;
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &_oid, 12));
cl_assert(git_oid_equal(&found, &_oid));
}
void test_odb_backend_simple__exists_with_ambiguous_prefix_fails(void)
{
const fake_object objs[] = {
{ "1234567890111111111111111111111111111111", "first content" },
{ "1234567890222222222222222222222222222222", "second content" },
{ NULL, NULL }
};
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
cl_git_fail_with(GIT_EAMBIGUOUS, git_odb_exists_prefix(NULL, _odb, &_oid, 7));
}
void test_odb_backend_simple__exists_with_highly_ambiguous_prefix(void)
{
const fake_object objs[] = {
{ "1234567890111111111111111111111111111111", "first content" },
{ "1234567890111111111111111111111111111112", "second content" },
{ NULL, NULL }
};
git_oid found;
setup_backend(objs);
cl_git_pass(git_oid_fromstr(&_oid, objs[0].oid));
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 0));
cl_git_fail_with(GIT_EAMBIGUOUS, git_odb_exists_prefix(&found, _odb, &_oid, 39));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &_oid, 40));
cl_assert(git_oid_equal(&found, &_oid));
}
void test_odb_backend_simple__null_oid_is_ignored(void)
{
const fake_object objs[] = {
{ "0000000000000000000000000000000000000000", "null oid content" },
{ NULL, NULL }
};
git_oid null_oid = {{0}};
git_odb_object *obj;
setup_backend(objs);
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 0));
cl_assert(!git_odb_exists(_odb, &null_oid));
cl_git_fail_with(GIT_ENOTFOUND, git_odb_read(&obj, _odb, &null_oid));
cl_assert(git_error_last() && strstr(git_error_last()->message, "null OID"));
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/backend/mempack.c
|
#include "clar_libgit2.h"
#include "repository.h"
#include "backend_helpers.h"
#include "git2/sys/mempack.h"
static git_odb *_odb;
static git_oid _oid;
static git_odb_object *_obj;
static git_repository *_repo;
void test_odb_backend_mempack__initialize(void)
{
git_odb_backend *backend;
cl_git_pass(git_mempack_new(&backend));
cl_git_pass(git_odb_new(&_odb));
cl_git_pass(git_odb_add_backend(_odb, backend, 10));
cl_git_pass(git_repository_wrap_odb(&_repo, _odb));
}
void test_odb_backend_mempack__cleanup(void)
{
git_odb_object_free(_obj);
git_odb_free(_odb);
git_repository_free(_repo);
}
void test_odb_backend_mempack__write_succeeds(void)
{
const char *data = "data";
cl_git_pass(git_odb_write(&_oid, _odb, data, strlen(data) + 1, GIT_OBJECT_BLOB));
cl_git_pass(git_odb_read(&_obj, _odb, &_oid));
}
void test_odb_backend_mempack__read_of_missing_object_fails(void)
{
cl_git_pass(git_oid_fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633"));
cl_git_fail_with(GIT_ENOTFOUND, git_odb_read(&_obj, _odb, &_oid));
}
void test_odb_backend_mempack__exists_of_missing_object_fails(void)
{
cl_git_pass(git_oid_fromstr(&_oid, "f6ea0495187600e7b2288c8ac19c5886383a4633"));
cl_assert(git_odb_exists(_odb, &_oid) == 0);
}
void test_odb_backend_mempack__exists_with_existing_objects_succeeds(void)
{
const char *data = "data";
cl_git_pass(git_odb_write(&_oid, _odb, data, strlen(data) + 1, GIT_OBJECT_BLOB));
cl_assert(git_odb_exists(_odb, &_oid) == 1);
}
void test_odb_backend_mempack__blob_create_from_buffer_succeeds(void)
{
const char *data = "data";
cl_git_pass(git_blob_create_from_buffer(&_oid, _repo, data, strlen(data) + 1));
cl_assert(git_odb_exists(_odb, &_oid) == 1);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/backend/backend_helpers.c
|
#include "clar_libgit2.h"
#include "git2/sys/odb_backend.h"
#include "backend_helpers.h"
static int search_object(const fake_object **out, fake_backend *fake, const git_oid *oid, size_t len)
{
const fake_object *obj = fake->objects, *found = NULL;
while (obj && obj->oid) {
git_oid current_oid;
git_oid_fromstr(¤t_oid, obj->oid);
if (git_oid_ncmp(¤t_oid, oid, len) == 0) {
if (found)
return GIT_EAMBIGUOUS;
found = obj;
}
obj++;
}
if (found && out)
*out = found;
return found ? GIT_OK : GIT_ENOTFOUND;
}
static int fake_backend__exists(git_odb_backend *backend, const git_oid *oid)
{
fake_backend *fake;
fake = (fake_backend *)backend;
fake->exists_calls++;
return search_object(NULL, fake, oid, GIT_OID_HEXSZ) == GIT_OK;
}
static int fake_backend__exists_prefix(
git_oid *out, git_odb_backend *backend, const git_oid *oid, size_t len)
{
const fake_object *obj;
fake_backend *fake;
int error;
fake = (fake_backend *)backend;
fake->exists_prefix_calls++;
if ((error = search_object(&obj, fake, oid, len)) < 0)
return error;
if (out)
git_oid_fromstr(out, obj->oid);
return 0;
}
static int fake_backend__read(
void **buffer_p, size_t *len_p, git_object_t *type_p,
git_odb_backend *backend, const git_oid *oid)
{
const fake_object *obj;
fake_backend *fake;
int error;
fake = (fake_backend *)backend;
fake->read_calls++;
if ((error = search_object(&obj, fake, oid, GIT_OID_HEXSZ)) < 0)
return error;
*len_p = strlen(obj->content);
*buffer_p = git__strdup(obj->content);
*type_p = GIT_OBJECT_BLOB;
return 0;
}
static int fake_backend__read_header(
size_t *len_p, git_object_t *type_p,
git_odb_backend *backend, const git_oid *oid)
{
const fake_object *obj;
fake_backend *fake;
int error;
fake = (fake_backend *)backend;
fake->read_header_calls++;
if ((error = search_object(&obj, fake, oid, GIT_OID_HEXSZ)) < 0)
return error;
*len_p = strlen(obj->content);
*type_p = GIT_OBJECT_BLOB;
return 0;
}
static int fake_backend__read_prefix(
git_oid *out_oid, void **buffer_p, size_t *len_p, git_object_t *type_p,
git_odb_backend *backend, const git_oid *short_oid, size_t len)
{
const fake_object *obj;
fake_backend *fake;
int error;
fake = (fake_backend *)backend;
fake->read_prefix_calls++;
if ((error = search_object(&obj, fake, short_oid, len)) < 0)
return error;
git_oid_fromstr(out_oid, obj->oid);
*len_p = strlen(obj->content);
*buffer_p = git__strdup(obj->content);
*type_p = GIT_OBJECT_BLOB;
return 0;
}
static void fake_backend__free(git_odb_backend *_backend)
{
fake_backend *backend;
backend = (fake_backend *)_backend;
git__free(backend);
}
int build_fake_backend(
git_odb_backend **out,
const fake_object *objects)
{
fake_backend *backend;
backend = git__calloc(1, sizeof(fake_backend));
GIT_ERROR_CHECK_ALLOC(backend);
backend->parent.version = GIT_ODB_BACKEND_VERSION;
backend->parent.refresh = NULL;
backend->objects = objects;
backend->parent.read = fake_backend__read;
backend->parent.read_prefix = fake_backend__read_prefix;
backend->parent.read_header = fake_backend__read_header;
backend->parent.exists = fake_backend__exists;
backend->parent.exists_prefix = fake_backend__exists_prefix;
backend->parent.free = &fake_backend__free;
*out = (git_odb_backend *)backend;
return 0;
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/backend/nobackend.c
|
#include "clar_libgit2.h"
#include "repository.h"
#include "git2/sys/repository.h"
static git_repository *_repo;
void test_odb_backend_nobackend__initialize(void)
{
git_config *config;
git_odb *odb;
git_refdb *refdb;
cl_git_pass(git_repository_new(&_repo));
cl_git_pass(git_config_new(&config));
cl_git_pass(git_odb_new(&odb));
cl_git_pass(git_refdb_new(&refdb, _repo));
git_repository_set_config(_repo, config);
git_repository_set_odb(_repo, odb);
git_repository_set_refdb(_repo, refdb);
/* The set increases the refcount and we don't want them anymore */
git_config_free(config);
git_odb_free(odb);
git_refdb_free(refdb);
}
void test_odb_backend_nobackend__cleanup(void)
{
git_repository_free(_repo);
}
void test_odb_backend_nobackend__write_fails_gracefully(void)
{
git_oid id;
git_odb *odb;
const git_error *err;
git_repository_odb(&odb, _repo);
cl_git_fail(git_odb_write(&id, odb, "Hello world!\n", 13, GIT_OBJECT_BLOB));
err = git_error_last();
cl_assert_equal_s(err->message, "cannot write object - unsupported in the loaded odb backends");
git_odb_free(odb);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/backend/nonrefreshing.c
|
#include "clar_libgit2.h"
#include "repository.h"
#include "backend_helpers.h"
static git_repository *_repo;
static fake_backend *_fake;
#define NONEXISTING_HASH "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
#define EXISTING_HASH "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
static const fake_object _objects[] = {
{ EXISTING_HASH, "" },
{ NULL, NULL }
};
static git_oid _nonexisting_oid;
static git_oid _existing_oid;
static void setup_repository_and_backend(void)
{
git_odb *odb = NULL;
git_odb_backend *backend = NULL;
_repo = cl_git_sandbox_init("testrepo.git");
cl_git_pass(build_fake_backend(&backend, _objects));
cl_git_pass(git_repository_odb__weakptr(&odb, _repo));
cl_git_pass(git_odb_add_backend(odb, backend, 10));
_fake = (fake_backend *)backend;
}
void test_odb_backend_nonrefreshing__initialize(void)
{
git_oid_fromstr(&_nonexisting_oid, NONEXISTING_HASH);
git_oid_fromstr(&_existing_oid, EXISTING_HASH);
setup_repository_and_backend();
}
void test_odb_backend_nonrefreshing__cleanup(void)
{
cl_git_sandbox_cleanup();
}
void test_odb_backend_nonrefreshing__exists_is_invoked_once_on_failure(void)
{
git_odb *odb;
cl_git_pass(git_repository_odb__weakptr(&odb, _repo));
cl_assert_equal_b(false, git_odb_exists(odb, &_nonexisting_oid));
cl_assert_equal_i(1, _fake->exists_calls);
}
void test_odb_backend_nonrefreshing__read_is_invoked_once_on_failure(void)
{
git_object *obj;
cl_git_fail_with(
git_object_lookup(&obj, _repo, &_nonexisting_oid, GIT_OBJECT_ANY),
GIT_ENOTFOUND);
cl_assert_equal_i(1, _fake->read_calls);
}
void test_odb_backend_nonrefreshing__readprefix_is_invoked_once_on_failure(void)
{
git_object *obj;
cl_git_fail_with(
git_object_lookup_prefix(&obj, _repo, &_nonexisting_oid, 7, GIT_OBJECT_ANY),
GIT_ENOTFOUND);
cl_assert_equal_i(1, _fake->read_prefix_calls);
}
void test_odb_backend_nonrefreshing__readheader_is_invoked_once_on_failure(void)
{
git_odb *odb;
size_t len;
git_object_t type;
cl_git_pass(git_repository_odb__weakptr(&odb, _repo));
cl_git_fail_with(
git_odb_read_header(&len, &type, odb, &_nonexisting_oid),
GIT_ENOTFOUND);
cl_assert_equal_i(1, _fake->read_header_calls);
}
void test_odb_backend_nonrefreshing__exists_is_invoked_once_on_success(void)
{
git_odb *odb;
cl_git_pass(git_repository_odb__weakptr(&odb, _repo));
cl_assert_equal_b(true, git_odb_exists(odb, &_existing_oid));
cl_assert_equal_i(1, _fake->exists_calls);
}
void test_odb_backend_nonrefreshing__read_is_invoked_once_on_success(void)
{
git_object *obj;
cl_git_pass(git_object_lookup(&obj, _repo, &_existing_oid, GIT_OBJECT_ANY));
cl_assert_equal_i(1, _fake->read_calls);
git_object_free(obj);
}
void test_odb_backend_nonrefreshing__readprefix_is_invoked_once_on_success(void)
{
git_object *obj;
cl_git_pass(git_object_lookup_prefix(&obj, _repo, &_existing_oid, 7, GIT_OBJECT_ANY));
cl_assert_equal_i(1, _fake->read_prefix_calls);
git_object_free(obj);
}
void test_odb_backend_nonrefreshing__readheader_is_invoked_once_on_success(void)
{
git_odb *odb;
size_t len;
git_object_t type;
cl_git_pass(git_repository_odb__weakptr(&odb, _repo));
cl_git_pass(git_odb_read_header(&len, &type, odb, &_existing_oid));
cl_assert_equal_i(1, _fake->read_header_calls);
}
void test_odb_backend_nonrefreshing__read_is_invoked_once_when_revparsing_a_full_oid(void)
{
git_object *obj;
cl_git_fail_with(
git_revparse_single(&obj, _repo, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"),
GIT_ENOTFOUND);
cl_assert_equal_i(1, _fake->read_calls);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/backend/multiple.c
|
#include "clar_libgit2.h"
#include "repository.h"
#include "backend_helpers.h"
#define EXISTING_HASH "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
static git_repository *_repo;
static git_odb_object *_obj;
static fake_backend *_fake_empty;
static fake_backend *_fake_filled;
static git_oid _existing_oid;
static const fake_object _objects_filled[] = {
{ EXISTING_HASH, "" },
{ NULL, NULL }
};
static const fake_object _objects_empty[] = {
{ NULL, NULL }
};
void test_odb_backend_multiple__initialize(void)
{
git_odb_backend *backend;
git_oid_fromstr(&_existing_oid, EXISTING_HASH);
_obj = NULL;
_repo = cl_git_sandbox_init("testrepo.git");
cl_git_pass(build_fake_backend(&backend, _objects_filled));
_fake_filled = (fake_backend *)backend;
cl_git_pass(build_fake_backend(&backend, _objects_empty));
_fake_empty = (fake_backend *)backend;
}
void test_odb_backend_multiple__cleanup(void)
{
git_odb_object_free(_obj);
cl_git_sandbox_cleanup();
}
void test_odb_backend_multiple__read_with_empty_first_succeeds(void)
{
git_odb *odb;
cl_git_pass(git_repository_odb__weakptr(&odb, _repo));
cl_git_pass(git_odb_add_backend(odb, (git_odb_backend *)_fake_filled, 10));
cl_git_pass(git_odb_add_backend(odb, (git_odb_backend *)_fake_empty, 50));
cl_git_pass(git_odb_read(&_obj, odb, &_existing_oid));
cl_assert_equal_i(1, _fake_filled->read_calls);
cl_assert_equal_i(1, _fake_empty->read_calls);
}
void test_odb_backend_multiple__read_with_first_matching_stops(void)
{
git_odb *odb;
cl_git_pass(git_repository_odb__weakptr(&odb, _repo));
cl_git_pass(git_odb_add_backend(odb, (git_odb_backend *)_fake_empty, 10));
cl_git_pass(git_odb_add_backend(odb, (git_odb_backend *)_fake_filled, 50));
cl_git_pass(git_odb_read(&_obj, odb, &_existing_oid));
cl_assert_equal_i(1, _fake_filled->read_calls);
cl_assert_equal_i(0, _fake_empty->read_calls);
}
void test_odb_backend_multiple__read_prefix_with_first_empty_succeeds(void)
{
git_odb *odb;
cl_git_pass(git_repository_odb__weakptr(&odb, _repo));
cl_git_pass(git_odb_add_backend(odb, (git_odb_backend *)_fake_filled, 10));
cl_git_pass(git_odb_add_backend(odb, (git_odb_backend *)_fake_empty, 50));
cl_git_pass(git_odb_read_prefix(&_obj, odb, &_existing_oid, 7));
cl_assert_equal_i(1, _fake_filled->read_prefix_calls);
cl_assert_equal_i(1, _fake_empty->read_prefix_calls);
}
void test_odb_backend_multiple__read_prefix_with_first_matching_reads_both(void)
{
git_odb *odb;
cl_git_pass(git_repository_odb__weakptr(&odb, _repo));
cl_git_pass(git_odb_add_backend(odb, (git_odb_backend *)_fake_empty, -10));
cl_git_pass(git_odb_add_backend(odb, (git_odb_backend *)_fake_filled, 50));
cl_git_pass(git_odb_read_prefix(&_obj, odb, &_existing_oid, 7));
cl_assert_equal_i(1, _fake_filled->read_prefix_calls);
cl_assert_equal_i(1, _fake_empty->read_prefix_calls);
}
void test_odb_backend_multiple__read_prefix_with_first_matching_succeeds_without_hash_verification(void)
{
git_odb *odb;
git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 0);
cl_git_pass(git_repository_odb__weakptr(&odb, _repo));
cl_git_pass(git_odb_add_backend(odb, (git_odb_backend *)_fake_empty, -10));
cl_git_pass(git_odb_add_backend(odb, (git_odb_backend *)_fake_filled, 50));
cl_git_pass(git_odb_read_prefix(&_obj, odb, &_existing_oid, 7));
/*
* Both backends should be checked as we have to check
* for collisions
*/
cl_assert_equal_i(1, _fake_filled->read_prefix_calls);
cl_assert_equal_i(1, _fake_empty->read_prefix_calls);
git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 1);
}
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/odb/backend/backend_helpers.h
|
#include "git2/sys/odb_backend.h"
typedef struct {
const char *oid;
const char *content;
} fake_object;
typedef struct {
git_odb_backend parent;
int exists_calls;
int exists_prefix_calls;
int read_calls;
int read_header_calls;
int read_prefix_calls;
const fake_object *objects;
} fake_backend;
int build_fake_backend(
git_odb_backend **out,
const fake_object *objects);
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/generate_crlf.sh
|
#!/usr/bin/env bash
#
# This script will generate the test corpus for CR/LF data using git;
# we create files with all possible line ending varieties (all LF, all
# CRLF, mixed, etc) on all the possible line ending configurations
# (`core.autocrlf=true`, `text=auto` in gitattributes, etc). This
# allows us to validate that our configuration will match byte-for-byte
# the configuration that git produces.
#
# To update the test resource data, from the test resource directory:
# git rm -r ./crlf_data/{posix,windows}
# sh ./generate_crlf.sh ./crlf ./crlf_data /tmp/crlf_gitdirs
# git add ./crlf_data/{posix,windows}
set -e
if [ "$1" == "" -o "$2" == "" ]; then
echo "usage: $0 crlfrepo directory [tempdir]"
exit 1
fi
input=$1
output=$2
tempdir=$3
set -u
create_to_workdir_data() {
local input=$1
local output=$2
local tempdir=$3
local systype=$4
local autocrlf=$5
local attr=$6
local worktree="${output}/${systype}_to_workdir/autocrlf_${autocrlf}"
if [ "$attr" != "" ]; then
local attrdir=`echo $attr | sed -e "s/ /,/g" | sed -e "s/=/_/g"`
worktree="${worktree},${attrdir}"
fi
if [ "$tempdir" = "" ]; then
local gitdir="${worktree}/.git"
else
local gitdir="${tempdir}/generate_crlf_${RANDOM}"
fi
echo "Creating ${worktree}"
mkdir -p "${worktree}"
git clone --no-checkout --quiet --bare "${input}/.gitted" "${gitdir}"
git --work-tree="${worktree}" --git-dir="${gitdir}" config core.autocrlf ${autocrlf}
if [ "$attr" != "" ]; then
echo "* ${attr}" >> "${worktree}/.gitattributes"
fi
git --work-tree="${worktree}" --git-dir="${gitdir}" checkout HEAD
if [ "$attr" != "" ]; then
rm "${worktree}/.gitattributes"
fi
if [ "$tempdir" != "" ]; then
rm -rf "${gitdir}"
fi
}
create_to_odb_data() {
local input=$1
local output=$2
local tempdir=$3
local systype=$4
local autocrlf=$5
local safecrlf=$6
local attr=$7
local destdir="${output}/${systype}_to_odb/autocrlf_${autocrlf},safecrlf_${safecrlf}"
if [ "$attr" != "" ]; then
local attrdir=`echo $attr | sed -e "s/ /,/g" | sed -e "s/=/_/g"`
destdir="${destdir},${attrdir}"
fi
if [ "$tempdir" = "" ]; then
local workdir="${destdir}/_workdir"
else
local workdir="${tempdir}/generate_crlf_${RANDOM}"
fi
echo "Creating ${destdir}"
mkdir -p "${destdir}"
git init "${workdir}" >/dev/null
git --work-tree="${workdir}" --git-dir="${workdir}/.git" config core.autocrlf "${autocrlf}"
git --work-tree="${workdir}" --git-dir="${workdir}/.git" config core.safecrlf "${safecrlf}"
if [ "$attr" != "" ]; then
echo "* ${attr}" > "${workdir}/.gitattributes"
fi
cp ${input}/* ${workdir}
for path in ${workdir}/*; do
filename=$(basename $path)
failed=""
output=$(git --work-tree="${workdir}" --git-dir="${workdir}/.git" add ${filename} 2>&1) || failed=1
if [ ! -z "${failed}" -a "${output:0:35}" == "fatal: LF would be replaced by CRLF" ]; then
echo "LF would be replaced by CRLF in '${filename}'" > "${destdir}/${filename}.fail"
elif [ ! -z "${failed}" -a "${output:0:35}" == "fatal: CRLF would be replaced by LF" ]; then
echo "CRLF would be replaced by LF in '${filename}'" > "${destdir}/${filename}.fail"
elif [ ! -z "${failed}" ]; then
echo "failed to add ${filename}: ${output}" 1>&2
exit 1
else
git --work-tree="${workdir}" --git-dir="${workdir}/.git" cat-file blob ":${filename}" > "${destdir}/${filename}"
fi
done
if [ "$tempdir" != "" ]; then
rm -rf "${workdir}"
fi
}
if [[ `uname -s` == MINGW* ]]; then
systype="windows"
else
systype="posix"
fi
for autocrlf in true false input; do
for attr in "" text text=auto -text crlf -crlf eol=lf eol=crlf \
"text eol=lf" "text eol=crlf" \
"text=auto eol=lf" "text=auto eol=crlf"; do
create_to_workdir_data "${input}" "${output}" "${tempdir}" \
"${systype}" "${autocrlf}" "${attr}"
for safecrlf in true false warn; do
create_to_odb_data "${input}" "${output}" "${tempdir}" \
"${systype}" "${autocrlf}" "${safecrlf}" "${attr}"
done
done
done
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/push.sh
|
#!/bin/sh
#creates push_src repo for libgit2 push tests.
set -eu
#Create src repo for push
mkdir push_src
pushd push_src
git init
echo a > a.txt
git add .
git commit -m 'added a.txt'
mkdir fold
echo b > fold/b.txt
git add .
git commit -m 'added fold and fold/b.txt'
git branch b1 #b1 and b2 are the same
git branch b2
git checkout -b b3
echo edit >> a.txt
git add .
git commit -m 'edited a.txt'
git checkout -b b4 master
echo edit >> fold\b.txt
git add .
git commit -m 'edited fold\b.txt'
git checkout -b b5 master
git submodule add ../testrepo.git submodule
git commit -m "added submodule named 'submodule' pointing to '../testrepo.git'"
git checkout master
git merge -m "merge b3, b4, and b5 to master" b3 b4 b5
#Log commits to include in testcase
git log --format=oneline --decorate --graph
#*-. 951bbbb90e2259a4c8950db78946784fb53fcbce (HEAD, master) merge b3, b4, and b5 to master
#|\ \
#| | * fa38b91f199934685819bea316186d8b008c52a2 (b5) added submodule named 'submodule' pointing to '../testrepo.git'
#| * | 27b7ce66243eb1403862d05f958c002312df173d (b4) edited fold\b.txt
#| |/
#* | d9b63a88223d8367516f50bd131a5f7349b7f3e4 (b3) edited a.txt
#|/
#* a78705c3b2725f931d3ee05348d83cc26700f247 (b2, b1) added fold and fold/b.txt
#* 5c0bb3d1b9449d1cc69d7519fd05166f01840915 added a.txt
#fix paths so that we can add repo folders under libgit2 repo
#rename .git to .gitted
find . -name .git -exec mv -i '{}' '{}ted' \;
mv -i .gitmodules gitmodules
popd
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/diff/readme.txt
|
The Git feature that r3ally mak3s it stand apart from n3arly 3v3ry other SCM
out there is its branching model.
Git allows and encourages you to have multiple local branches that can be
entirely independent of each other. The creation, merging, and deletion of
those lines of development takes seconds.
Git allows and encourages you to have multiple local branches that can be
entirely independent of each other. The creation, merging, and deletion of
those lines of development takes seconds.
This means that you can do things like:
Role-Bas3d Codelin3s. Have a branch that always contains only what goes to
production, another that you merge work into for testing, and several
smaller ones for day to day work.
Feature Based Workflow. Create new branches for each new feature you're
working on so you can seamlessly switch back and forth between them, then
delete each branch when that feature gets merged into your main line.
Disposable Experimentation. Create a branch to experiment in, realize it's
not going to work, and just delete it - abandoning the work—with nobody else
ever seeing it (even if you've pushed other branches in the meantime).
Notably, when you push to a remote repository, you do not have to push all
share it with others.
Git allows and encourages you to have multiple local branches that can be
entirely independent of each other. The creation, merging, and deletion of
those lines of development takes seconds.
There are ways to accomplish some of this with other systems, but the work
involved is much more difficult and error-prone. Git makes this process
incredibly easy and it changes the way most developers work when they learn
it.!
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/diff/another.txt
|
Git is fast. With Git, nearly all operations are performed locally, giving
it an huge speed advantage on centralized systems that constantly have to
communicate with a server somewh3r3.
For testing, large AWS instances were set up in the same availability
zone. Git and SVN were installed on both machines, the Ruby repository was
copied to both Git and SVN servers, and common operations were performed on
both.
In some cases the commands don't match up exactly. Here, matching on the
lowest common denominator was attempted. For example, the 'commit' tests
also include the time to push for Git, though most of the time you would not
actually be pushing to the server immediately after a commit where the two
commands cannot be separated in SVN.
Note that this is the best case scenario for SVN - a server with no load
with an 80MB/s bandwidth connection to the client machine. Nearly all of
these times would be even worse for SVN if that connection was slower, while
many of the Git times would not be affected.
Clearly, in many of these common version control operations, Git is one or
two orders of magnitude faster than SVN, even under ideal conditions for
SVN.
Let's see how common operations stack up against Subversion, a common
centralized version control system that is similar to CVS or
Perforce. Smaller is faster.
One place where Git is slower is in the initial clone operation. Here, Git
One place where Git is slower is in the initial clone operation. Here, Git
One place where Git is slower is in the initial clone operation. Here, Git
seen in the above charts, it's not considerably slower for an operation that
is only performed once.
It's also interesting to note that the size of the data on the client side
is very similar even though Git also has every version of every file for the
entire history of the project. This illustrates how efficient it is at
compressing and storing data on the client side.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase-submodule/veal.txt
|
VEAL SOUP.
Put into a pot three quarts of water, three onions cut small, one
spoonful of black pepper pounded, and two of salt, with two or three
slices of lean ham; let it boil steadily two hours; skim it
occasionally, then put into it a shin of veal, let it boil two hours
longer; take out the slices of ham, and skim off the grease if any
should rise, take a gill of good cream, mix with it two table-spoonsful
of flour very nicely, and the yelks of two eggs beaten well, strain this
mixture, and add some chopped parsley; pour some soup on by degrees,
stir it well, and pour it into the pot, continuing to stir until it has
boiled two or three minutes to take off the raw taste of the eggs. If
the cream be not perfectly sweet, and the eggs quite new, the thickening
will curdle in the soup. For a change you may put a dozen ripe tomatos
in, first taking off their skins, by letting them stand a few minutes in
hot water, when they may be easily peeled. When made in this way you
must thicken it with the flour only. Any part of the veal may be used,
but the shin or knuckle is the nicest.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase-submodule/oyster.txt
|
OYSTER SOUP.
Wash and drain two quarts of oysters, put them on with three quarts of
water, three onions chopped up, two or three slices of lean ham, pepper
and salt; boil it till reduced one-half, strain it through a sieve,
return the liquid into the pot, put in one quart of fresh oysters, boil
it till they are sufficiently done, and thicken the soup with four
spoonsful of flour, two gills of rich cream, and the yelks of six new
laid eggs beaten well; boil it a few minutes after the thickening is put
in. Take care that it does not curdle, and that the flour is not in
lumps; serve it up with the last oysters that were put in. If the
flavour of thyme be agreeable, you may put in a little, but take care
that it does not boil in it long enough to discolour the soup.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase-submodule/bouilli.txt
|
SOUP WITH BOUILLI.
Take the nicest part of the thick brisket of beef, about eight pounds,
put it into a pot with every thing directed for the other soup; make it
exactly in the same way, only put it on an hour sooner, that you may
have time to prepare the bouilli; after it has boiled five hours, take
out the beef, cover up the soup and set it near the fire that it may
keep hot. Take the skin off the beef, have the yelk of an egg well
beaten, dip a feather in it and wash the top of your beef, sprinkle over
it the crumb of stale bread finely grated, put it in a Dutch oven
previously heated, put the top on with coals enough to brown, but not
burn the beef; let it stand nearly an hour, and prepare your gravy
thus:--Take a sufficient quantity of soup and the vegetables boiled in
it; add to it a table-spoonful of red wine, and two of mushroom catsup,
thicken with a little bit of butter and a little brown flour; make it
very hot, pour it in your dish, and put the beef on it. Garnish it with
green pickle, cut in thin slices, serve up the soup in a tureen with
bits of toasted bread.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase-submodule/gravy.txt
|
GRAVY SOUP.
Get eight pounds of coarse lean beef--wash it clean and lay it in your
pot, put in the same ingredients as for the shin soup, with the same
quantity of water, and follow the process directed for that. Strain the
soup through a sieve, and serve it up clear, with nothing more than
toasted bread in it; two table-spoonsful of mushroom catsup will add a
fine flavour to the soup.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase-submodule/beef.txt
|
BEEF SOUP.
Take the hind shin of beef, cut off all the flesh off the leg-bone,
which must be taken away entirely, or the soup will be greasy. Wash the
meat clean and lay it in a pot, sprinkle over it one small
table-spoonful of pounded black pepper, and two of salt; three onions
the size of a hen's egg, cut small, six small carrots scraped and cut
up, two small turnips pared and cut into dice; pour on three quarts of
water, cover the pot close, and keep it gently and steadily boiling five
hours, which will leave about three pints of clear soup; do not let the
pot boil over, but take off the scum carefully, as it rises. When it has
boiled four hours, put in a small bundle of thyme and parsley, and a
pint of celery cut small, or a tea-spoonful of celery seed pounded.
These latter ingredients would lose their delicate flavour if boiled too
much. Just before you take it up, brown it in the following manner: put
a small table-spoonful of nice brown sugar into an iron skillet, set it
on the fire and stir it till it melts and looks very dark, pour into it
a ladle full of the soup, a little at a time; stirring it all the while.
Strain this browning and mix it well with the soup; take out the bundle
of thyme and parsley, put the nicest pieces of meat in your tureen, and
pour on the soup and vegetables; put in some toasted bread cut in dice,
and serve it up.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase-submodule/asparagus.txt
|
ASPARAGUS SOUP.
Take four large bunches of asparagus, scrape it nicely, cut off one inch
of the tops, and lay them in water, chop the stalks and put them on the
fire with a piece of bacon, a large onion cut up, and pepper and salt;
add two quarts of water, boil them till the stalks are quite soft, then
pulp them through a sieve, and strain the water to it, which must be put
back in the pot; put into it a chicken cut up, with the tops of
asparagus which had been laid by, boil it until these last articles are
sufficiently done, thicken with flour, butter and milk, and serve it up.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/revert/file2.txt
|
File two
File two
File two
File two
File two
File two
File two
File two
File two
File two
File two
File two
File two
File two
File two
File two
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/revert/file1.txt
|
!File one!
!File one!
File one!
File one
File one
File one
File one
File one
File one
File one
File one!
!File one!
!File one!
!File one!
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/revert/file6.txt
|
File six, actually!
File four!
File four!
File four!
File four!
File four!
File four!
File four!
File four!
File four!
File four!
File four!
File four!
File four!
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/revert/file3.txt
|
File three
File three
File three
File three
File three
File three
File three
File three
File three
File three
File three
File three
File three
File three
File three
File three
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/testrepo-worktree/new.txt
|
my new file
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/testrepo-worktree/branch_file.txt
|
hi
bye!
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/testrepo-worktree/link_to_new.txt
|
my new file
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/status/subdir.txt
|
Is it a bird?
Is it a plane?
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/cherrypick/file2.txt
|
!File 2
File 2
File 2
File 2
File 2
File 2
File 2
File 2
File 2
File 2
File 2
File 2
File 2
File 2
File 2
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/cherrypick/file1.txt
|
!File 1
File 1
File 1
File 1
File 1
File 1
File 1
File 1
File 1
File 1
File 1
File 1
File 1
File 1
File 1
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/cherrypick/file3.txt
|
!File 3
File 3
File 3
File 3
File 3
File 3
File 3
File 3
File 3
File 3
File 3
File 3
File 3
File 3
File 3
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/merge-whitespace/test.txt
|
0
1
2
3
4
5 XXX
6
7
8
9
10
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/typechanges/README.md
|
This is a test repo for libgit2 where tree entries have type changes
Types
-----
The key types that could be found in tree entries are:
1. GIT_FILEMODE_NEW = 0000000 (i.e. file does not exist)
2. GIT_FILEMODE_TREE = 0040000
3. GIT_FILEMODE_BLOB = 0100644
4. GIT_FILEMODE_BLOB_EXECUTABLE = 0100755
5. GIT_FILEMODE_LINK = 0120000
6. GIT_FILEMODE_COMMIT = 0160000
I will try to have every type of transition somewhere in the history
of this repo.
Commits
-------
* `a(1--1) b(1--1) c(1--1) d(1--1) e(1--1)`
**Initial commit**<br>
`79b9f23e85f55ea36a472a902e875bc1121a94cb`
* `a(1->2) b(1->3) c(1->4) d(1->5) e(1->6)`
**Create content**<br>
`9bdb75b73836a99e3dbeea640a81de81031fdc29`
* `a(2->3) b(3->4) c(4->5) d(5->6) e(6->2)`
**Changes #1**<br>
`0e7ed140b514b8cae23254cb8656fe1674403aff`
* `a(3->5) b(4->6) c(5->2) d(6->3) e(2->4)`
**Changes #2**<br>
`9d0235c7a7edc0889a18f97a42ee6db9fe688447`
* `a(5->3) b(6->4) c(2->5) d(3->6) e(4->2)`
**Changes #3**<br>
`9b19edf33a03a0c59cdfc113bfa5c06179bf9b1a`
* `a(3->2) b(4->3) c(5->4) d(6->5) e(2->6)`
**Changes #4**<br>
`1b63caae4a5ca96f78e8dfefc376c6a39a142475`<br>
Matches **Changes #1** except README.md
* `a(2->1) b(3->1) c(4->1) d(5->1) e(6->1)`
**Changes #5**<br>
`6eae26c90e8ccc4d16208972119c40635489c6f0`<br>
Matches **Initial commit** except README.md and .gitmodules
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/nsecs/a.txt
|
File A
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/nsecs/b.txt
|
File B
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/nsecs/c.txt
|
File C
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3/TWO/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3/six/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3/three/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3/TEN/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3/nine/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3/Five/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3/FoUr/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3/EIGHT/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3/sEvEn/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod3/One/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase/veal.txt
|
VEAL SOUP.
Put into a pot three quarts of water, three onions cut small, one
spoonful of black pepper pounded, and two of salt, with two or three
slices of lean ham; let it boil steadily two hours; skim it
occasionally, then put into it a shin of veal, let it boil two hours
longer; take out the slices of ham, and skim off the grease if any
should rise, take a gill of good cream, mix with it two table-spoonsful
of flour very nicely, and the yelks of two eggs beaten well, strain this
mixture, and add some chopped parsley; pour some soup on by degrees,
stir it well, and pour it into the pot, continuing to stir until it has
boiled two or three minutes to take off the raw taste of the eggs. If
the cream be not perfectly sweet, and the eggs quite new, the thickening
will curdle in the soup. For a change you may put a dozen ripe tomatos
in, first taking off their skins, by letting them stand a few minutes in
hot water, when they may be easily peeled. When made in this way you
must thicken it with the flour only. Any part of the veal may be used,
but the shin or knuckle is the nicest.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase/oyster.txt
|
OYSTER SOUP.
Wash and drain two quarts of oysters, put them on with three quarts of
water, three onions chopped up, two or three slices of lean ham, pepper
and salt; boil it till reduced one-half, strain it through a sieve,
return the liquid into the pot, put in one quart of fresh oysters, boil
it till they are sufficiently done, and thicken the soup with four
spoonsful of flour, two gills of rich cream, and the yelks of six new
laid eggs beaten well; boil it a few minutes after the thickening is put
in. Take care that it does not curdle, and that the flour is not in
lumps; serve it up with the last oysters that were put in. If the
flavour of thyme be agreeable, you may put in a little, but take care
that it does not boil in it long enough to discolour the soup.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase/bouilli.txt
|
SOUP WITH BOUILLI.
Take the nicest part of the thick brisket of beef, about eight pounds,
put it into a pot with every thing directed for the other soup; make it
exactly in the same way, only put it on an hour sooner, that you may
have time to prepare the bouilli; after it has boiled five hours, take
out the beef, cover up the soup and set it near the fire that it may
keep hot. Take the skin off the beef, have the yelk of an egg well
beaten, dip a feather in it and wash the top of your beef, sprinkle over
it the crumb of stale bread finely grated, put it in a Dutch oven
previously heated, put the top on with coals enough to brown, but not
burn the beef; let it stand nearly an hour, and prepare your gravy
thus:--Take a sufficient quantity of soup and the vegetables boiled in
it; add to it a table-spoonful of red wine, and two of mushroom catsup,
thicken with a little bit of butter and a little brown flour; make it
very hot, pour it in your dish, and put the beef on it. Garnish it with
green pickle, cut in thin slices, serve up the soup in a tureen with
bits of toasted bread.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase/gravy.txt
|
GRAVY SOUP.
Get eight pounds of coarse lean beef--wash it clean and lay it in your
pot, put in the same ingredients as for the shin soup, with the same
quantity of water, and follow the process directed for that. Strain the
soup through a sieve, and serve it up clear, with nothing more than
toasted bread in it; two table-spoonsful of mushroom catsup will add a
fine flavour to the soup.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase/beef.txt
|
BEEF SOUP.
Take the hind shin of beef, cut off all the flesh off the leg-bone,
which must be taken away entirely, or the soup will be greasy. Wash the
meat clean and lay it in a pot, sprinkle over it one small
table-spoonful of pounded black pepper, and two of salt; three onions
the size of a hen's egg, cut small, six small carrots scraped and cut
up, two small turnips pared and cut into dice; pour on three quarts of
water, cover the pot close, and keep it gently and steadily boiling five
hours, which will leave about three pints of clear soup; do not let the
pot boil over, but take off the scum carefully, as it rises. When it has
boiled four hours, put in a small bundle of thyme and parsley, and a
pint of celery cut small, or a tea-spoonful of celery seed pounded.
These latter ingredients would lose their delicate flavour if boiled too
much. Just before you take it up, brown it in the following manner: put
a small table-spoonful of nice brown sugar into an iron skillet, set it
on the fire and stir it till it melts and looks very dark, pour into it
a ladle full of the soup, a little at a time; stirring it all the while.
Strain this browning and mix it well with the soup; take out the bundle
of thyme and parsley, put the nicest pieces of meat in your tureen, and
pour on the soup and vegetables; put in some toasted bread cut in dice,
and serve it up.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/rebase/asparagus.txt
|
ASPARAGUS SOUP.
TAKE FOUR LARGE BUNCHES of asparagus, scrape it nicely, cut off one inch
OF THE TOPS, and lay them in water, chop the stalks and put them on the
FIRE WITH A PIECE OF BACON, a large onion cut up, and pepper and salt;
ADD TWO QUARTS OF WATER, boil them till the stalks are quite soft, then
PULP THEM THROUGH A SIEVE, and strain the water to it, which must be put
back in the pot; put into it a chicken cut up, with the tops of
asparagus which had been laid by, boil it until these last articles are
sufficiently done, thicken with flour, butter and milk, and serve it up.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2/README.txt
|
This is the submodule test data
This repo will have a bunch of submodules in different states
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2/sm_missing_commits/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2/not/README.txt
|
what am I really
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2/sm_changed_file/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2/sm_added_and_uncommited/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2/sm_unchanged/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2/sm_changed_head/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2/not-submodule/README.txt
|
This is a git repo but not a submodule
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2/sm_changed_index/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submod2/sm_changed_untracked_file/README.txt
|
This is the target for submod2 submodule links.
Don't add commits casually because you make break tests.
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/attr/root_test4.txt
|
Here is some stuff at the start
This should go in one hunk (first)
Some additional lines
Down here below the other lines
With even more at the end
Followed by a second hunk of stuff (second)
That happens down here
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/attr
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/attr/sub/subdir_test2.txt
|
Hello again
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/attr/sub
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/attr/sub/sub/subsub.txt
|
subsub
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submodules
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submodules/testrepo/new.txt
|
my new file
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submodules
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/submodules/testrepo/branch_file.txt
|
hi
bye!
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/mergedrepo/conflicts-one.txt
|
<<<<<<< HEAD
This is most certainly a conflict!
=======
This is a conflict!!!
>>>>>>> branch
|
0 |
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources
|
repos/gyro/.gyro/zig-libgit2-mattnite-github.com-0537beea/pkg/libgit2/tests/resources/mergedrepo/one.txt
|
This is file one!
This is file one.
This is file one.
This is file one.
This is file one.
This is file one.
This is file one.
This is file one.
This is file one.
This is file one!
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.