summaryrefslogtreecommitdiff
path: root/src/refs.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-01-15 16:50:31 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-03 14:40:50 +0100
commit4e498646b6e4f3e6303cd3a27682dcd10d97eaeb (patch)
treecab3a87c8845f549d9355a505df665a57ed4f4b3 /src/refs.c
parent412a3808889de65d8f94f22502aba10b9afbf755 (diff)
downloadlibgit2-4e498646b6e4f3e6303cd3a27682dcd10d97eaeb.tar.gz
repository: remove log message override for switching the active branch
We want to use the "checkout: moving from ..." message in order to let git know when a change of branch has happened. Make the convenience functions for this goal write this message.
Diffstat (limited to 'src/refs.c')
-rw-r--r--src/refs.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/refs.c b/src/refs.c
index 415918600..3f6c33dcd 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -589,7 +589,7 @@ static int reference__rename(git_reference **out, git_reference *ref, const char
/* Update HEAD it was pointing to the reference being renamed */
if (should_head_be_updated &&
- (error = git_repository_set_head(ref->db->repo, normalized, message)) < 0) {
+ (error = git_repository_set_head(ref->db->repo, normalized)) < 0) {
giterr_set(GITERR_REFERENCE, "Failed to update HEAD after renaming reference");
return error;
}
@@ -1284,10 +1284,8 @@ int git_reference_is_valid_name(const char *refname)
return git_reference__is_valid_name(refname, GIT_REF_FORMAT_ALLOW_ONELEVEL);
}
-const char *git_reference_shorthand(const git_reference *ref)
+const char *git_reference__shorthand(const char *name)
{
- const char *name = ref->name;
-
if (!git__prefixcmp(name, GIT_REFS_HEADS_DIR))
return name + strlen(GIT_REFS_HEADS_DIR);
else if (!git__prefixcmp(name, GIT_REFS_TAGS_DIR))
@@ -1300,3 +1298,8 @@ const char *git_reference_shorthand(const git_reference *ref)
/* No shorthands are avaiable, so just return the name */
return name;
}
+
+const char *git_reference_shorthand(const git_reference *ref)
+{
+ return git_reference__shorthand(ref->name);
+}