diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-01-07 14:16:50 +0000 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-03-03 14:40:50 +0100 |
| commit | 23a17803b6e3a8bf21f740726ec0a038968da9a1 (patch) | |
| tree | 88d9d1c63005e773a52b3afa5b3eeaea3f0e95a7 /src/reset.c | |
| parent | 659cf2029f322ea876d663d85783b48945227e8f (diff) | |
| download | libgit2-23a17803b6e3a8bf21f740726ec0a038968da9a1.tar.gz | |
reset: remove reflog message override
This function is meant to simulate what git does in the reset command,
so we should include the reflog message in that.
Diffstat (limited to 'src/reset.c')
| -rw-r--r-- | src/reset.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/reset.c b/src/reset.c index bf8bbcccd..f42a0b3ae 100644 --- a/src/reset.c +++ b/src/reset.c @@ -100,15 +100,14 @@ int git_reset( git_repository *repo, git_object *target, git_reset_t reset_type, - git_checkout_options *checkout_opts, - const char *log_message) + git_checkout_options *checkout_opts) { git_object *commit = NULL; git_index *index = NULL; git_tree *tree = NULL; int error = 0; git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - git_buf log_message_buf = GIT_BUF_INIT; + git_buf log_message = GIT_BUF_INIT; assert(repo && target); @@ -140,10 +139,8 @@ int git_reset( goto cleanup; } - if (log_message) - git_buf_sets(&log_message_buf, log_message); - else - git_buf_sets(&log_message_buf, "reset: moving"); + if ((error = git_buf_printf(&log_message, "reset: moving to %s", git_oid_tostr_s(git_object_id(commit)))) < 0) + return error; /* move HEAD to the new target */ if ((error = git_reference__update_terminal(repo, GIT_HEAD_FILE, @@ -175,7 +172,7 @@ cleanup: git_object_free(commit); git_index_free(index); git_tree_free(tree); - git_buf_free(&log_message_buf); + git_buf_free(&log_message); return error; } |
