Skip to content

Commit ed8cfbf

Browse files
committed
references: use new names in internal usage
Update internal usage to use the `git_reference` names for constants.
1 parent 87fe578 commit ed8cfbf

File tree

26 files changed

+244
-243
lines changed

26 files changed

+244
-243
lines changed

examples/for-each-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ static int show_ref(git_reference *ref, void *data)
1010
const git_oid *oid;
1111
git_object *obj;
1212

13-
if (git_reference_type(ref) == GIT_REF_SYMBOLIC)
13+
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC)
1414
check_lg2(git_reference_resolve(&resolved, ref),
1515
"Unable to resolve symbolic reference",
1616
git_reference_name(ref));

examples/general.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,12 +692,12 @@ static void reference_listing(git_repository *repo)
692692
git_reference_lookup(&ref, repo, refname);
693693

694694
switch (git_reference_type(ref)) {
695-
case GIT_REF_OID:
695+
case GIT_REFERENCE_DIRECT:
696696
git_oid_fmt(oid_hex, git_reference_target(ref));
697697
printf("%s [%s]\n", refname, oid_hex);
698698
break;
699699

700-
case GIT_REF_SYMBOLIC:
700+
case GIT_REFERENCE_SYMBOLIC:
701701
printf("%s => %s\n", refname, git_reference_symbolic_target(ref));
702702
break;
703703
default:

src/branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static int branch_equals(git_repository *repo, const char *path, void *payload)
141141
int equal = 0;
142142

143143
if (git_reference__read_head(&head, repo, path) < 0 ||
144-
git_reference_type(head) != GIT_REF_SYMBOLIC)
144+
git_reference_type(head) != GIT_REFERENCE_SYMBOLIC)
145145
goto done;
146146

147147
equal = !git__strcmp(head->target.symbolic, branch->name);

src/refdb_fs.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -811,12 +811,12 @@ static int loose_commit(git_filebuf *file, const git_reference *ref)
811811
{
812812
assert(file && ref);
813813

814-
if (ref->type == GIT_REF_OID) {
814+
if (ref->type == GIT_REFERENCE_DIRECT) {
815815
char oid[GIT_OID_HEXSZ + 1];
816816
git_oid_nfmt(oid, sizeof(oid), &ref->target.oid);
817817

818818
git_filebuf_printf(file, "%s\n", oid);
819-
} else if (ref->type == GIT_REF_SYMBOLIC) {
819+
} else if (ref->type == GIT_REFERENCE_SYMBOLIC) {
820820
git_filebuf_printf(file, GIT_SYMREF "%s\n", ref->target.symbolic);
821821
} else {
822822
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,
11421142
goto out;
11431143

11441144
/* If the types don't match, there's no way the values do */
1145-
if (old_id && old_ref->type != GIT_REF_OID) {
1145+
if (old_id && old_ref->type != GIT_REFERENCE_DIRECT) {
11461146
*cmp = -1;
11471147
goto out;
11481148
}
1149-
if (old_target && old_ref->type != GIT_REF_SYMBOLIC) {
1149+
if (old_target && old_ref->type != GIT_REFERENCE_SYMBOLIC) {
11501150
*cmp = 1;
11511151
goto out;
11521152
}
11531153

1154-
if (old_id && old_ref->type == GIT_REF_OID)
1154+
if (old_id && old_ref->type == GIT_REFERENCE_DIRECT)
11551155
*cmp = git_oid_cmp(old_id, &old_ref->target.oid);
11561156

1157-
if (old_target && old_ref->type == GIT_REF_SYMBOLIC)
1157+
if (old_target && old_ref->type == GIT_REFERENCE_SYMBOLIC)
11581158
*cmp = git__strcmp(old_target, old_ref->target.symbolic);
11591159

11601160
out:
@@ -1184,7 +1184,7 @@ static int maybe_append_head(refdb_fs_backend *backend, const git_reference *ref
11841184
git_reference *tmp = NULL, *head = NULL, *peeled = NULL;
11851185
const char *name;
11861186

1187-
if (ref->type == GIT_REF_SYMBOLIC)
1187+
if (ref->type == GIT_REFERENCE_SYMBOLIC)
11881188
return 0;
11891189

11901190
/* 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
11941194
if ((error = git_reference_lookup(&head, backend->repo, GIT_HEAD_FILE)) < 0)
11951195
return error;
11961196

1197-
if (git_reference_type(head) == GIT_REF_OID)
1197+
if (git_reference_type(head) == GIT_REFERENCE_DIRECT)
11981198
goto cleanup;
11991199

12001200
if ((error = git_reference_lookup(&tmp, backend->repo, GIT_HEAD_FILE)) < 0)
12011201
goto cleanup;
12021202

12031203
/* Go down the symref chain until we find the branch */
1204-
while (git_reference_type(tmp) == GIT_REF_SYMBOLIC) {
1204+
while (git_reference_type(tmp) == GIT_REFERENCE_SYMBOLIC) {
12051205
error = git_reference_lookup(&peeled, backend->repo, git_reference_symbolic_target(tmp));
12061206
if (error < 0)
12071207
break;
@@ -1279,7 +1279,7 @@ static int refdb_fs_backend__write_tail(
12791279
goto on_error;
12801280
}
12811281

1282-
if (ref->type == GIT_REF_SYMBOLIC)
1282+
if (ref->type == GIT_REFERENCE_SYMBOLIC)
12831283
new_target = ref->target.symbolic;
12841284
else
12851285
new_id = &ref->target.oid;
@@ -1886,7 +1886,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
18861886
git_buf buf = GIT_BUF_INIT, path = GIT_BUF_INIT;
18871887
git_repository *repo = backend->repo;
18881888

1889-
is_symbolic = ref->type == GIT_REF_SYMBOLIC;
1889+
is_symbolic = ref->type == GIT_REFERENCE_SYMBOLIC;
18901890

18911891
/* "normal" symbolic updates do not write */
18921892
if (is_symbolic &&
@@ -1979,7 +1979,7 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
19791979
repo = backend->repo;
19801980

19811981
if ((error = git_reference__normalize_name(
1982-
&normalized, new_name, GIT_REF_FORMAT_ALLOW_ONELEVEL)) < 0)
1982+
&normalized, new_name, GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL)) < 0)
19831983
return error;
19841984

19851985
if (git_buf_joinpath(&temp_path, repo->gitdir, GIT_REFLOG_DIR) < 0)

0 commit comments

Comments
 (0)