Skip to content

Commit

Permalink
test: Add source_get_file_revision to stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
thentenaar committed Dec 25, 2018
1 parent 1f47408 commit 12f85c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ static char **source_find_migrations(const char *UNUSED(source),
const char *UNUSED(prev_rev),
size_t *size);
static const char *source_get_local_head(const char *UNUSED(source));
static const char *source_get_file_revision(const char *UNUSED(source),
const char *UNUSED(file));
static const char *source_get_migration_path(const char *UNUSED(source));
static int migration_upgrade(const char *UNUSED(path));
static int migration_downgrade(const char *UNUSED(path));
Expand Down Expand Up @@ -208,6 +210,12 @@ static char **source_find_migrations(const char *UNUSED(source),
return source_find_migrations_returns;
}

static const char *source_get_file_revision(const char *UNUSED(source),
const char *UNUSED(file))
{
return NULL;
}

static const char *source_get_local_head(const char *UNUSED(source))
{
++source_get_local_head_called;
Expand Down
5 changes: 5 additions & 0 deletions test/libgit2_stubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ static struct git_err *giterr_last(void)
return giterr_last_returns;
}

static void giterr_clear(void)
{
giterr_last_returns = NULL;
}

static int git_revparse_single(git_object **out, git_repository *repo,
const char *rev)
{
Expand Down
2 changes: 2 additions & 0 deletions test/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const struct source_backend_vtable backend_without_init = {
NULL, /* backend_init */
NULL, /* backend_find_migrations */
NULL, /* backend_get_head */
NULL, /* backend_get_file_revision */
NULL, /* backend_get_migration_path */
NULL /* backend_uninit, */
};
Expand All @@ -96,6 +97,7 @@ const struct source_backend_vtable backend_with_init = {
backend_init,
backend_find_migrations,
backend_get_head,
NULL,
backend_get_migration_path,
backend_uninit
};
Expand Down

0 comments on commit 12f85c7

Please sign in to comment.