/**
* Delete an existing branch reference.
*
- * @param repo Repository where lives the branch.
- * @param branch A valid reference representing a branch
++ * If the branch is successfully deleted, the passed reference
++ * object will be freed and invalidated.
*
- * @param branch_name Name of the branch to be deleted;
- * this name is validated for consistency.
- *
- * @param branch_type Type of the considered branch. This should
- * be valued with either GIT_BRANCH_LOCAL or GIT_BRANCH_REMOTE.
- *
- * @return 0 on success, GIT_ENOTFOUND if the branch
- * doesn't exist or an error code.
++ * @param branch A valid reference representing a branch
+ * @return 0 on success, or an error code.
*/
- GIT_EXTERN(int) git_branch_delete(
- git_repository *repo,
- const char *branch_name,
- git_branch_t branch_type);
+ GIT_EXTERN(int) git_branch_delete(git_reference *branch);
/**
* Loop over all the branches and issue a callback for each one.
*/
GIT_EXTERN(int) git_reference_is_branch(git_reference *ref);
+ /**
+ * Check if a reference is a remote tracking branch
+ *
+ * @param ref A git reference
+ *
+ * @return 1 when the reference lives in the refs/remotes
+ * namespace; 0 otherwise.
+ */
+ GIT_EXTERN(int) git_reference_is_remote(git_reference *ref);
+
+enum {
+ GIT_REF_FORMAT_NORMAL = 0,
+
+ /**
+ * Control whether one-level refnames are accepted
+ * (i.e., refnames that do not contain multiple /-separated
+ * components)
+ */
+ GIT_REF_FORMAT_ALLOW_ONELEVEL = (1 << 0),
+
+ /**
+ * Interpret the provided name as a reference pattern for a
+ * refspec (as used with remote repositories). If this option
+ * is enabled, the name is allowed to contain a single * (<star>)
+ * in place of a one full pathname component
+ * (e.g., foo/<star>/bar but not foo/bar<star>).
+ */
+ GIT_REF_FORMAT_REFSPEC_PATTERN = (1 << 1),
+};
+
+/**
+ * Normalize the reference name by removing any leading
+ * slash (/) characters and collapsing runs of adjacent slashes
+ * between name components into a single slash.
+ *
+ * Once normalized, if the reference name is valid, it will be
+ * returned in the user allocated buffer.
+ *
+ * TODO: Implement handling of GIT_REF_FORMAT_REFSPEC_PATTERN
+ *
+ * @param buffer_out The user allocated buffer where the
+ * normalized name will be stored.
+ *
+ * @param buffer_size buffer_out size
+ *
+ * @param name name to be checked.
+ *
+ * @param flags Flags to determine the options to be applied while
+ * checking the validatity of the name.
+ *
+ * @return 0 or an error code.
+ */
+GIT_EXTERN(int) git_reference_normalize_name(
+ char *buffer_out,
+ size_t buffer_size,
+ const char *name,
+ unsigned int flags);
+
/** @} */
GIT_END_DECL
#endif