]> git.proxmox.com Git - libgit2.git/commitdiff
Merge branch 'branch-delete-ref' into development
authorVicent Marti <tanoku@gmail.com>
Mon, 27 Aug 2012 21:54:52 +0000 (14:54 -0700)
committerVicent Marti <tanoku@gmail.com>
Mon, 27 Aug 2012 21:54:52 +0000 (14:54 -0700)
Conflicts:
include/git2/refs.h

1  2 
include/git2/branch.h
include/git2/refs.h
src/branch.c
src/refs.c

index 8bf7eb9d4b4b5593c22fcb539d19162504fa5a9c,81105d6e21cdba96957783e83c62d6e1dbfb4b3f..bbbdf1c4a59f9838787290b7e308ae3149ffc476
@@@ -55,21 -55,11 +55,13 @@@ GIT_EXTERN(int) git_branch_create
  /**
   * 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.
index 6a8513b3d7680faf8da74a25c223e02f79dd5cee,975da553d0cc183bbf9f3204611649c7971ffb7e..660b48b5f19a6f9606feba2ab25fe5304e5a31f4
@@@ -376,54 -376,16 +376,64 @@@ GIT_EXTERN(int) git_reference_has_log(g
   */
  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
diff --cc src/branch.c
Simple merge
diff --cc src/refs.c
Simple merge