summaryrefslogtreecommitdiff
path: root/src/refs.c
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2014-01-28 11:30:36 -0800
committerBen Straub <bs@github.com>2014-01-30 15:52:13 -0800
commitccf6ce5c895c5d2261538150e945c93799de0999 (patch)
tree54177c5c6cb78fce834ecefd2592b770987fe29f /src/refs.c
parent540c1809f40c1bb3cf08627a85921309852fa963 (diff)
downloadlibgit2-ccf6ce5c895c5d2261538150e945c93799de0999.tar.gz
Ensure renaming a reference updates the reflog
Diffstat (limited to 'src/refs.c')
-rw-r--r--src/refs.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/refs.c b/src/refs.c
index 65e7e6439..adbc1666a 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -558,35 +558,27 @@ int git_reference_rename(
git_reference **out,
git_reference *ref,
const char *new_name,
- int force)
+ int force,
+ const git_signature *signature,
+ const char *log_message)
{
- git_signature *who;
+ git_signature *who = (git_signature*)signature;
int error;
/* Should we return an error if there is no default? */
- if (((error = git_signature_default(&who, ref->db->repo)) < 0) &&
+ if (!who &&
+ ((error = git_signature_default(&who, ref->db->repo)) < 0) &&
((error = git_signature_now(&who, "unknown", "unknown")) < 0)) {
return error;
}
- error = reference__rename(out, ref, new_name, force, who, NULL);
+ error = reference__rename(out, ref, new_name, force, who, log_message);
git_signature_free(who);
return error;
}
-int git_reference_rename_with_log(
- git_reference **out,
- git_reference *ref,
- const char *new_name,
- int force,
- const git_signature *who,
- const char * message)
-{
- return reference__rename(out, ref, new_name, force, who, message);
-}
-
int git_reference_resolve(git_reference **ref_out, const git_reference *ref)
{
switch (git_reference_type(ref)) {