Commit ed8cfbf0 by Edward Thomson

references: use new names in internal usage

Update internal usage to use the `git_reference` names for constants.
parent 87fe5788
......@@ -10,7 +10,7 @@ static int show_ref(git_reference *ref, void *data)
const git_oid *oid;
git_object *obj;
if (git_reference_type(ref) == GIT_REF_SYMBOLIC)
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC)
check_lg2(git_reference_resolve(&resolved, ref),
"Unable to resolve symbolic reference",
git_reference_name(ref));
......
......@@ -692,12 +692,12 @@ static void reference_listing(git_repository *repo)
git_reference_lookup(&ref, repo, refname);
switch (git_reference_type(ref)) {
case GIT_REF_OID:
case GIT_REFERENCE_DIRECT:
git_oid_fmt(oid_hex, git_reference_target(ref));
printf("%s [%s]\n", refname, oid_hex);
break;
case GIT_REF_SYMBOLIC:
case GIT_REFERENCE_SYMBOLIC:
printf("%s => %s\n", refname, git_reference_symbolic_target(ref));
break;
default:
......
......@@ -141,7 +141,7 @@ static int branch_equals(git_repository *repo, const char *path, void *payload)
int equal = 0;
if (git_reference__read_head(&head, repo, path) < 0 ||
git_reference_type(head) != GIT_REF_SYMBOLIC)
git_reference_type(head) != GIT_REFERENCE_SYMBOLIC)
goto done;
equal = !git__strcmp(head->target.symbolic, branch->name);
......
......@@ -811,12 +811,12 @@ static int loose_commit(git_filebuf *file, const git_reference *ref)
{
assert(file && ref);
if (ref->type == GIT_REF_OID) {
if (ref->type == GIT_REFERENCE_DIRECT) {
char oid[GIT_OID_HEXSZ + 1];
git_oid_nfmt(oid, sizeof(oid), &ref->target.oid);
git_filebuf_printf(file, "%s\n", oid);
} else if (ref->type == GIT_REF_SYMBOLIC) {
} else if (ref->type == GIT_REFERENCE_SYMBOLIC) {
git_filebuf_printf(file, GIT_SYMREF "%s\n", ref->target.symbolic);
} else {
assert(0); /* don't let this happen */
......@@ -1142,19 +1142,19 @@ static int cmp_old_ref(int *cmp, git_refdb_backend *backend, const char *name,
goto out;
/* If the types don't match, there's no way the values do */
if (old_id && old_ref->type != GIT_REF_OID) {
if (old_id && old_ref->type != GIT_REFERENCE_DIRECT) {
*cmp = -1;
goto out;
}
if (old_target && old_ref->type != GIT_REF_SYMBOLIC) {
if (old_target && old_ref->type != GIT_REFERENCE_SYMBOLIC) {
*cmp = 1;
goto out;
}
if (old_id && old_ref->type == GIT_REF_OID)
if (old_id && old_ref->type == GIT_REFERENCE_DIRECT)
*cmp = git_oid_cmp(old_id, &old_ref->target.oid);
if (old_target && old_ref->type == GIT_REF_SYMBOLIC)
if (old_target && old_ref->type == GIT_REFERENCE_SYMBOLIC)
*cmp = git__strcmp(old_target, old_ref->target.symbolic);
out:
......@@ -1184,7 +1184,7 @@ static int maybe_append_head(refdb_fs_backend *backend, const git_reference *ref
git_reference *tmp = NULL, *head = NULL, *peeled = NULL;
const char *name;
if (ref->type == GIT_REF_SYMBOLIC)
if (ref->type == GIT_REFERENCE_SYMBOLIC)
return 0;
/* if we can't resolve, we use {0}*40 as old id */
......@@ -1194,14 +1194,14 @@ static int maybe_append_head(refdb_fs_backend *backend, const git_reference *ref
if ((error = git_reference_lookup(&head, backend->repo, GIT_HEAD_FILE)) < 0)
return error;
if (git_reference_type(head) == GIT_REF_OID)
if (git_reference_type(head) == GIT_REFERENCE_DIRECT)
goto cleanup;
if ((error = git_reference_lookup(&tmp, backend->repo, GIT_HEAD_FILE)) < 0)
goto cleanup;
/* Go down the symref chain until we find the branch */
while (git_reference_type(tmp) == GIT_REF_SYMBOLIC) {
while (git_reference_type(tmp) == GIT_REFERENCE_SYMBOLIC) {
error = git_reference_lookup(&peeled, backend->repo, git_reference_symbolic_target(tmp));
if (error < 0)
break;
......@@ -1279,7 +1279,7 @@ static int refdb_fs_backend__write_tail(
goto on_error;
}
if (ref->type == GIT_REF_SYMBOLIC)
if (ref->type == GIT_REFERENCE_SYMBOLIC)
new_target = ref->target.symbolic;
else
new_id = &ref->target.oid;
......@@ -1886,7 +1886,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
git_buf buf = GIT_BUF_INIT, path = GIT_BUF_INIT;
git_repository *repo = backend->repo;
is_symbolic = ref->type == GIT_REF_SYMBOLIC;
is_symbolic = ref->type == GIT_REFERENCE_SYMBOLIC;
/* "normal" symbolic updates do not write */
if (is_symbolic &&
......@@ -1979,7 +1979,7 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
repo = backend->repo;
if ((error = git_reference__normalize_name(
&normalized, new_name, GIT_REF_FORMAT_ALLOW_ONELEVEL)) < 0)
&normalized, new_name, GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL)) < 0)
return error;
if (git_buf_joinpath(&temp_path, repo->gitdir, GIT_REFLOG_DIR) < 0)
......
......@@ -55,8 +55,8 @@ extern bool git_reference__enable_symbolic_ref_target_validation;
#define GIT_STASH_FILE "stash"
#define GIT_REFS_STASH_FILE GIT_REFS_DIR GIT_STASH_FILE
#define GIT_REF_FORMAT__PRECOMPOSE_UNICODE (1u << 16)
#define GIT_REF_FORMAT__VALIDATION_DISABLE (1u << 15)
#define GIT_REFERENCE_FORMAT__PRECOMPOSE_UNICODE (1u << 16)
#define GIT_REFERENCE_FORMAT__VALIDATION_DISABLE (1u << 15)
#define GIT_REFNAME_MAX 1024
......@@ -64,7 +64,7 @@ typedef char git_refname_t[GIT_REFNAME_MAX];
struct git_reference {
git_refdb *db;
git_ref_t type;
git_reference_t type;
union {
git_oid oid;
......
......@@ -69,8 +69,9 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
refspec->pattern = is_glob;
refspec->src = git__strndup(lhs, llen);
flags = GIT_REF_FORMAT_ALLOW_ONELEVEL | GIT_REF_FORMAT_REFSPEC_SHORTHAND
| (is_glob ? GIT_REF_FORMAT_REFSPEC_PATTERN : 0);
flags = GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL |
GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND |
(is_glob ? GIT_REFERENCE_FORMAT_REFSPEC_PATTERN : 0);
if (is_fetch) {
/*
......
......@@ -1126,7 +1126,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
error = git_reference_resolve(&resolved_ref, ref);
/* If we're in an unborn branch, let's pretend nothing happened */
if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REF_SYMBOLIC) {
if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
ref_name = git_reference_symbolic_target(ref);
error = 0;
} else {
......@@ -1329,7 +1329,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
if (error < 0)
goto cleanup;
if (git_reference_type(ref) == GIT_REF_SYMBOLIC) {
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
git_reference_free(ref);
continue;
}
......@@ -1919,7 +1919,7 @@ static int rename_one_remote_reference(
git_buf_cstr(&log_message))) < 0)
goto cleanup;
if (git_reference_type(ref) != GIT_REF_SYMBOLIC)
if (git_reference_type(ref) != GIT_REFERENCE_SYMBOLIC)
goto cleanup;
/* Handle refs like origin/HEAD -> origin/master */
......
......@@ -2119,7 +2119,7 @@ int git_repository_head_detached(git_repository *repo)
if (git_reference_lookup(&ref, repo, GIT_HEAD_FILE) < 0)
return -1;
if (git_reference_type(ref) == GIT_REF_SYMBOLIC) {
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
git_reference_free(ref);
return 0;
}
......@@ -2146,7 +2146,7 @@ int git_repository_head_detached_for_worktree(git_repository *repo, const char *
if ((error = git_repository_head_for_worktree(&ref, repo, name)) < 0)
goto out;
error = (git_reference_type(ref) != GIT_REF_SYMBOLIC);
error = (git_reference_type(ref) != GIT_REFERENCE_SYMBOLIC);
out:
git_reference_free(ref);
......@@ -2163,7 +2163,7 @@ int git_repository_head(git_reference **head_out, git_repository *repo)
if ((error = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0)
return error;
if (git_reference_type(head) == GIT_REF_OID) {
if (git_reference_type(head) == GIT_REFERENCE_DIRECT) {
*head_out = head;
return 0;
}
......@@ -2188,7 +2188,7 @@ int git_repository_head_for_worktree(git_reference **out, git_repository *repo,
(error = git_reference__read_head(&head, repo, path.ptr)) < 0)
goto out;
if (git_reference_type(head) != GIT_REF_OID) {
if (git_reference_type(head) != GIT_REFERENCE_DIRECT) {
git_reference *resolved;
error = git_reference_lookup_resolved(&resolved, repo, git_reference_symbolic_target(head), -1);
......@@ -2286,7 +2286,7 @@ int git_repository_is_empty(git_repository *repo)
if (git_reference_lookup(&head, repo, GIT_HEAD_FILE) < 0)
return -1;
if (git_reference_type(head) == GIT_REF_SYMBOLIC)
if (git_reference_type(head) == GIT_REFERENCE_SYMBOLIC)
is_empty =
(strcmp(git_reference_symbolic_target(head),
GIT_REFS_HEADS_DIR "master") == 0) &&
......@@ -2594,7 +2594,7 @@ static int checkout_message(git_buf *out, git_reference *old, const char *new)
{
git_buf_puts(out, "checkout: moving from ");
if (git_reference_type(old) == GIT_REF_SYMBOLIC)
if (git_reference_type(old) == GIT_REFERENCE_SYMBOLIC)
git_buf_puts(out, git_reference__shorthand(git_reference_symbolic_target(old)));
else
git_buf_puts(out, git_oid_tostr_s(git_reference_target(old)));
......@@ -2669,7 +2669,7 @@ int git_repository_set_head(
if (error < 0 && error != GIT_ENOTFOUND)
goto cleanup;
if (ref && current->type == GIT_REF_SYMBOLIC && git__strcmp(current->target.symbolic, ref->name) &&
if (ref && current->type == GIT_REFERENCE_SYMBOLIC && git__strcmp(current->target.symbolic, ref->name) &&
git_reference_is_branch(ref) && git_branch_is_checked_out(ref)) {
giterr_set(GITERR_REPOSITORY, "cannot set HEAD to reference '%s' as it is the current HEAD "
"of a linked repository.", git_reference_name(ref));
......
......@@ -30,7 +30,7 @@ typedef struct {
const char *name;
void *payload;
git_ref_t ref_type;
git_reference_t ref_type;
union {
git_oid id;
char *symbolic;
......@@ -189,7 +189,7 @@ int git_transaction_set_target(git_transaction *tx, const char *refname, const g
return error;
git_oid_cpy(&node->target.id, target);
node->ref_type = GIT_REF_OID;
node->ref_type = GIT_REFERENCE_DIRECT;
return 0;
}
......@@ -209,7 +209,7 @@ int git_transaction_set_symbolic_target(git_transaction *tx, const char *refname
node->target.symbolic = git_pool_strdup(&tx->pool, target);
GITERR_CHECK_ALLOC(node->target.symbolic);
node->ref_type = GIT_REF_SYMBOLIC;
node->ref_type = GIT_REFERENCE_SYMBOLIC;
return 0;
}
......@@ -223,7 +223,7 @@ int git_transaction_remove(git_transaction *tx, const char *refname)
return error;
node->remove = true;
node->ref_type = GIT_REF_OID; /* the id will be ignored */
node->ref_type = GIT_REFERENCE_DIRECT; /* the id will be ignored */
return 0;
}
......@@ -292,9 +292,9 @@ static int update_target(git_refdb *db, transaction_node *node)
git_reference *ref;
int error, update_reflog;
if (node->ref_type == GIT_REF_OID) {
if (node->ref_type == GIT_REFERENCE_DIRECT) {
ref = git_reference__alloc(node->name, &node->target.id, NULL);
} else if (node->ref_type == GIT_REF_SYMBOLIC) {
} else if (node->ref_type == GIT_REFERENCE_SYMBOLIC) {
ref = git_reference__alloc_symbolic(node->name, node->target.symbolic);
} else {
abort();
......@@ -305,9 +305,9 @@ static int update_target(git_refdb *db, transaction_node *node)
if (node->remove) {
error = git_refdb_unlock(db, node->payload, 2, false, ref, NULL, NULL);
} else if (node->ref_type == GIT_REF_OID) {
} else if (node->ref_type == GIT_REFERENCE_DIRECT) {
error = git_refdb_unlock(db, node->payload, true, update_reflog, ref, node->sig, node->message);
} else if (node->ref_type == GIT_REF_SYMBOLIC) {
} else if (node->ref_type == GIT_REFERENCE_SYMBOLIC) {
error = git_refdb_unlock(db, node->payload, true, update_reflog, ref, node->sig, node->message);
} else {
abort();
......@@ -339,7 +339,7 @@ int git_transaction_commit(git_transaction *tx)
return error;
}
if (node->ref_type != GIT_REF_INVALID) {
if (node->ref_type != GIT_REFERENCE_INVALID) {
if ((error = update_target(tx->db, node)) < 0)
return error;
}
......
......@@ -100,7 +100,7 @@ static int add_ref(transport_local *t, const char *name)
git_oid_cpy(&head->oid, &obj_id);
if (git_reference_type(ref) == GIT_REF_SYMBOLIC) {
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
head->symref_target = git__strdup(git_reference_symbolic_target(ref));
GITERR_CHECK_ALLOC(head->symref_target);
}
......@@ -512,7 +512,7 @@ static int foreach_reference_cb(git_reference *reference, void *payload)
git_revwalk *walk = (git_revwalk *)payload;
int error;
if (git_reference_type(reference) != GIT_REF_OID) {
if (git_reference_type(reference) != GIT_REFERENCE_DIRECT) {
git_reference_free(reference);
return 0;
}
......
......@@ -297,7 +297,7 @@ static int fetch_setup_walk(git_revwalk **out, git_repository *repo)
if ((error = git_reference_lookup(&ref, repo, refs.strings[i])) < 0)
goto on_error;
if (git_reference_type(ref) == GIT_REF_SYMBOLIC)
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC)
continue;
if ((error = git_revwalk_push(walk, git_reference_target(ref))) < 0)
......
......@@ -10,7 +10,7 @@ void assert_on_branch(git_repository *repo, const char *branch)
git_buf bname = GIT_BUF_INIT;
cl_git_pass(git_reference_lookup(&head, repo, GIT_HEAD_FILE));
cl_assert_(git_reference_type(head) == GIT_REF_SYMBOLIC, branch);
cl_assert_(git_reference_type(head) == GIT_REFERENCE_SYMBOLIC, branch);
cl_git_pass(git_buf_joinpath(&bname, "refs/heads", branch));
cl_assert_equal_s(bname.ptr, git_reference_symbolic_target(head));
......
......@@ -157,7 +157,7 @@ void test_commit_write__root(void)
/* First we need to update HEAD so it points to our non-existant branch */
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert(git_reference_type(head) == GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(head) == GIT_REFERENCE_SYMBOLIC);
head_old = git__strdup(git_reference_symbolic_target(head));
cl_assert(head_old != NULL);
git_reference_free(head);
......
......@@ -369,7 +369,7 @@ void test_network_fetchlocal__clone_into_mirror(void)
cl_git_pass(git_clone(&repo, cl_git_fixture_url("testrepo.git"), "./foo.git", &opts));
cl_git_pass(git_reference_lookup(&ref, repo, "HEAD"));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(ref));
cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(ref));
cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(ref));
git_reference_free(ref);
......
......@@ -145,7 +145,7 @@ void test_online_clone__empty_repository(void)
cl_assert_equal_i(true, git_repository_head_unborn(g_repo));
cl_git_pass(git_reference_lookup(&head, g_repo, GIT_HEAD_FILE));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
git_reference_free(head);
......@@ -185,7 +185,7 @@ void test_online_clone__can_checkout_a_cloned_repo(void)
cl_assert_equal_i(true, git_path_isfile(git_buf_cstr(&path)));
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
cl_assert_equal_i(true, checkout_progress_cb_was_called);
......@@ -226,7 +226,7 @@ void test_online_clone__clone_mirror(void)
cl_git_pass(git_clone(&g_repo, LIVE_REPO_URL, "./foo.git", &opts));
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
cl_assert_equal_i(true, fetch_progress_cb_was_called);
......
......@@ -450,7 +450,7 @@ void test_rebase_merge__finish(void)
cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));
cl_git_pass(git_reference_lookup(&head_ref, repo, "HEAD"));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head_ref));
cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head_ref));
cl_assert_equal_s("refs/heads/gravy", git_reference_symbolic_target(head_ref));
/* Make sure the reflogs are updated appropriately */
......@@ -512,7 +512,7 @@ void test_rebase_merge__detached_finish(void)
cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));
cl_git_pass(git_reference_lookup(&head_ref, repo, "HEAD"));
cl_assert_equal_i(GIT_REF_OID, git_reference_type(head_ref));
cl_assert_equal_i(GIT_REFERENCE_DIRECT, git_reference_type(head_ref));
/* Make sure the reflogs are updated appropriately */
cl_git_pass(git_reflog_read(&reflog, repo, "HEAD"));
......@@ -561,7 +561,7 @@ void test_rebase_merge__finish_with_ids(void)
cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));
cl_git_pass(git_reference_lookup(&head_ref, repo, "HEAD"));
cl_assert_equal_i(GIT_REF_OID, git_reference_type(head_ref));
cl_assert_equal_i(GIT_REFERENCE_DIRECT, git_reference_type(head_ref));
cl_assert_equal_oid(&commit_id, git_reference_target(head_ref));
/* reflogs are not updated as if we were operating on proper
......
......@@ -72,7 +72,7 @@ void test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD(
git_reference *head, *branch;
cl_git_pass(git_reference_lookup(&head, repo, GIT_HEAD_FILE));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
git_reference_free(head);
......
......@@ -41,13 +41,13 @@ void test_refs_create__symbolic(void)
/* Ensure the reference can be looked-up... */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(looked_up_ref) & GIT_REFERENCE_SYMBOLIC);
cl_assert(reference_is_packed(looked_up_ref) == 0);
cl_assert_equal_s(looked_up_ref->name, new_head_tracker);
/* ...peeled.. */
cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
cl_assert(git_reference_type(resolved_ref) == GIT_REFERENCE_DIRECT);
/* ...and that it points to the current master tip */
cl_assert_equal_oid(&id, git_reference_target(resolved_ref));
......@@ -91,7 +91,7 @@ void test_refs_create__symbolic_with_arbitrary_content(void)
/* Ensure the reference can be looked-up... */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(looked_up_ref) & GIT_REFERENCE_SYMBOLIC);
cl_assert(reference_is_packed(looked_up_ref) == 0);
cl_assert_equal_s(looked_up_ref->name, new_head_tracker);
git_reference_free(looked_up_ref);
......@@ -104,7 +104,7 @@ void test_refs_create__symbolic_with_arbitrary_content(void)
/* Ensure the reference can be looked-up... */
cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head_tracker));
cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(looked_up_ref) & GIT_REFERENCE_SYMBOLIC);
cl_assert(reference_is_packed(looked_up_ref) == 0);
cl_assert_equal_s(looked_up_ref->name, new_head_tracker);
......@@ -152,7 +152,7 @@ void test_refs_create__oid(void)
/* Ensure the reference can be looked-up... */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head));
cl_assert(git_reference_type(looked_up_ref) & GIT_REF_OID);
cl_assert(git_reference_type(looked_up_ref) & GIT_REFERENCE_DIRECT);
cl_assert(reference_is_packed(looked_up_ref) == 0);
cl_assert_equal_s(looked_up_ref->name, new_head);
......
......@@ -33,7 +33,7 @@ void test_refs_overwrite__symbolic(void)
/* Ensure it points to the right place*/
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_SYMBOLIC);
cl_assert_equal_s(git_reference_symbolic_target(ref), ref_branch_name);
git_reference_free(ref);
......@@ -44,7 +44,7 @@ void test_refs_overwrite__symbolic(void)
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_SYMBOLIC);
cl_assert_equal_s(git_reference_symbolic_target(ref), ref_master_name);
git_reference_free(ref);
......@@ -58,7 +58,7 @@ void test_refs_overwrite__object_id(void)
git_oid id;
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
......@@ -67,7 +67,7 @@ void test_refs_overwrite__object_id(void)
git_reference_free(ref);
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_test_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
......@@ -90,7 +90,7 @@ void test_refs_overwrite__object_id_with_symbolic(void)
git_oid id;
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
......@@ -102,7 +102,7 @@ void test_refs_overwrite__object_id_with_symbolic(void)
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_SYMBOLIC);
cl_assert_equal_s(git_reference_symbolic_target(ref), ref_master_name);
git_reference_free(ref);
......@@ -115,7 +115,7 @@ void test_refs_overwrite__symbolic_with_object_id(void)
git_oid id;
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
......@@ -129,7 +129,7 @@ void test_refs_overwrite__symbolic_with_object_id(void)
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
cl_assert_equal_oid(&id, git_reference_target(ref));
git_reference_free(ref);
......
......@@ -34,7 +34,7 @@ void test_refs_read__loose_tag(void)
git_buf ref_name_from_tag_name = GIT_BUF_INIT;
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_type(reference) & GIT_REFERENCE_DIRECT);
cl_assert(reference_is_packed(reference) == 0);
cl_assert_equal_s(reference->name, loose_tag_ref_name);
......@@ -71,12 +71,12 @@ void test_refs_read__symbolic(void)
git_oid id;
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(reference) & GIT_REFERENCE_SYMBOLIC);
cl_assert(reference_is_packed(reference) == 0);
cl_assert_equal_s(reference->name, GIT_HEAD_FILE);
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
cl_assert(git_reference_type(resolved_ref) == GIT_REFERENCE_DIRECT);
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJECT_ANY));
cl_assert(object != NULL);
......@@ -99,12 +99,12 @@ void test_refs_read__nested_symbolic(void)
git_oid id;
cl_git_pass(git_reference_lookup(&reference, g_repo, head_tracker_sym_ref_name));
cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(reference) & GIT_REFERENCE_SYMBOLIC);
cl_assert(reference_is_packed(reference) == 0);
cl_assert_equal_s(reference->name, head_tracker_sym_ref_name);
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
cl_assert(git_reference_type(resolved_ref) == GIT_REFERENCE_DIRECT);
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJECT_ANY));
cl_assert(object != NULL);
......@@ -167,7 +167,7 @@ void test_refs_read__packed(void)
git_object *object;
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_type(reference) & GIT_REFERENCE_DIRECT);
cl_assert(reference_is_packed(reference));
cl_assert_equal_s(reference->name, packed_head_name);
......@@ -188,7 +188,7 @@ void test_refs_read__loose_first(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
git_reference_free(reference);
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_test_head_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_type(reference) & GIT_REFERENCE_DIRECT);
cl_assert(reference_is_packed(reference) == 0);
cl_assert_equal_s(reference->name, packed_test_head_name);
......
......@@ -264,7 +264,7 @@ void test_refs_rename__overwrite(void)
git_oid id;
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
git_oid_cpy(&id, git_reference_target(ref));
......@@ -297,7 +297,7 @@ void test_refs_rename__prefix(void)
git_oid id;
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
git_oid_cpy(&id, git_reference_target(ref));
......@@ -330,7 +330,7 @@ void test_refs_rename__move_up(void)
git_oid id;
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
cl_assert(git_reference_type(ref) & GIT_REFERENCE_DIRECT);
git_oid_cpy(&id, git_reference_target(ref));
......
......@@ -27,12 +27,12 @@ void test_refs_setter__update_direct(void)
git_oid id;
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) == GIT_REF_OID);
cl_assert(git_reference_type(ref) == GIT_REFERENCE_DIRECT);
git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
cl_git_pass(git_reference_lookup(&test_ref, g_repo, ref_test_name));
cl_assert(git_reference_type(test_ref) == GIT_REF_OID);
cl_assert(git_reference_type(test_ref) == GIT_REFERENCE_DIRECT);
cl_git_pass(git_reference_set_target(&new_ref, test_ref, &id, NULL));
......@@ -40,7 +40,7 @@ void test_refs_setter__update_direct(void)
git_reference_free(new_ref);
cl_git_pass(git_reference_lookup(&test_ref, g_repo, ref_test_name));
cl_assert(git_reference_type(test_ref) == GIT_REF_OID);
cl_assert(git_reference_type(test_ref) == GIT_REFERENCE_DIRECT);
cl_assert_equal_oid(&id, git_reference_target(test_ref));
git_reference_free(test_ref);
}
......@@ -50,7 +50,7 @@ void test_refs_setter__update_symbolic(void)
git_reference *head, *new_head;
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert(git_reference_type(head) == GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(head) == GIT_REFERENCE_SYMBOLIC);
cl_assert(strcmp(git_reference_symbolic_target(head), ref_master_name) == 0);
cl_git_pass(git_reference_symbolic_set_target(&new_head, head, ref_test_name, NULL));
......@@ -58,7 +58,7 @@ void test_refs_setter__update_symbolic(void)
git_reference_free(head);
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert(git_reference_type(head) == GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(head) == GIT_REFERENCE_SYMBOLIC);
cl_assert(strcmp(git_reference_symbolic_target(head), ref_test_name) == 0);
git_reference_free(head);
}
......@@ -70,7 +70,7 @@ void test_refs_setter__cant_update_direct_with_symbolic(void)
git_oid id;
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) == GIT_REF_OID);
cl_assert(git_reference_type(ref) == GIT_REFERENCE_DIRECT);
git_oid_cpy(&id, git_reference_target(ref));
cl_git_fail(git_reference_symbolic_set_target(&new, ref, ref_name, NULL));
......@@ -85,7 +85,7 @@ void test_refs_setter__cant_update_symbolic_with_direct(void)
git_oid id;
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
cl_assert(git_reference_type(ref) == GIT_REF_OID);
cl_assert(git_reference_type(ref) == GIT_REFERENCE_DIRECT);
git_oid_cpy(&id, git_reference_target(ref));
git_reference_free(ref);
......
......@@ -19,7 +19,7 @@ void test_refs_update__updating_the_target_of_a_symref_with_an_invalid_name_retu
git_reference *head;
cl_git_pass(git_reference_lookup(&head, g_repo, GIT_HEAD_FILE));
cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
git_reference_free(head);
cl_assert_equal_i(GIT_EINVALIDSPEC, git_reference_symbolic_create(&head, g_repo, GIT_HEAD_FILE, "refs/heads/inv@{id", 1, NULL));
......
......@@ -442,7 +442,7 @@ void test_repo_init__extended_1(void)
cl_assert((S_ISGID & st.st_mode) == 0);
cl_git_pass(git_reference_lookup(&ref, _repo, "HEAD"));
cl_assert(git_reference_type(ref) == GIT_REF_SYMBOLIC);
cl_assert(git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC);
cl_assert_equal_s("refs/heads/development", git_reference_symbolic_target(ref));
git_reference_free(ref);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment