summaryrefslogtreecommitdiff
path: root/include/git2/refs.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-06-28 19:15:48 +0200
committerVicent Marti <tanoku@gmail.com>2011-06-28 19:36:27 +0200
commitd5afc0390c3ef919fcde23300d7aefdaeafa5daa (patch)
tree0b661ef8536266c5bf5de645025c8072bc35dc85 /include/git2/refs.h
parent0b10c9ea6ef5d85d862edd044d96561c4fd16e9b (diff)
downloadlibgit2-d5afc0390c3ef919fcde23300d7aefdaeafa5daa.tar.gz
Remove redundant methods from the API
A bunch of redundant methods have been removed from the external API. - All the reference/tag creation methods with `_f` are gone. The force flag is now passed as an argument to the normal create methods. - All the different commit creation methods are gone; commit creation now always requires a `git_commit` pointer for parents and a `git_tree` pointer for tree, to ensure that corrupted commits cannot be generated. - All the different tag creation methods are gone; tag creation now always requires a `git_object` pointer to ensure that tags are not created to inexisting objects.
Diffstat (limited to 'include/git2/refs.h')
-rw-r--r--include/git2/refs.h50
1 files changed, 8 insertions, 42 deletions
diff --git a/include/git2/refs.h b/include/git2/refs.h
index 2c3aac7b0..384e8e2f8 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -60,34 +60,17 @@ GIT_EXTERN(int) git_reference_lookup(git_reference **reference_out, git_reposito
* This reference is owned by the repository and shall not
* be free'd by the user.
*
- * @param ref_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
- * @return 0 on success; error code otherwise
- */
-GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repository *repo, const char *name, const char *target);
-
-/**
- * Create a new symbolic reference, overwriting an existing one with
- * the same name, if it exists.
- *
- * If the new reference isn't a symbolic one, any pointers to the old
- * reference become invalid.
- *
- * The reference will be created in the repository and written
- * to the disk.
- *
- * This reference is owned by the repository and shall not
- * be free'd by the user.
+ * If `force` is true and there already exists a reference
+ * with the same name, it will be overwritten.
*
* @param ref_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 on success; error code otherwise
*/
-GIT_EXTERN(int) git_reference_create_symbolic_f(git_reference **ref_out, git_repository *repo, const char *name, const char *target);
+GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repository *repo, const char *name, const char *target, int force);
/**
* Create a new object id reference.
@@ -98,34 +81,17 @@ GIT_EXTERN(int) git_reference_create_symbolic_f(git_reference **ref_out, git_rep
* This reference is owned by the repository and shall not
* be free'd by the user.
*
- * @param ref_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.
- * @return 0 on success; error code otherwise
- */
-GIT_EXTERN(int) git_reference_create_oid(git_reference **ref_out, git_repository *repo, const char *name, const git_oid *id);
-
-/**
- * Create a new object id reference, overwriting an existing one with
- * the same name, if it exists.
- *
- * If the new reference isn't an object id one, any pointers to the
- * old reference become invalid.
- *
- * The reference will be created in the repository and written
- * to the disk.
- *
- * This reference is owned by the repository and shall not
- * be free'd by the user.
+ * If `force` is true and there already exists a reference
+ * with the same name, it will be overwritten.
*
* @param ref_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 on success; error code otherwise
*/
-GIT_EXTERN(int) git_reference_create_oid_f(git_reference **ref_out, git_repository *repo, const char *name, const git_oid *id);
+GIT_EXTERN(int) git_reference_create_oid(git_reference **ref_out, git_repository *repo, const char *name, const git_oid *id, int force);
/**
* Get the OID pointed to by a reference.