diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2015-03-17 10:21:28 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-03-17 10:21:28 -0400 |
| commit | 9bbc8f350b80a5a6e94651ec667cf9e5d545b317 (patch) | |
| tree | a472cf837ffc1dbe7ddb81be0a773ca74f27b7f0 /include/git2 | |
| parent | 7800048afbb002d0003b54fcc09c98d0d3249949 (diff) | |
| parent | 8acf058ff708582e9bbfe04e297d3b17a4d5c2e8 (diff) | |
| download | libgit2-9bbc8f350b80a5a6e94651ec667cf9e5d545b317.tar.gz | |
Merge pull request #2962 from libgit2/cmn/reflog-annotated
Add annotated versions of ref-modying functions
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/annotated_commit.h | 17 | ||||
| -rw-r--r-- | include/git2/branch.h | 18 | ||||
| -rw-r--r-- | include/git2/repository.h | 16 | ||||
| -rw-r--r-- | include/git2/reset.h | 18 |
4 files changed, 69 insertions, 0 deletions
diff --git a/include/git2/annotated_commit.h b/include/git2/annotated_commit.h index e842d2032..7fb896a5f 100644 --- a/include/git2/annotated_commit.h +++ b/include/git2/annotated_commit.h @@ -78,6 +78,23 @@ GIT_EXTERN(int) git_annotated_commit_lookup( const git_oid *id); /** + * Creates a `git_annotated_comit` from a revision string. + * + * See `man gitrevisions`, or + * http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for + * information on the syntax accepted. + * + * @param out pointer to store the git_annotated_commit result in + * @param repo repository that contains the given commit + * @param revspec the extended sha syntax string to use to lookup the commit + * @return 0 on success or error code + */ +GIT_EXTERN(int) git_annotated_commit_from_revspec( + git_annotated_commit **out, + git_repository *repo, + const char *revspec); + +/** * Gets the commit ID that the given `git_annotated_commit` refers to. * * @param commit the given annotated commit diff --git a/include/git2/branch.h b/include/git2/branch.h index 06f4d2c68..34354f4e5 100644 --- a/include/git2/branch.h +++ b/include/git2/branch.h @@ -55,6 +55,24 @@ GIT_EXTERN(int) git_branch_create( int force); /** + * Create a new branch pointing at a target commit + * + * This behaves like `git_branch_create()` but takes an annotated + * commit, which lets you specify which extended sha syntax string was + * specified by a user, allowing for more exact reflog messages. + * + * See the documentation for `git_branch_create()`. + * + * @see git_branch_create + */ +GIT_EXTERN(int) git_branch_create_from_annotated( + git_reference **ref_out, + git_repository *repository, + const char *branch_name, + const git_annotated_commit *commit, + int force); + +/** * Delete an existing branch reference. * * If the branch is successfully deleted, the passed reference diff --git a/include/git2/repository.h b/include/git2/repository.h index e3ff3b375..ce56fef0f 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -630,6 +630,22 @@ GIT_EXTERN(int) git_repository_set_head_detached( const git_oid* commitish); /** + * Make the repository HEAD directly point to the Commit. + * + * This behaves like `git_repository_set_head_detached()` but takes an + * annotated commit, which lets you specify which extended sha syntax + * string was specified by a user, allowing for more exact reflog + * messages. + * + * See the documentation for `git_repository_set_head_detached()`. + * + * @see git_repository_set_head_detached + */ +GIT_EXTERN(int) git_repository_set_head_detached_from_annotated( + git_repository *repo, + const git_annotated_commit *commitish); + +/** * Detach the HEAD. * * If the HEAD is already detached and points to a Commit, 0 is returned. diff --git a/include/git2/reset.h b/include/git2/reset.h index 93ac0b29c..c03dbed8c 100644 --- a/include/git2/reset.h +++ b/include/git2/reset.h @@ -65,6 +65,24 @@ GIT_EXTERN(int) git_reset( git_checkout_options *checkout_opts); /** + * Sets the current head to the specified commit oid and optionally + * resets the index and working tree to match. + * + * This behaves like `git_reset()` but takes an annotated commit, + * which lets you specify which extended sha syntax string was + * specified by a user, allowing for more exact reflog messages. + * + * See the documentation for `git_reset()`. + * + * @see git_reset + */ +GIT_EXTERN(int) git_reset_from_annotated( + git_repository *repo, + git_annotated_commit *commit, + git_reset_t reset_type, + git_checkout_options *checkout_opts); + +/** * Updates some entries in the index from the target commit tree. * * The scope of the updated entries is determined by the paths |
