diff options
47 files changed, 226 insertions, 220 deletions
diff --git a/include/git2/pack.h b/include/git2/pack.h index 94d5fc6a1..585cffef6 100644 --- a/include/git2/pack.h +++ b/include/git2/pack.h @@ -38,8 +38,9 @@ GIT_EXTERN(int) git_packbuilder_new(git_packbuilder **out, git_repository *repo) * * @param pb The packbuilder * @param n Number of threads to spawn + * @return number of actual threads to be used */ -GIT_EXTERN(void) git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n); +GIT_EXTERN(unsigned int) git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n); /** * Insert a single object @@ -48,12 +49,12 @@ GIT_EXTERN(void) git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n * commits followed by trees and blobs. * * @param pb The packbuilder - * @param oid The oid of the commit - * @param oid The name; might be NULL + * @param id The oid of the commit + * @param name The name; might be NULL * * @return 0 or an error code */ -GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid, const char *name); +GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *id, const char *name); /** * Insert a root tree object @@ -61,11 +62,11 @@ GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid, * This will add the tree as well as all referenced trees and blobs. * * @param pb The packbuilder - * @param oid The oid of the root tree + * @param id The oid of the root tree * * @return 0 or an error code */ -GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *oid); +GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *id); /** * Write the new pack and the corresponding index to path @@ -82,15 +83,17 @@ GIT_EXTERN(int) git_packbuilder_write(git_packbuilder *pb, const char *file); * * @param pb the packbuilder * @param cb the callback to call with each packed object's buffer - * @param data the callback's data + * @param payload the callback's data * @return 0 or an error code */ -GIT_EXTERN(int) git_packbuilder_foreach(git_packbuilder *pb, int (*cb)(void *buf, size_t size, void *data), void *data); +typedef int (*git_packbuilder_foreach_cb)(void *buf, size_t size, void *payload); +GIT_EXTERN(int) git_packbuilder_foreach(git_packbuilder *pb, git_packbuilder_foreach_cb cb, void *payload); /** * Get the total number of objects the packbuilder will write out * * @param pb the packbuilder + * @return */ GIT_EXTERN(uint32_t) git_packbuilder_object_count(git_packbuilder *pb); @@ -98,6 +101,7 @@ GIT_EXTERN(uint32_t) git_packbuilder_object_count(git_packbuilder *pb); * Get the number of objects the packbuilder has already written out * * @param pb the packbuilder + * @return */ GIT_EXTERN(uint32_t) git_packbuilder_written(git_packbuilder *pb); diff --git a/include/git2/reflog.h b/include/git2/reflog.h index 72e1f1753..45dff2165 100644 --- a/include/git2/reflog.h +++ b/include/git2/reflog.h @@ -30,11 +30,11 @@ GIT_BEGIN_DECL * The reflog must be freed manually by using * git_reflog_free(). * - * @param reflog pointer to reflog + * @param out pointer to reflog * @param ref reference to read the reflog for * @return 0 or an error code */ -GIT_EXTERN(int) git_reflog_read(git_reflog **reflog, git_reference *ref); +GIT_EXTERN(int) git_reflog_read(git_reflog **out, const git_reference *ref); /** * Write an existing in-memory reflog object back to disk @@ -51,12 +51,12 @@ GIT_EXTERN(int) git_reflog_write(git_reflog *reflog); * `msg` is optional and can be NULL. * * @param reflog an existing reflog object - * @param new_oid the OID the reference is now pointing to + * @param id the OID the reference is now pointing to * @param committer the signature of the committer * @param msg the reflog message * @return 0 or an error code */ -GIT_EXTERN(int) git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_signature *committer, const char *msg); +GIT_EXTERN(int) git_reflog_append(git_reflog *reflog, const git_oid *id, const git_signature *committer, const char *msg); /** * Rename the reflog for the given reference @@ -64,10 +64,10 @@ GIT_EXTERN(int) git_reflog_append(git_reflog *reflog, const git_oid *new_oid, co * The reflog to be renamed is expected to already exist * * @param ref the reference - * @param new_name the new name of the reference + * @param name the new name of the reference * @return 0 or an error code */ -GIT_EXTERN(int) git_reflog_rename(git_reference *ref, const char *new_name); +GIT_EXTERN(int) git_reflog_rename(git_reference *ref, const char *name); /** * Delete the reflog for the given reference @@ -83,7 +83,7 @@ GIT_EXTERN(int) git_reflog_delete(git_reference *ref); * @param reflog the previously loaded reflog * @return the number of log entries */ -GIT_EXTERN(unsigned int) git_reflog_entrycount(git_reflog *reflog); +GIT_EXTERN(size_t) git_reflog_entrycount(git_reflog *reflog); /** * Lookup an entry by its index @@ -126,7 +126,7 @@ GIT_EXTERN(int) git_reflog_drop( * @param entry a reflog entry * @return the old oid */ -GIT_EXTERN(const git_oid *) git_reflog_entry_oidold(const git_reflog_entry *entry); +GIT_EXTERN(const git_oid *) git_reflog_entry_id_old(const git_reflog_entry *entry); /** * Get the new oid @@ -134,7 +134,7 @@ GIT_EXTERN(const git_oid *) git_reflog_entry_oidold(const git_reflog_entry *entr * @param entry a reflog entry * @return the new oid at this time */ -GIT_EXTERN(const git_oid *) git_reflog_entry_oidnew(const git_reflog_entry *entry); +GIT_EXTERN(const git_oid *) git_reflog_entry_id_new(const git_reflog_entry *entry); /** * Get the committer of this entry @@ -142,15 +142,15 @@ GIT_EXTERN(const git_oid *) git_reflog_entry_oidnew(const git_reflog_entry *entr * @param entry a reflog entry * @return the committer */ -GIT_EXTERN(git_signature *) git_reflog_entry_committer(const git_reflog_entry *entry); +GIT_EXTERN(const git_signature *) git_reflog_entry_committer(const git_reflog_entry *entry); /** - * Get the log msg + * Get the log message * * @param entry a reflog entry * @return the log msg */ -GIT_EXTERN(char *) git_reflog_entry_msg(const git_reflog_entry *entry); +GIT_EXTERN(const char *) git_reflog_entry_message(const git_reflog_entry *entry); /** * Free the reflog diff --git a/include/git2/refs.h b/include/git2/refs.h index bc3f44482..4e5a691e6 100644 --- a/include/git2/refs.h +++ b/include/git2/refs.h @@ -29,12 +29,12 @@ GIT_BEGIN_DECL * See `git_reference_create_symbolic()` for documentation about valid * reference names. * - * @param reference_out pointer to the looked-up reference + * @param out pointer to the looked-up reference * @param repo the repository to look up the reference * @param name the long name for the reference (e.g. HEAD, refs/heads/master, refs/tags/v0.1.0, ...) - * @return 0 or an error code + * @return 0 or an error code (ENOTFOUND, EINVALIDSPEC) */ -GIT_EXTERN(int) git_reference_lookup(git_reference **reference_out, git_repository *repo, const char *name); +GIT_EXTERN(int) git_reference_lookup(git_reference **out, git_repository *repo, const char *name); /** * Lookup a reference by name and resolve immediately to OID. @@ -43,12 +43,13 @@ GIT_EXTERN(int) git_reference_lookup(git_reference **reference_out, git_reposito * through to the object id that it refers to. This avoids having to * allocate or free any `git_reference` objects for simple situations. * - * @param oid Pointer to oid to be filled in + * @param out Pointer to oid to be filled in * @param repo The repository in which to look up the reference * @param name The long name for the reference - * @return 0 on success, -1 if name could not be resolved + * @return 0 on success, -1 if name could not be resolved (EINVALIDSPEC, + * ENOTFOUND, etc) */ -GIT_EXTERN(int) git_reference_name_to_oid( +GIT_EXTERN(int) git_reference_name_to_id( git_oid *out, git_repository *repo, const char *name); /** @@ -73,14 +74,14 @@ GIT_EXTERN(int) git_reference_name_to_oid( * This function will return an error if a reference already exists with the * given name unless `force` is true, in which case it will be overwritten. * - * @param ref_out Pointer to the newly created reference + * @param out Pointer to the newly created reference * @param repo Repository where that reference will live * @param name The name of the reference * @param target The target of the reference * @param force Overwrite existing references - * @return 0 or an error code + * @return 0 or an error code (EEXISTS, EINVALIDSPEC) */ -GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repository *repo, const char *name, const char *target, int force); +GIT_EXTERN(int) git_reference_symbolic_create(git_reference **out, git_repository *repo, const char *name, const char *target, int force); /** * Create a new direct reference. @@ -105,14 +106,14 @@ GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repos * This function will return an error if a reference already exists with the * given name unless `force` is true, in which case it will be overwritten. * - * @param ref_out Pointer to the newly created reference + * @param out Pointer to the newly created reference * @param repo Repository where that reference will live * @param name The name of the reference * @param id The object id pointed to by the reference. * @param force Overwrite existing references - * @return 0 or an error code + * @return 0 or an error code (EINVALIDSPEC, EEXISTS) */ -GIT_EXTERN(int) git_reference_create_oid(git_reference **ref_out, git_repository *repo, const char *name, const git_oid *id, int force); +GIT_EXTERN(int) git_reference_create(git_reference **out, git_repository *repo, const char *name, const git_oid *id, int force); /** * Get the OID pointed to by a direct reference. @@ -127,7 +128,7 @@ GIT_EXTERN(int) git_reference_create_oid(git_reference **ref_out, git_repository * @param ref The reference * @return a pointer to the oid if available, NULL otherwise */ -GIT_EXTERN(const git_oid *) git_reference_oid(git_reference *ref); +GIT_EXTERN(const git_oid *) git_reference_target(const git_reference *ref); /** * Get full name to the reference pointed to by a symbolic reference. @@ -137,7 +138,7 @@ GIT_EXTERN(const git_oid *) git_reference_oid(git_reference *ref); * @param ref The reference * @return a pointer to the name if available, NULL otherwise */ -GIT_EXTERN(const char *) git_reference_target(git_reference *ref); +GIT_EXTERN(const char *) git_reference_symbolic_target(const git_reference *ref); /** * Get the type of a reference. @@ -147,7 +148,7 @@ GIT_EXTERN(const char *) git_reference_target(git_reference *ref); * @param ref The reference * @return the type */ -GIT_EXTERN(git_ref_t) git_reference_type(git_reference *ref); +GIT_EXTERN(git_ref_t) git_reference_type(const git_reference *ref); /** * Get the full name of a reference. @@ -157,7 +158,7 @@ GIT_EXTERN(git_ref_t) git_reference_type(git_reference *ref); * @param ref The reference * @return the full name for the ref */ -GIT_EXTERN(const char *) git_reference_name(git_reference *ref); +GIT_EXTERN(const char *) git_reference_name(const git_reference *ref); /** * Resolve a symbolic reference to a direct reference. @@ -175,7 +176,7 @@ GIT_EXTERN(const char *) git_reference_name(git_reference *ref); * @param ref The reference * @return 0 or an error code */ -GIT_EXTERN(int) git_reference_resolve(git_reference **resolved_ref, git_reference *ref); +GIT_EXTERN(int) git_reference_resolve(git_reference **out, const git_reference *ref); /** * Get the repository where a reference resides. @@ -183,7 +184,7 @@ GIT_EXTERN(int) git_reference_resolve(git_reference **resolved_ref, git_referenc * @param ref The reference * @return a pointer to the repo */ -GIT_EXTERN(git_repository *) git_reference_owner(git_reference *ref); +GIT_EXTERN(git_repository *) git_reference_owner(const git_reference *ref); /** * Set the symbolic target of a reference. @@ -194,9 +195,9 @@ GIT_EXTERN(git_repository *) git_reference_owner(git_reference *ref); * * @param ref The reference * @param target The new target for the reference - * @return 0 or an error code + * @return 0 or an error code (EINVALIDSPEC) */ -GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const char *target); +GIT_EXTERN(int) git_reference_symbolic_set_target(git_reference *ref, const char *target); /** * Set the OID target of a reference. @@ -209,7 +210,7 @@ GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const char *target) * @param id The new target OID for the reference * @return 0 or an error code */ -GIT_EXTERN(int) git_reference_set_oid(git_reference *ref, const git_oid *id); +GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const git_oid *id); /** * Rename an existing reference. @@ -231,12 +232,12 @@ GIT_EXTERN(int) git_reference_set_oid(git_reference *ref, const git_oid *id); * the reflog if it exists. * * @param ref The reference to rename - * @param new_name The new name for the reference + * @param name The new name for the reference * @param force Overwrite an existing reference - * @return 0 or an error code + * @return 0 or an error code (EINVALIDSPEC, EEXISTS) * */ -GIT_EXTERN(int) git_reference_rename(git_reference *ref, const char *new_name, int force); +GIT_EXTERN(int) git_reference_rename(git_reference *ref, const char *name, int force); /** * Delete an existing reference. diff --git a/src/branch.c b/src/branch.c index c6173caca..87ee7084f 100644 --- a/src/branch.c +++ b/src/branch.c @@ -77,7 +77,7 @@ int git_branch_create( if (git_buf_joinpath(&canonical_branch_name, GIT_REFS_HEADS_DIR, branch_name) < 0) goto cleanup; - error = git_reference_create_oid(&branch, repository, + error = git_reference_create(&branch, repository, git_buf_cstr(&canonical_branch_name), git_object_id(commit), force); if (!error) diff --git a/src/clone.c b/src/clone.c index 9ef6f8100..ea644dd11 100644 --- a/src/clone.c +++ b/src/clone.c @@ -122,7 +122,7 @@ static int reference_matches_remote_head( if (git_buf_len(&head_info->branchname) > 0) return 0; - if (git_reference_name_to_oid( + if (git_reference_name_to_id( &oid, head_info->repo, reference_name) < 0) { diff --git a/src/notes.c b/src/notes.c index 81e4e5073..75848465e 100644 --- a/src/notes.c +++ b/src/notes.c @@ -406,7 +406,7 @@ static int retrieve_note_tree_and_commit( if ((error = normalize_namespace(notes_ref, repo)) < 0) return error; - if ((error = git_reference_name_to_oid(&oid, repo, *notes_ref)) < 0) + if ((error = git_reference_name_to_id(&oid, repo, *notes_ref)) < 0) return error; if (git_commit_lookup(commit_out, repo, &oid) < 0) diff --git a/src/pack-objects.c b/src/pack-objects.c index a146dc048..5db4bc9ae 100644 --- a/src/pack-objects.c +++ b/src/pack-objects.c @@ -136,10 +136,11 @@ on_error: return -1; } -void git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n) +unsigned int git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n) { assert(pb); pb->nr_threads = n; + return pb->nr_threads; } static void rehash(git_packbuilder *pb) diff --git a/src/reflog.c b/src/reflog.c index 7b07c6a9f..72a34f695 100644 --- a/src/reflog.c +++ b/src/reflog.c @@ -10,7 +10,7 @@ #include "filebuf.h" #include "signature.h" -static int reflog_init(git_reflog **reflog, git_reference *ref) +static int reflog_init(git_reflog **reflog, const git_reference *ref) { git_reflog *log; @@ -180,7 +180,7 @@ void git_reflog_free(git_reflog *reflog) git__free(reflog); } -static int retrieve_reflog_path(git_buf *path, git_reference *ref) +static int retrieve_reflog_path(git_buf *path, const git_reference *ref) { return git_buf_join_n(path, '/', 3, git_reference_owner(ref)->path_repository, GIT_REFLOG_DIR, ref->name); @@ -201,7 +201,7 @@ static int create_new_reflog_file(const char *filepath) return p_close(fd); } -int git_reflog_read(git_reflog **reflog, git_reference *ref) +int git_reflog_read(git_reflog **reflog, const git_reference *ref) { int error = -1; git_buf log_path = GIT_BUF_INIT; @@ -405,10 +405,10 @@ int git_reflog_delete(git_reference *ref) return error; } -unsigned int git_reflog_entrycount(git_reflog *reflog) +size_t git_reflog_entrycount(git_reflog *reflog) { assert(reflog); - return (unsigned int)reflog->entries.length; + return reflog->entries.length; } const git_reflog_entry * git_reflog_entry_byindex(git_reflog *reflog, size_t idx) @@ -425,25 +425,25 @@ const git_reflog_entry * git_reflog_entry_byindex(git_reflog *reflog, size_t idx return git_vector_get(&reflog->entries, pos); } -const git_oid * git_reflog_entry_oidold(const git_reflog_entry *entry) +const git_oid * git_reflog_entry_id_old(const git_reflog_entry *entry) { assert(entry); return &entry->oid_old; } -const git_oid * git_reflog_entry_oidnew(const git_reflog_entry *entry) +const git_oid * git_reflog_entry_id_new(const git_reflog_entry *entry) { assert(entry); return &entry->oid_cur; } -git_signature * git_reflog_entry_committer(const git_reflog_entry *entry) +const git_signature * git_reflog_entry_committer(const git_reflog_entry *entry) { assert(entry); return entry->committer; } -char * git_reflog_entry_msg(const git_reflog_entry *entry) +const char * git_reflog_entry_message(const git_reflog_entry *entry) { assert(entry); return entry->msg; diff --git a/src/refs.c b/src/refs.c index 97c97563e..1aaf4f60f 100644 --- a/src/refs.c +++ b/src/refs.c @@ -1074,7 +1074,7 @@ int git_reference_lookup(git_reference **ref_out, return git_reference_lookup_resolved(ref_out, repo, name, 0); } -int git_reference_name_to_oid( +int git_reference_name_to_id( git_oid *out, git_repository *repo, const char *name) { int error; @@ -1083,7 +1083,7 @@ int git_reference_name_to_oid( if ((error = git_reference_lookup_resolved(&ref, repo, name, -1)) < 0) return error; - git_oid_cpy(out, git_reference_oid(ref)); + git_oid_cpy(out, git_reference_target(ref)); git_reference_free(ref); return 0; } @@ -1153,7 +1153,7 @@ int git_reference_lookup_resolved( /** * Getters */ -git_ref_t git_reference_type(git_reference *ref) +git_ref_t git_reference_type(const git_reference *ref) { assert(ref); @@ -1172,19 +1172,19 @@ int git_reference_is_packed(git_reference *ref) return !!(ref->flags & GIT_REF_PACKED); } -const char *git_reference_name(git_reference *ref) +const char *git_reference_name(const git_reference *ref) { assert(ref); return ref->name; } -git_repository *git_reference_owner(git_reference *ref) +git_repository *git_reference_owner(const git_reference *ref) { assert(ref); return ref->owner; } -const git_oid *git_reference_oid(git_reference *ref) +const git_oid *git_reference_target(const git_reference *ref) { assert(ref); @@ -1194,7 +1194,7 @@ const git_oid *git_reference_oid(git_reference *ref) return &ref->target.oid; } -const char *git_reference_target(git_reference *ref) +const char *git_reference_symbolic_target(const git_reference *ref) { assert(ref); @@ -1204,7 +1204,7 @@ const char *git_reference_target(git_reference *ref) return ref->target.symbolic; } -int git_reference_create_symbolic( +int git_reference_symbolic_create( git_reference **ref_out, git_repository *repo, const char *name, @@ -1231,7 +1231,7 @@ int git_reference_create_symbolic( /* set the target; this will normalize the name automatically * and write the reference on disk */ - if (git_reference_set_target(ref, target) < 0) { + if (git_reference_symbolic_set_target(ref, target) < 0) { git_reference_free(ref); return -1; } @@ -1244,7 +1244,7 @@ int git_reference_create_symbolic( return 0; } -int git_reference_create_oid( +int git_reference_create( git_reference **ref_out, git_repository *repo, const char *name, @@ -1270,7 +1270,7 @@ int git_reference_create_oid( ref->flags |= GIT_REF_OID; /* set the oid; this will write the reference on disk */ - if (git_reference_set_oid(ref, id) < 0) { + if (git_reference_set_target(ref, id) < 0) { git_reference_free(ref); return -1; } @@ -1292,7 +1292,7 @@ int git_reference_create_oid( * We do not repack packed references because of performance * reasons. */ -int git_reference_set_oid(git_reference *ref, const git_oid *id) +int git_reference_set_target(git_reference *ref, const git_oid *id) { git_odb *odb = NULL; @@ -1328,7 +1328,7 @@ int git_reference_set_oid(git_reference *ref, const git_oid *id) * a pack. We just change the target in memory * and overwrite the file on disk. */ -int git_reference_set_target(git_reference *ref, const char *target) +int git_reference_symbolic_set_target(git_reference *ref, const char *target) { char normalized[GIT_REFNAME_MAX]; @@ -1397,10 +1397,10 @@ int git_reference_rename(git_reference *ref, const char *new_name, int force) * Finally we can create the new reference. */ if (ref->flags & GIT_REF_SYMBOLIC) { - result = git_reference_create_symbolic( + result = git_reference_symbolic_create( NULL, ref->owner, new_name, ref->target.symbolic, force); } else { - result = git_reference_create_oid( + result = git_reference_create( NULL, ref->owner, new_name, &ref->target.oid, force); } @@ -1444,10 +1444,10 @@ rollback: * Try to create the old reference again, ignore failures */ if (ref->flags & GIT_REF_SYMBOLIC) - git_reference_create_symbolic( + git_reference_symbolic_create( NULL, ref->owner, ref->name, ref->target.symbolic, 0); else - git_reference_create_oid( + git_reference_create( NULL, ref->owner, ref->name, &ref->target.oid, 0); /* The reference is no longer packed */ @@ -1457,7 +1457,7 @@ rollback: return -1; } -int git_reference_resolve(git_reference **ref_out, git_reference *ref) +int git_reference_resolve(git_reference **ref_out, const git_reference *ref) { if (ref->flags & GIT_REF_OID) return git_reference_lookup(ref_out, ref->owner, ref->name); @@ -1797,7 +1797,7 @@ int git_reference__update(git_repository *repo, const git_oid *oid, const char * * a new reference and that's it */ if (res == GIT_ENOTFOUND) { giterr_clear(); - return git_reference_create_oid(NULL, repo, ref_name, oid, 1); + return git_reference_create(NULL, repo, ref_name, oid, 1); } if (res < 0) @@ -1810,7 +1810,7 @@ int git_reference__update(git_repository *repo, const git_oid *oid, const char * const char *sym_target; /* The target pointed at by this reference */ - sym_target = git_reference_target(ref); + sym_target = git_reference_symbolic_target(ref); /* resolve the reference to the target it points to */ res = git_reference_resolve(&aux, ref); @@ -1822,7 +1822,7 @@ int git_reference__update(git_repository *repo, const git_oid *oid, const char * */ if (res == GIT_ENOTFOUND) { giterr_clear(); - res = git_reference_create_oid(NULL, repo, sym_target, oid, 1); + res = git_reference_create(NULL, repo, sym_target, oid, 1); git_reference_free(ref); return res; } @@ -1840,7 +1840,7 @@ int git_reference__update(git_repository *repo, const git_oid *oid, const char * /* ref is made to point to `oid`: ref is either the original reference, * or the target of the symbolic reference we've looked up */ - res = git_reference_set_oid(ref, oid); + res = git_reference_set_target(ref, oid); git_reference_free(ref); return res; } @@ -1923,7 +1923,7 @@ static int reference_target(git_object **object, git_reference *ref) { const git_oid *oid; - oid = git_reference_oid(ref); + oid = git_reference_target(ref); return git_object_lookup(object, git_reference_owner(ref), oid, GIT_OBJ_ANY); } diff --git a/src/remote.c b/src/remote.c index 4a4d160eb..063e5186a 100644 --- a/src/remote.c +++ b/src/remote.c @@ -695,7 +695,7 @@ int git_remote_update_tips(git_remote *remote) head = (git_remote_head *)refs.contents[0]; if (!strcmp(head->name, GIT_HEAD_FILE)) { - if (git_reference_create_oid(&ref, remote->repo, GIT_FETCH_HEAD_FILE, &head->oid, 1) < 0) + if (git_reference_create(&ref, remote->repo, GIT_FETCH_HEAD_FILE, &head->oid, 1) < 0) goto on_error; i = 1; @@ -735,7 +735,7 @@ int git_remote_update_tips(git_remote *remote) if (git_vector_insert(&update_heads, head) < 0) goto on_error; - error = git_reference_name_to_oid(&old, remote->repo, refname.ptr); + error = git_reference_name_to_id(&old, remote->repo, refname.ptr); if (error < 0 && error != GIT_ENOTFOUND) goto on_error; @@ -746,7 +746,7 @@ int git_remote_update_tips(git_remote *remote) continue; /* In autotag mode, don't overwrite any locally-existing tags */ - error = git_reference_create_oid(&ref, remote->repo, refname.ptr, &head->oid, !autotag); + error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag); if (error < 0 && error != GIT_EEXISTS) goto on_error; diff --git a/src/repository.c b/src/repository.c index deab77192..1642f4570 100644 --- a/src/repository.c +++ b/src/repository.c @@ -1231,7 +1231,7 @@ int git_repository_head_detached(git_repository *repo) return 0; } - exists = git_odb_exists(odb, git_reference_oid(ref)); + exists = git_odb_exists(odb, git_reference_target(ref)); git_reference_free(ref); return exists; @@ -1250,7 +1250,7 @@ int git_repository_head(git_reference **head_out, git_repository *repo) return 0; } - error = git_reference_lookup_resolved(head_out, repo, git_reference_target(head), -1); + error = git_reference_lookup_resolved(head_out, repo, git_reference_symbolic_target(head), -1); git_reference_free(head); return error == GIT_ENOTFOUND ? GIT_EORPHANEDHEAD : error; @@ -1305,7 +1305,7 @@ int git_repository_is_empty(git_repository *repo) goto cleanup; if (!(error = strcmp( - git_reference_target(head), + git_reference_symbolic_target(head), GIT_REFS_HEADS_DIR "master") == 0)) goto cleanup; @@ -1531,11 +1531,11 @@ int git_repository_set_head( if (!error) { if (git_reference_is_branch(ref)) - error = git_reference_create_symbolic(&new_head, repo, GIT_HEAD_FILE, git_reference_name(ref), 1); + error = git_reference_symbolic_create(&new_head, repo, GIT_HEAD_FILE, git_reference_name(ref), 1); else - error = git_repository_set_head_detached(repo, git_reference_oid(ref)); + error = git_repository_set_head_detached(repo, git_reference_target(ref)); } else if (looks_like_a_branch(refname)) - error = git_reference_create_symbolic(&new_head, repo, GIT_HEAD_FILE, refname, 1); + error = git_reference_symbolic_create(&new_head, repo, GIT_HEAD_FILE, refname, 1); git_reference_free(ref); git_reference_free(new_head); @@ -1559,7 +1559,7 @@ int git_repository_set_head_detached( if ((error = git_object_peel(&peeled, object, GIT_OBJ_COMMIT)) < 0) goto cleanup; - error = git_reference_create_oid(&new_head, repo, GIT_HEAD_FILE, git_object_id(peeled), 1); + error = git_reference_create(&new_head, repo, GIT_HEAD_FILE, git_object_id(peeled), 1); cleanup: git_object_free(object); @@ -1581,10 +1581,10 @@ int git_repository_detach_head( if ((error = git_repository_head(&old_head, repo)) < 0) return error; - if ((error = git_object_lookup(&object, repo, git_reference_oid(old_head), GIT_OBJ_COMMIT)) < 0) + if ((error = git_object_lookup(&object, repo, git_reference_target(old_head), GIT_OBJ_COMMIT)) < 0) goto cleanup; - error = git_reference_create_oid(&new_head, repo, GIT_HEAD_FILE, git_reference_oid(old_head), 1); + error = git_reference_create(&new_head, repo, GIT_HEAD_FILE, git_reference_target(old_head), 1); cleanup: git_object_free(object); diff --git a/src/reset.c b/src/reset.c index 8f470b26a..928a2bc8c 100644 --- a/src/reset.c +++ b/src/reset.c @@ -41,14 +41,14 @@ static int update_head(git_repository *repo, git_object *commit) if ((error = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0) goto cleanup; - if ((error = git_reference_create_oid( + if ((error = git_reference_create( &target, repo, - git_reference_target(head), + git_reference_symbolic_target(head), git_object_id(commit), 0)) < 0) goto cleanup; } else { - if ((error = git_reference_set_oid(head, git_object_id(commit))) < 0) + if ((error = git_reference_set_target(head, git_object_id(commit))) < 0) goto cleanup; } diff --git a/src/revparse.c b/src/revparse.c index 6b49402c4..79900c4cc 100644 --- a/src/revparse.c +++ b/src/revparse.c @@ -140,7 +140,7 @@ static int revparse_lookup_object(git_object **out, git_repository *repo, const error = disambiguate_refname(&ref, repo, spec); if (!error) { - error = git_object_lookup(out, repo, git_reference_oid(ref), GIT_OBJ_ANY); + error = git_object_lookup(out, repo, git_reference_target(ref), GIT_OBJ_ANY); git_reference_free(ref); return error; } @@ -203,7 +203,7 @@ static int retrieve_previously_checked_out_branch_or_revision(git_object **out, for (i = 0; i < numentries; i++) { entry = git_reflog_entry_byindex(reflog, i); - msg = git_reflog_entry_msg(entry); + msg = git_reflog_entry_message(entry); if (regexec(&preg, msg, 2, regexmatches, 0)) continue; @@ -263,7 +263,7 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i } entry = git_reflog_entry_byindex(reflog, identifier); - git_oid_cpy(oid, git_reflog_entry_oidnew(entry)); + git_oid_cpy(oid, git_reflog_entry_id_new(entry)); error = 0; goto cleanup; @@ -278,7 +278,7 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i if (commit_time.time - identifier > 0) continue; - git_oid_cpy(oid, git_reflog_entry_oidnew(entry)); + git_oid_cpy(oid, git_reflog_entry_id_new(entry)); error = 0; goto cleanup; } @@ -306,7 +306,7 @@ static int retrieve_revobject_from_reflog(git_object **out, git_reference **base } if (position == 0) { - error = git_object_lookup(out, repo, git_reference_oid(ref), GIT_OBJ_ANY); + error = git_object_lookup(out, repo, git_reference_target(ref), GIT_OBJ_ANY); goto cleanup; } @@ -632,7 +632,7 @@ static int object_from_reference(git_object **object, git_reference *reference) if (git_reference_resolve(&resolved, reference) < 0) return -1; - error = git_object_lookup(object, reference->owner, git_reference_oid(resolved), GIT_OBJ_ANY); + error = git_object_lookup(object, reference->owner, git_reference_target(resolved), GIT_OBJ_ANY); git_reference_free(resolved); return error; diff --git a/src/revwalk.c b/src/revwalk.c index 4fff238ca..236c94502 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -559,7 +559,7 @@ static int push_ref(git_revwalk *walk, const char *refname, int hide) { git_oid oid; - if (git_reference_name_to_oid(&oid, walk->repo, refname) < 0) + if (git_reference_name_to_id(&oid, walk->repo, refname) < 0) return -1; return push_commit(walk, &oid, hide); diff --git a/src/stash.c b/src/stash.c index b74429aca..89e5ff330 100644 --- a/src/stash.c +++ b/src/stash.c @@ -98,7 +98,7 @@ static int retrieve_base_commit_and_message( "%s: ", git_reference_name(head) + strlen(GIT_REFS_HEADS_DIR)); - if (git_commit_lookup(b_commit, repo, git_reference_oid(head)) < 0) + if (git_commit_lookup(b_commit, repo, git_reference_target(head)) < 0) goto cleanup; if (append_commit_description(stash_message, *b_commit) < 0) @@ -436,7 +436,7 @@ static int update_reflog( git_reflog *reflog = NULL; int error; - if ((error = git_reference_create_oid(&stash, repo, GIT_REFS_STASH_FILE, w_commit_oid, 1)) < 0) + if ((error = git_reference_create(&stash, repo, GIT_REFS_STASH_FILE, w_commit_oid, 1)) < 0) goto cleanup; if ((error = git_reflog_read(&reflog, stash)) < 0) @@ -603,8 +603,8 @@ int git_stash_foreach( entry = git_reflog_entry_byindex(reflog, i); if (callback(i, - git_reflog_entry_msg(entry), - git_reflog_entry_oidnew(entry), + git_reflog_entry_message(entry), + git_reflog_entry_id_new(entry), payload)) { error = GIT_EUSER; goto cleanup; diff --git a/src/submodule.c b/src/submodule.c index 6eb1c52f7..6093ff960 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -695,7 +695,7 @@ int git_submodule_open( /* if we have opened the submodule successfully, let's grab the HEAD OID */ if (!error && !(submodule->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID)) { - if (!git_reference_name_to_oid( + if (!git_reference_name_to_id( &submodule->wd_oid, *subrepo, GIT_HEAD_FILE)) submodule->flags |= GIT_SUBMODULE_STATUS__WD_OID_VALID; else @@ -1316,7 +1316,7 @@ static int lookup_head_remote(git_buf *url, git_repository *repo) /* remote should refer to something like refs/remotes/ORIGIN/BRANCH */ if (git_reference_type(remote) != GIT_REF_SYMBOLIC || - git__prefixcmp(git_reference_target(remote), GIT_REFS_REMOTES_DIR) != 0) + git__prefixcmp(git_reference_symbolic_target(remote), GIT_REFS_REMOTES_DIR) != 0) { giterr_set(GITERR_SUBMODULE, "Cannot resolve relative URL when HEAD is not symbolic"); @@ -1324,7 +1324,7 @@ static int lookup_head_remote(git_buf *url, git_repository *repo) goto cleanup; } - scan = tgt = git_reference_target(remote) + strlen(GIT_REFS_REMOTES_DIR); + scan = tgt = git_reference_symbolic_target(remote) + strlen(GIT_REFS_REMOTES_DIR); while (*scan && (*scan != '/' || (scan > tgt && scan[-1] != '\\'))) scan++; /* find non-escaped slash to end ORIGIN name */ @@ -188,7 +188,7 @@ static int retrieve_tag_reference_oid( if (git_buf_joinpath(ref_name_out, GIT_REFS_TAGS_DIR, tag_name) < 0) return -1; - return git_reference_name_to_oid(oid, repo, ref_name_out->ptr); + return git_reference_name_to_id(oid, repo, ref_name_out->ptr); } static int write_tag_annotation( @@ -267,7 +267,7 @@ static int git_tag_create__internal( } else git_oid_cpy(oid, git_object_id(target)); - error = git_reference_create_oid(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite); + error = git_reference_create(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite); git_reference_free(new_ref); git_buf_free(&ref_name); @@ -358,7 +358,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu return -1; } - error = git_reference_create_oid(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite); + error = git_reference_create(&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite); git_reference_free(new_ref); git_buf_free(&ref_name); @@ -409,7 +409,7 @@ static int tags_cb(const char *ref, void *data) if (git__prefixcmp(ref, GIT_REFS_TAGS_DIR) != 0) return 0; /* no tag */ - if (git_reference_name_to_oid(&oid, d->repo, ref) < 0) + if (git_reference_name_to_id(&oid, d->repo, ref) < 0) return -1; return d->cb(ref, &oid, d->cb_data); diff --git a/src/transports/local.c b/src/transports/local.c index 46c9218c7..caac46ea2 100644 --- a/src/transports/local.c +++ b/src/transports/local.c @@ -48,7 +48,7 @@ static int add_ref(transport_local *t, const char *name) head->name = git__strdup(name); GITERR_CHECK_ALLOC(head->name); - if (git_reference_name_to_oid(&head->oid, t->repo, name) < 0) { + if (git_reference_name_to_id(&head->oid, t->repo, name) < 0) { git__free(head->name); git__free(head); return -1; diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c index e24eb2783..06424cb17 100644 --- a/src/transports/smart_protocol.c +++ b/src/transports/smart_protocol.c @@ -188,7 +188,7 @@ static int fetch_setup_walk(git_revwalk **out, git_repository *repo) if (git_reference_type(ref) == GIT_REF_SYMBOLIC) continue; - if (git_revwalk_push(walk, git_reference_oid(ref)) < 0) + if (git_revwalk_push(walk, git_reference_target(ref)) < 0) goto on_error; git_reference_free(ref); diff --git a/tests-clar/checkout/index.c b/tests-clar/checkout/index.c index c7b19dba6..b6d637223 100644 --- a/tests-clar/checkout/index.c +++ b/tests-clar/checkout/index.c @@ -247,7 +247,7 @@ void test_checkout_index__options_dir_modes(void) git_oid oid; git_commit *commit; - cl_git_pass(git_reference_name_to_oid(&oid, g_repo, "refs/heads/dir")); + cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir")); cl_git_pass(git_commit_lookup(&commit, g_repo, &oid)); reset_index_to_treeish((git_object *)commit); diff --git a/tests-clar/clone/network.c b/tests-clar/clone/network.c index def5214c3..4759b607a 100644 --- a/tests-clar/clone/network.c +++ b/tests-clar/clone/network.c @@ -74,7 +74,7 @@ void test_clone_network__empty_repository(void) 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_s("refs/heads/master", git_reference_target(head)); + cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head)); git_reference_free(head); } @@ -129,7 +129,7 @@ void test_clone_network__can_checkout_a_cloned_repo(void) cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD")); cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head)); - cl_assert_equal_s("refs/heads/master", git_reference_target(head)); + cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head)); cl_assert_equal_i(true, checkout_progress_cb_was_called); cl_assert_equal_i(true, fetch_progress_cb_was_called); diff --git a/tests-clar/commit/commit.c b/tests-clar/commit/commit.c index 4cedcea1d..8f071ff94 100644 --- a/tests-clar/commit/commit.c +++ b/tests-clar/commit/commit.c @@ -37,7 +37,7 @@ void test_commit_commit__create_unexisting_update_ref(void) NULL, "some msg", tree, 1, (const git_commit **) &commit)); cl_git_pass(git_reference_lookup(&ref, _repo, "refs/heads/foo/bar")); - cl_assert(!git_oid_cmp(&oid, git_reference_oid(ref))); + cl_assert(!git_oid_cmp(&oid, git_reference_target(ref))); git_tree_free(tree); git_commit_free(commit); diff --git a/tests-clar/commit/write.c b/tests-clar/commit/write.c index 6d628096e..7b9868b89 100644 --- a/tests-clar/commit/write.c +++ b/tests-clar/commit/write.c @@ -112,10 +112,10 @@ 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); - head_old = git__strdup(git_reference_target(head)); + head_old = git__strdup(git_reference_symbolic_target(head)); cl_assert(head_old != NULL); - cl_git_pass(git_reference_set_target(head, branch_name)); + cl_git_pass(git_reference_symbolic_set_target(head, branch_name)); cl_git_pass(git_commit_create_v( &commit_id, /* out id */ @@ -140,7 +140,7 @@ void test_commit_write__root(void) cl_git_pass(git_commit_lookup(&commit, g_repo, &commit_id)); cl_assert(git_commit_parentcount(commit) == 0); cl_git_pass(git_reference_lookup(&branch, g_repo, branch_name)); - branch_oid = git_reference_oid(branch); + branch_oid = git_reference_target(branch); cl_git_pass(git_oid_cmp(branch_oid, &commit_id)); cl_assert(!strcmp(git_commit_message(commit), root_commit_message)); } diff --git a/tests-clar/object/tag/write.c b/tests-clar/object/tag/write.c index 10d04797f..3e1100399 100644 --- a/tests-clar/object/tag/write.c +++ b/tests-clar/object/tag/write.c @@ -58,7 +58,7 @@ void test_object_tag_write__basic(void) cl_assert_equal_s(git_tag_message(tag), tagger_message); cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/the-tag")); - cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0); + cl_assert(git_oid_cmp(git_reference_target(ref_tag), &tag_id) == 0); cl_git_pass(git_reference_delete(ref_tag)); git_tag_free(tag); @@ -103,7 +103,7 @@ void test_object_tag_write__replace(void) cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/e90810b")); - git_oid_cpy(&old_tag_id, git_reference_oid(ref_tag)); + git_oid_cpy(&old_tag_id, git_reference_target(ref_tag)); git_reference_free(ref_tag); /* create signature */ @@ -122,8 +122,8 @@ void test_object_tag_write__replace(void) git_signature_free(tagger); cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/e90810b")); - cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0); - cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &old_tag_id) != 0); + cl_assert(git_oid_cmp(git_reference_target(ref_tag), &tag_id) == 0); + cl_assert(git_oid_cmp(git_reference_target(ref_tag), &old_tag_id) != 0); git_reference_free(ref_tag); } @@ -150,7 +150,7 @@ void test_object_tag_write__lightweight(void) cl_assert(git_oid_cmp(&object_id, &target_id) == 0); cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/light-tag")); - cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &target_id) == 0); + cl_assert(git_oid_cmp(git_reference_target(ref_tag), &target_id) == 0); cl_git_pass(git_tag_delete(g_repo, "light-tag")); diff --git a/tests-clar/refs/branches/create.c b/tests-clar/refs/branches/create.c index 5ecb42848..51db04b31 100644 --- a/tests-clar/refs/branches/create.c +++ b/tests-clar/refs/branches/create.c @@ -47,7 +47,7 @@ void test_refs_branches_create__can_create_a_local_branch(void) retrieve_known_commit(&target, repo); cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, 0)); - cl_git_pass(git_oid_cmp(git_reference_oid(branch), git_object_id(target))); + cl_git_pass(git_oid_cmp(git_reference_target(branch), git_object_id(target))); } void test_refs_branches_create__can_not_create_a_branch_if_its_name_collide_with_an_existing_one(void) @@ -62,7 +62,7 @@ void test_refs_branches_create__can_force_create_over_an_existing_branch(void) retrieve_known_commit(&target, repo); cl_git_pass(git_branch_create(&branch, repo, "br2", target, 1)); - cl_git_pass(git_oid_cmp(git_reference_oid(branch), git_object_id(target))); + cl_git_pass(git_oid_cmp(git_reference_target(branch), git_object_id(target))); cl_assert_equal_s("refs/heads/br2", git_reference_name(branch)); } @@ -72,7 +72,7 @@ void test_refs_branches_create__creating_a_branch_targeting_a_tag_dereferences_i retrieve_target_from_oid(&target, repo, "b25fa35b38051e4ae45d4222e795f9df2e43f1d1"); cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, 0)); - cl_git_pass(git_oid_streq(git_reference_oid(branch), "e90810b8df3e80c413d903f631643c716887138d")); + cl_git_pass(git_oid_streq(git_reference_target(branch), "e90810b8df3e80c413d903f631643c716887138d")); } void test_refs_branches_create__can_not_create_a_branch_pointing_to_a_non_commit_object(void) diff --git a/tests-clar/refs/branches/delete.c b/tests-clar/refs/branches/delete.c index 75271a21c..18430367c 100644 --- a/tests-clar/refs/branches/delete.c +++ b/tests-clar/refs/branches/delete.c @@ -14,7 +14,7 @@ void test_refs_branches_delete__initialize(void) cl_git_pass(git_repository_open(&repo, "testrepo.git")); cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); - cl_git_pass(git_reference_create_oid(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0)); + cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0)); } void test_refs_branches_delete__cleanup(void) @@ -35,7 +35,7 @@ void test_refs_branches_delete__can_not_delete_a_branch_pointed_at_by_HEAD(void) /* Ensure HEAD targets the local master branch */ cl_git_pass(git_reference_lookup(&head, repo, GIT_HEAD_FILE)); - cl_assert(strcmp("refs/heads/master", git_reference_target(head)) == 0); + cl_assert(strcmp("refs/heads/master", git_reference_symbolic_target(head)) == 0); git_reference_free(head); cl_git_pass(git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL)); @@ -71,7 +71,7 @@ void test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD( 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_s("refs/heads/master", git_reference_target(head)); + cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head)); git_reference_free(head); /* Detach HEAD and make it target the commit that "master" points to */ @@ -107,4 +107,4 @@ void test_refs_branches_delete__deleting_a_branch_removes_related_configuration_ assert_config_entry_existence(repo, "branch.track-local.remote", false); assert_config_entry_existence(repo, "branch.track-local.merge", false); -}
\ No newline at end of file +} diff --git a/tests-clar/refs/branches/foreach.c b/tests-clar/refs/branches/foreach.c index dfa04395b..96a5bc2b9 100644 --- a/tests-clar/refs/branches/foreach.c +++ b/tests-clar/refs/branches/foreach.c @@ -12,7 +12,7 @@ void test_refs_branches_foreach__initialize(void) cl_git_pass(git_repository_open(&repo, "testrepo.git")); cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); - cl_git_pass(git_reference_create_oid(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0)); + cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0)); } void test_refs_branches_foreach__cleanup(void) @@ -119,7 +119,7 @@ void test_refs_branches_foreach__retrieve_remote_symbolic_HEAD_when_present(void }; git_reference_free(fake_remote); - cl_git_pass(git_reference_create_symbolic(&fake_remote, repo, "refs/remotes/nulltoken/HEAD", "refs/remotes/nulltoken/master", 0)); + cl_git_pass(git_reference_symbolic_create(&fake_remote, repo, "refs/remotes/nulltoken/HEAD", "refs/remotes/nulltoken/master", 0)); assert_retrieval(GIT_BRANCH_REMOTE, 3); diff --git a/tests-clar/refs/branches/ishead.c b/tests-clar/refs/branches/ishead.c index 2ab488f22..dfcf1b5f1 100644 --- a/tests-clar/refs/branches/ishead.c +++ b/tests-clar/refs/branches/ishead.c @@ -98,9 +98,9 @@ void test_refs_branches_ishead__only_direct_references_are_considered(void) git_repository_free(repo); repo = cl_git_sandbox_init("testrepo.git"); - cl_git_pass(git_reference_create_symbolic(&linked, repo, "refs/heads/linked", "refs/heads/master", 0)); - cl_git_pass(git_reference_create_symbolic(&super, repo, "refs/heads/super", "refs/heads/linked", 0)); - cl_git_pass(git_reference_create_symbolic(&head, repo, GIT_HEAD_FILE, "refs/heads/super", 1)); + cl_git_pass(git_reference_symbolic_create(&linked, repo, "refs/heads/linked", "refs/heads/master", 0)); + cl_git_pass(git_reference_symbolic_create(&super, repo, "refs/heads/super", "refs/heads/linked", 0)); + cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, "refs/heads/super", 1)); cl_assert_equal_i(false, git_branch_is_head(linked)); cl_assert_equal_i(false, git_branch_is_head(super)); diff --git a/tests-clar/refs/crashes.c b/tests-clar/refs/crashes.c index e1b289ace..9fb5ff627 100644 --- a/tests-clar/refs/crashes.c +++ b/tests-clar/refs/crashes.c @@ -7,7 +7,7 @@ void test_refs_crashes__double_free(void) const char *REFNAME = "refs/heads/xxx"; cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git"))); - cl_git_pass(git_reference_create_symbolic(&ref, repo, REFNAME, "refs/heads/master", 0)); + cl_git_pass(git_reference_symbolic_create(&ref, repo, REFNAME, "refs/heads/master", 0)); cl_git_pass(git_reference_lookup(&ref2, repo, REFNAME)); cl_git_pass(git_reference_delete(ref)); /* reference is gone from disk, so reloading it will fail */ diff --git a/tests-clar/refs/create.c b/tests-clar/refs/create.c index bf234bc60..bef9bfd24 100644 --- a/tests-clar/refs/create.c +++ b/tests-clar/refs/create.c @@ -36,7 +36,7 @@ void test_refs_create__symbolic(void) git_buf_free(&ref_path); /* Create and write the new symbolic reference */ - cl_git_pass(git_reference_create_symbolic(&new_reference, g_repo, new_head_tracker, current_head_target, 0)); + cl_git_pass(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, current_head_target, 0)); /* Ensure the reference can be looked-up... */ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker)); @@ -49,7 +49,7 @@ void test_refs_create__symbolic(void) cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID); /* ...and that it points to the current master tip */ - cl_assert(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0); + cl_assert(git_oid_cmp(&id, git_reference_target(resolved_ref)) == 0); git_reference_free(looked_up_ref); git_reference_free(resolved_ref); @@ -58,7 +58,7 @@ void test_refs_create__symbolic(void) cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head_tracker)); cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref)); - cl_assert(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0); + cl_assert(git_oid_cmp(&id, git_reference_target(resolved_ref)) == 0); git_repository_free(repo2); @@ -79,10 +79,10 @@ void test_refs_create__deep_symbolic(void) git_oid_fromstr(&id, current_master_tip); cl_git_pass(git_buf_joinpath(&ref_path, g_repo->path_repository, new_head_tracker)); - cl_git_pass(git_reference_create_symbolic(&new_reference, g_repo, new_head_tracker, current_head_target, 0)); + cl_git_pass(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, current_head_target, 0)); cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker)); cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref)); - cl_assert(git_oid_cmp(&id, git_reference_oid(resolved_ref)) == 0); + cl_assert(git_oid_cmp(&id, git_reference_target(resolved_ref)) == 0); git_reference_free(new_reference); git_reference_free(looked_up_ref); @@ -106,7 +106,7 @@ void test_refs_create__oid(void) cl_git_pass(git_buf_joinpath(&ref_path, g_repo->path_repository, new_head)); /* Create and write the new object id reference */ - cl_git_pass(git_reference_create_oid(&new_reference, g_repo, new_head, &id, 0)); + cl_git_pass(git_reference_create(&new_reference, g_repo, new_head, &id, 0)); /* Ensure the reference can be looked-up... */ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head)); @@ -115,14 +115,14 @@ void test_refs_create__oid(void) cl_assert_equal_s(looked_up_ref->name, new_head); /* ...and that it points to the current master tip */ - cl_assert(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0); + cl_assert(git_oid_cmp(&id, git_reference_target(looked_up_ref)) == 0); git_reference_free(looked_up_ref); /* Similar test with a fresh new repository */ cl_git_pass(git_repository_open(&repo2, "testrepo")); cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head)); - cl_assert(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0); + cl_assert(git_oid_cmp(&id, git_reference_target(looked_up_ref)) == 0); git_repository_free(repo2); @@ -142,7 +142,7 @@ void test_refs_create__oid_unknown(void) git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644"); /* Create and write the new object id reference */ - cl_git_fail(git_reference_create_oid(&new_reference, g_repo, new_head, &id, 0)); + cl_git_fail(git_reference_create(&new_reference, g_repo, new_head, &id, 0)); /* Ensure the reference can't be looked-up... */ cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, new_head)); @@ -156,9 +156,9 @@ void test_refs_create__propagate_eexists(void) /* Make sure it works for oid and for symbolic both */ git_oid_fromstr(&oid, current_master_tip); - error = git_reference_create_oid(&ref, g_repo, current_head_target, &oid, false); + error = git_reference_create(&ref, g_repo, current_head_target, &oid, false); cl_assert(error == GIT_EEXISTS); - error = git_reference_create_symbolic(&ref, g_repo, "HEAD", current_head_target, false); + error = git_reference_symbolic_create(&ref, g_repo, "HEAD", current_head_target, false); cl_assert(error == GIT_EEXISTS); } diff --git a/tests-clar/refs/delete.c b/tests-clar/refs/delete.c index 912f41456..cc5ab3940 100644 --- a/tests-clar/refs/delete.c +++ b/tests-clar/refs/delete.c @@ -62,7 +62,7 @@ void test_refs_delete__packed_only(void) git_oid_fromstr(&id, current_master_tip); /* Create and write the new object id reference */ - cl_git_pass(git_reference_create_oid(&ref, g_repo, new_ref, &id, 0)); + cl_git_pass(git_reference_create(&ref, g_repo, new_ref, &id, 0)); git_reference_free(ref); /* Lookup the reference */ diff --git a/tests-clar/refs/foreachglob.c b/tests-clar/refs/foreachglob.c index 8ecce9cfe..88516ddce 100644 --- a/tests-clar/refs/foreachglob.c +++ b/tests-clar/refs/foreachglob.c @@ -12,7 +12,7 @@ void test_refs_foreachglob__initialize(void) cl_git_pass(git_repository_open(&repo, "testrepo.git")); cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); - cl_git_pass(git_reference_create_oid(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0)); + cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0)); } void test_refs_foreachglob__cleanup(void) diff --git a/tests-clar/refs/lookup.c b/tests-clar/refs/lookup.c index 71ab1b7b8..11fd68f90 100644 --- a/tests-clar/refs/lookup.c +++ b/tests-clar/refs/lookup.c @@ -36,7 +36,7 @@ void test_refs_lookup__oid(void) { git_oid tag, expected; - cl_git_pass(git_reference_name_to_oid(&tag, g_repo, "refs/tags/point_to_blob")); + cl_git_pass(git_reference_name_to_id(&tag, g_repo, "refs/tags/point_to_blob")); cl_git_pass(git_oid_fromstr(&expected, "1385f264afb75a56a5bec74243be9b367ba4ca08")); cl_assert(git_oid_cmp(&tag, &expected) == 0); } diff --git a/tests-clar/refs/overwrite.c b/tests-clar/refs/overwrite.c index 410e39a84..ebe72069c 100644 --- a/tests-clar/refs/overwrite.c +++ b/tests-clar/refs/overwrite.c @@ -27,25 +27,25 @@ void test_refs_overwrite__symbolic(void) git_reference *ref, *branch_ref; /* The target needds to exist and we need to check the name has changed */ - cl_git_pass(git_reference_create_symbolic(&branch_ref, g_repo, ref_branch_name, ref_master_name, 0)); - cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_branch_name, 0)); + cl_git_pass(git_reference_symbolic_create(&branch_ref, g_repo, ref_branch_name, ref_master_name, 0)); + cl_git_pass(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_branch_name, 0)); git_reference_free(ref); /* 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_equal_s(git_reference_target(ref), ref_branch_name); + cl_assert_equal_s(git_reference_symbolic_target(ref), ref_branch_name); git_reference_free(ref); /* Ensure we can't create it unless we force it to */ - cl_git_fail(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 0)); - cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 1)); + cl_git_fail(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_master_name, 0)); + cl_git_pass(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_master_name, 1)); git_reference_free(ref); /* 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_equal_s(git_reference_target(ref), ref_master_name); + cl_assert_equal_s(git_reference_symbolic_target(ref), ref_master_name); git_reference_free(ref); git_reference_free(branch_ref); @@ -59,26 +59,26 @@ void test_refs_overwrite__object_id(void) cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name)); cl_assert(git_reference_type(ref) & GIT_REF_OID); - git_oid_cpy(&id, git_reference_oid(ref)); + git_oid_cpy(&id, git_reference_target(ref)); git_reference_free(ref); /* Create it */ - cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0)); + cl_git_pass(git_reference_create(&ref, g_repo, ref_name, &id, 0)); 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); - git_oid_cpy(&id, git_reference_oid(ref)); + git_oid_cpy(&id, git_reference_target(ref)); git_reference_free(ref); /* Ensure we can't overwrite unless we force it */ - cl_git_fail(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0)); - cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 1)); + cl_git_fail(git_reference_create(&ref, g_repo, ref_name, &id, 0)); + cl_git_pass(git_reference_create(&ref, g_repo, ref_name, &id, 1)); git_reference_free(ref); /* Ensure it has been overwritten */ cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name)); - cl_assert(!git_oid_cmp(&id, git_reference_oid(ref))); + cl_assert(!git_oid_cmp(&id, git_reference_target(ref))); git_reference_free(ref); } @@ -91,19 +91,19 @@ void test_refs_overwrite__object_id_with_symbolic(void) cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name)); cl_assert(git_reference_type(ref) & GIT_REF_OID); - git_oid_cpy(&id, git_reference_oid(ref)); + git_oid_cpy(&id, git_reference_target(ref)); git_reference_free(ref); - cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0)); + cl_git_pass(git_reference_create(&ref, g_repo, ref_name, &id, 0)); git_reference_free(ref); - cl_git_fail(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 0)); - cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 1)); + cl_git_fail(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_master_name, 0)); + cl_git_pass(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_master_name, 1)); git_reference_free(ref); /* 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_equal_s(git_reference_target(ref), ref_master_name); + cl_assert_equal_s(git_reference_symbolic_target(ref), ref_master_name); git_reference_free(ref); } @@ -116,21 +116,21 @@ void test_refs_overwrite__symbolic_with_object_id(void) cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name)); cl_assert(git_reference_type(ref) & GIT_REF_OID); - git_oid_cpy(&id, git_reference_oid(ref)); + git_oid_cpy(&id, git_reference_target(ref)); git_reference_free(ref); /* Create the symbolic ref */ - cl_git_pass(git_reference_create_symbolic(&ref, g_repo, ref_name, ref_master_name, 0)); + cl_git_pass(git_reference_symbolic_create(&ref, g_repo, ref_name, ref_master_name, 0)); git_reference_free(ref); /* It shouldn't overwrite unless we tell it to */ - cl_git_fail(git_reference_create_oid(&ref, g_repo, ref_name, &id, 0)); - cl_git_pass(git_reference_create_oid(&ref, g_repo, ref_name, &id, 1)); + cl_git_fail(git_reference_create(&ref, g_repo, ref_name, &id, 0)); + cl_git_pass(git_reference_create(&ref, g_repo, ref_name, &id, 1)); git_reference_free(ref); /* 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_oid_cmp(git_reference_oid(ref), &id)); + cl_assert(!git_oid_cmp(git_reference_target(ref), &id)); git_reference_free(ref); } diff --git a/tests-clar/refs/read.c b/tests-clar/refs/read.c index b867c9722..c10a540c0 100644 --- a/tests-clar/refs/read.c +++ b/tests-clar/refs/read.c @@ -37,7 +37,7 @@ void test_refs_read__loose_tag(void) cl_assert(git_reference_is_packed(reference) == 0); cl_assert_equal_s(reference->name, loose_tag_ref_name); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJ_ANY)); cl_assert(object != NULL); cl_assert(git_object_type(object) == GIT_OBJ_TAG); @@ -77,7 +77,7 @@ void test_refs_read__symbolic(void) cl_git_pass(git_reference_resolve(&resolved_ref, reference)); cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJ_ANY)); cl_assert(object != NULL); cl_assert(git_object_type(object) == GIT_OBJ_COMMIT); @@ -105,7 +105,7 @@ void test_refs_read__nested_symbolic(void) cl_git_pass(git_reference_resolve(&resolved_ref, reference)); cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJ_ANY)); cl_assert(object != NULL); cl_assert(git_object_type(object) == GIT_OBJ_COMMIT); @@ -129,13 +129,13 @@ void test_refs_read__head_then_master(void) cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE)); cl_git_pass(git_reference_resolve(&resolved_ref, reference)); - cl_git_pass(git_oid_cmp(git_reference_oid(comp_base_ref), git_reference_oid(resolved_ref))); + cl_git_pass(git_oid_cmp(git_reference_target(comp_base_ref), git_reference_target(resolved_ref))); git_reference_free(reference); git_reference_free(resolved_ref); cl_git_pass(git_reference_lookup(&reference, g_repo, current_head_target)); cl_git_pass(git_reference_resolve(&resolved_ref, reference)); - cl_git_pass(git_oid_cmp(git_reference_oid(comp_base_ref), git_reference_oid(resolved_ref))); + cl_git_pass(git_oid_cmp(git_reference_target(comp_base_ref), git_reference_target(resolved_ref))); git_reference_free(reference); git_reference_free(resolved_ref); @@ -151,7 +151,7 @@ void test_refs_read__master_then_head(void) cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE)); cl_git_pass(git_reference_resolve(&resolved_ref, reference)); - cl_git_pass(git_oid_cmp(git_reference_oid(master_ref), git_reference_oid(resolved_ref))); + cl_git_pass(git_oid_cmp(git_reference_target(master_ref), git_reference_target(resolved_ref))); git_reference_free(reference); git_reference_free(resolved_ref); @@ -170,7 +170,7 @@ void test_refs_read__packed(void) cl_assert(git_reference_is_packed(reference)); cl_assert_equal_s(reference->name, packed_head_name); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJ_ANY)); cl_assert(object != NULL); cl_assert(git_object_type(object) == GIT_OBJ_COMMIT); @@ -200,7 +200,7 @@ void test_refs_read__chomped(void) cl_git_pass(git_reference_lookup(&test, g_repo, "refs/heads/test")); cl_git_pass(git_reference_lookup(&chomped, g_repo, "refs/heads/chomped")); - cl_git_pass(git_oid_cmp(git_reference_oid(test), git_reference_oid(chomped))); + cl_git_pass(git_oid_cmp(git_reference_target(test), git_reference_target(chomped))); git_reference_free(test); git_reference_free(chomped); @@ -212,7 +212,7 @@ void test_refs_read__trailing(void) cl_git_pass(git_reference_lookup(&test, g_repo, "refs/heads/test")); cl_git_pass(git_reference_lookup(&trailing, g_repo, "refs/heads/trailing")); - cl_git_pass(git_oid_cmp(git_reference_oid(test), git_reference_oid(trailing))); + cl_git_pass(git_oid_cmp(git_reference_target(test), git_reference_target(trailing))); git_reference_free(trailing); cl_git_pass(git_reference_lookup(&trailing, g_repo, "FETCH_HEAD")); diff --git a/tests-clar/refs/reflog/reflog.c b/tests-clar/refs/reflog/reflog.c index 09b935692..4c3d0dab7 100644 --- a/tests-clar/refs/reflog/reflog.c +++ b/tests-clar/refs/reflog/reflog.c @@ -46,7 +46,7 @@ void test_refs_reflog_reflog__append_then_read(void) /* Create a new branch pointing at the HEAD */ git_oid_fromstr(&oid, current_master_tip); - cl_git_pass(git_reference_create_oid(&ref, g_repo, new_ref, &oid, 0)); + cl_git_pass(git_reference_create(&ref, g_repo, new_ref, &oid, 0)); cl_git_pass(git_signature_now(&committer, "foo", "foo@bar")); diff --git a/tests-clar/refs/rename.c b/tests-clar/refs/rename.c index 19bf875cd..ec5c12507 100644 --- a/tests-clar/refs/rename.c +++ b/tests-clar/refs/rename.c @@ -201,7 +201,7 @@ void test_refs_rename__force_loose_packed(void) /* An existing reference... */ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name)); - git_oid_cpy(&oid, git_reference_oid(looked_up_ref)); + git_oid_cpy(&oid, git_reference_target(looked_up_ref)); /* Can be force-renamed to the name of another existing reference. */ cl_git_pass(git_reference_rename(looked_up_ref, packed_test_head_name, 1)); @@ -210,7 +210,7 @@ void test_refs_rename__force_loose_packed(void) /* Check we actually renamed it */ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name)); cl_assert_equal_s(looked_up_ref->name, packed_test_head_name); - cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref))); + cl_assert(!git_oid_cmp(&oid, git_reference_target(looked_up_ref))); git_reference_free(looked_up_ref); /* And that the previous one doesn't exist any longer */ @@ -225,7 +225,7 @@ void test_refs_rename__force_loose(void) /* An existing reference... */ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/br2")); - git_oid_cpy(&oid, git_reference_oid(looked_up_ref)); + git_oid_cpy(&oid, git_reference_target(looked_up_ref)); /* Can be force-renamed to the name of another existing reference. */ cl_git_pass(git_reference_rename(looked_up_ref, "refs/heads/test", 1)); @@ -234,7 +234,7 @@ void test_refs_rename__force_loose(void) /* Check we actually renamed it */ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/test")); cl_assert_equal_s(looked_up_ref->name, "refs/heads/test"); - cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref))); + cl_assert(!git_oid_cmp(&oid, git_reference_target(looked_up_ref))); git_reference_free(looked_up_ref); /* And that the previous one doesn't exist any longer */ @@ -253,17 +253,17 @@ void test_refs_rename__overwrite(void) cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name)); cl_assert(git_reference_type(ref) & GIT_REF_OID); - git_oid_cpy(&id, git_reference_oid(ref)); + git_oid_cpy(&id, git_reference_target(ref)); /* Create loose references */ - cl_git_pass(git_reference_create_oid(&ref_one, g_repo, ref_one_name, &id, 0)); - cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name, &id, 0)); + cl_git_pass(git_reference_create(&ref_one, g_repo, ref_one_name, &id, 0)); + cl_git_pass(git_reference_create(&ref_two, g_repo, ref_two_name, &id, 0)); /* Pack everything */ cl_git_pass(git_reference_packall(g_repo)); /* Attempt to create illegal reference */ - cl_git_fail(git_reference_create_oid(&ref_one_new, g_repo, ref_one_name_new, &id, 0)); + cl_git_fail(git_reference_create(&ref_one_new, g_repo, ref_one_name_new, &id, 0)); /* Illegal reference couldn't be created so this is supposed to fail */ cl_git_fail(git_reference_lookup(&ref_one_new, g_repo, ref_one_name_new)); @@ -284,10 +284,10 @@ void test_refs_rename__prefix(void) cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name)); cl_assert(git_reference_type(ref) & GIT_REF_OID); - git_oid_cpy(&id, git_reference_oid(ref)); + git_oid_cpy(&id, git_reference_target(ref)); /* Create loose references */ - cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name, &id, 0)); + cl_git_pass(git_reference_create(&ref_two, g_repo, ref_two_name, &id, 0)); /* An existing reference... */ cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name)); @@ -316,10 +316,10 @@ void test_refs_rename__move_up(void) cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name)); cl_assert(git_reference_type(ref) & GIT_REF_OID); - git_oid_cpy(&id, git_reference_oid(ref)); + git_oid_cpy(&id, git_reference_target(ref)); /* Create loose references */ - cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name_new, &id, 0)); + cl_git_pass(git_reference_create(&ref_two, g_repo, ref_two_name_new, &id, 0)); git_reference_free(ref_two); /* An existing reference... */ diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c index a1f0dbf2b..3698b5197 100644 --- a/tests-clar/refs/revparse.c +++ b/tests-clar/refs/revparse.c @@ -468,11 +468,11 @@ void test_refs_revparse__issue_994(void) cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_create_oid( + cl_git_pass(git_reference_create( &with_at, repo, "refs/remotes/origin/bim_with_3d@11296", - git_reference_oid(head), + git_reference_target(head), 0)); cl_git_pass(git_revparse_single(&target, repo, "origin/bim_with_3d@11296")); diff --git a/tests-clar/refs/unicode.c b/tests-clar/refs/unicode.c index fbe95b19f..424ee6405 100644 --- a/tests-clar/refs/unicode.c +++ b/tests-clar/refs/unicode.c @@ -27,14 +27,14 @@ void test_refs_unicode__create_and_lookup(void) /* Create the reference */ cl_git_pass(git_reference_lookup(&ref0, repo, master)); - cl_git_pass(git_reference_create_oid(&ref1, repo, REFNAME, git_reference_oid(ref0), 0)); + cl_git_pass(git_reference_create(&ref1, repo, REFNAME, git_reference_target(ref0), 0)); cl_assert(strcmp(REFNAME, git_reference_name(ref1)) == 0); /* Lookup the reference in a different instance of the repository */ cl_git_pass(git_repository_open(&repo2, "testrepo.git")); cl_git_pass(git_reference_lookup(&ref2, repo2, REFNAME)); - cl_assert(git_oid_cmp(git_reference_oid(ref1), git_reference_oid(ref2)) == 0); + cl_assert(git_oid_cmp(git_reference_target(ref1), git_reference_target(ref2)) == 0); cl_assert(strcmp(REFNAME, git_reference_name(ref2)) == 0); git_reference_free(ref0); diff --git a/tests-clar/repo/head.c b/tests-clar/repo/head.c index 1c1e905c4..a9f5cfc58 100644 --- a/tests-clar/repo/head.c +++ b/tests-clar/repo/head.c @@ -26,7 +26,7 @@ void test_repo_head__head_detached(void) cl_assert_equal_i(true, git_repository_head_detached(repo)); /* take the reop back to it's original state */ - cl_git_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1)); + cl_git_pass(git_reference_symbolic_create(&ref, repo, "HEAD", "refs/heads/master", 1)); git_reference_free(ref); cl_assert_equal_i(false, git_repository_head_detached(repo)); @@ -44,7 +44,7 @@ void test_repo_head__head_orphan(void) /* take the repo back to it's original state */ - cl_git_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1)); + cl_git_pass(git_reference_symbolic_create(&ref, repo, "HEAD", "refs/heads/master", 1)); cl_assert(git_repository_head_orphan(repo) == 0); git_reference_free(ref); @@ -94,7 +94,7 @@ static void assert_head_is_correctly_detached(void) cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_object_lookup(&commit, repo, git_reference_oid(head), GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&commit, repo, git_reference_target(head), GIT_OBJ_COMMIT)); git_object_free(commit); git_reference_free(head); @@ -156,7 +156,7 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void { git_reference *head; - cl_git_pass(git_reference_create_symbolic(&head, repo, GIT_HEAD_FILE, "refs/tags/point_to_blob", 1)); + cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, "refs/tags/point_to_blob", 1)); cl_git_fail(git_repository_detach_head(repo)); diff --git a/tests-clar/repo/init.c b/tests-clar/repo/init.c index f29f54091..3b14c97f2 100644 --- a/tests-clar/repo/init.c +++ b/tests-clar/repo/init.c @@ -353,7 +353,7 @@ void test_repo_init__extended_1(void) cl_git_pass(git_reference_lookup(&ref, _repo, "HEAD")); cl_assert(git_reference_type(ref) == GIT_REF_SYMBOLIC); - cl_assert_equal_s("refs/heads/development", git_reference_target(ref)); + cl_assert_equal_s("refs/heads/development", git_reference_symbolic_target(ref)); git_reference_free(ref); cl_git_pass(git_remote_load(&remote, _repo, "origin")); diff --git a/tests-clar/repo/repo_helpers.c b/tests-clar/repo/repo_helpers.c index 19ab38ee3..74902e439 100644 --- a/tests-clar/repo/repo_helpers.c +++ b/tests-clar/repo/repo_helpers.c @@ -7,7 +7,7 @@ void make_head_orphaned(git_repository* repo, const char *target) { git_reference *head; - cl_git_pass(git_reference_create_symbolic(&head, repo, GIT_HEAD_FILE, target, 1)); + cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, target, 1)); git_reference_free(head); } diff --git a/tests-clar/reset/soft.c b/tests-clar/reset/soft.c index 7914d4666..9ebd63763 100644 --- a/tests-clar/reset/soft.c +++ b/tests-clar/reset/soft.c @@ -24,7 +24,7 @@ static void assert_reset_soft(bool should_be_detached) { git_oid oid; - cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD")); + cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD")); cl_git_fail(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO)); retrieve_target_from_oid(&target, repo, KNOWN_COMMIT_IN_BARE_REPO); @@ -35,7 +35,7 @@ static void assert_reset_soft(bool should_be_detached) cl_assert(git_repository_head_detached(repo) == should_be_detached); - cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD")); + cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD")); cl_git_pass(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO)); } @@ -56,7 +56,7 @@ void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_ch git_oid oid; char raw_head_oid[GIT_OID_HEXSZ + 1]; - cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD")); + cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD")); git_oid_fmt(raw_head_oid, &oid); raw_head_oid[GIT_OID_HEXSZ] = '\0'; @@ -64,7 +64,7 @@ void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_ch cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT)); - cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD")); + cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD")); cl_git_pass(git_oid_streq(&oid, raw_head_oid)); } @@ -78,7 +78,7 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT)); cl_assert(git_repository_head_detached(repo) == false); - cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD")); + cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD")); cl_git_pass(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO)); } @@ -110,7 +110,7 @@ void test_reset_soft__resetting_against_an_orphaned_head_repo_makes_the_head_no_ cl_assert_equal_i(false, git_repository_head_orphan(repo)); cl_git_pass(git_reference_lookup(&head, repo, NON_EXISTING_HEAD)); - cl_assert_equal_i(0, git_oid_streq(git_reference_oid(head), KNOWN_COMMIT_IN_BARE_REPO)); + cl_assert_equal_i(0, git_oid_streq(git_reference_target(head), KNOWN_COMMIT_IN_BARE_REPO)); git_reference_free(head); } diff --git a/tests-clar/revwalk/signatureparsing.c b/tests-clar/revwalk/signatureparsing.c index cf1d31e43..4f29dd14d 100644 --- a/tests-clar/revwalk/signatureparsing.c +++ b/tests-clar/revwalk/signatureparsing.c @@ -31,10 +31,10 @@ void test_revwalk_signatureparsing__do_not_choke_when_name_contains_angle_bracke */ cl_git_pass(git_reference_lookup(&ref, _repo, "refs/heads/haacked")); - git_revwalk_push(_walk, git_reference_oid(ref)); + git_revwalk_push(_walk, git_reference_target(ref)); cl_git_pass(git_revwalk_next(&commit_oid, _walk)); - cl_git_pass(git_commit_lookup(&commit, _repo, git_reference_oid(ref))); + cl_git_pass(git_commit_lookup(&commit, _repo, git_reference_target(ref))); signature = git_commit_committer(commit); cl_assert_equal_s("Yu V. Bin Haacked", signature->email); diff --git a/tests-clar/stash/drop.c b/tests-clar/stash/drop.c index 9d1aeda70..26b571736 100644 --- a/tests-clar/stash/drop.c +++ b/tests-clar/stash/drop.c @@ -95,7 +95,7 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void) cl_git_pass(git_reflog_read(&reflog, stash)); entry = git_reflog_entry_byindex(reflog, 1); - git_oid_cpy(&oid, git_reflog_entry_oidold(entry)); + git_oid_cpy(&oid, git_reflog_entry_id_old(entry)); count = git_reflog_entrycount(reflog); git_reflog_free(reflog); @@ -105,7 +105,7 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void) cl_git_pass(git_reflog_read(&reflog, stash)); entry = git_reflog_entry_byindex(reflog, 0); - cl_assert_equal_i(0, git_oid_cmp(&oid, git_reflog_entry_oidold(entry))); + cl_assert_equal_i(0, git_oid_cmp(&oid, git_reflog_entry_id_old(entry))); cl_assert_equal_i(count - 1, git_reflog_entrycount(reflog)); git_reflog_free(reflog); diff --git a/tests-clar/stash/save.c b/tests-clar/stash/save.c index 4eaf2a3c1..f8b427814 100644 --- a/tests-clar/stash/save.c +++ b/tests-clar/stash/save.c @@ -193,7 +193,7 @@ void test_stash_save__cannot_stash_against_an_unborn_branch(void) git_reference *head; cl_git_pass(git_reference_lookup(&head, repo, "HEAD")); - cl_git_pass(git_reference_set_target(head, "refs/heads/unborn")); + cl_git_pass(git_reference_symbolic_set_target(head, "refs/heads/unborn")); cl_assert_equal_i(GIT_EORPHANEDHEAD, git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT)); diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c index c154179b0..04e3ef112 100644 --- a/tests-clar/status/worktree.c +++ b/tests-clar/status/worktree.c @@ -482,7 +482,7 @@ static void fill_index_wth_head_entries(git_repository *repo, git_index *index) git_commit *commit; git_tree *tree; - cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD")); + cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD")); cl_git_pass(git_commit_lookup(&commit, repo, &oid)); cl_git_pass(git_commit_tree(&tree, commit)); |