Merged pull request #139 from jpfender/merge-head-file. refs: Allow MERGE_HEAD in normalize_name()
diff --git a/src/refs.c b/src/refs.c
index 00b9ff6..17ec291 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1692,8 +1692,9 @@ static int normalize_name(char *buffer_out, const char *name, int is_oid_ref)
}
/* Object id refname have to contain at least one slash, except
- * for HEAD in a detached state */
- if (is_oid_ref && !contains_a_slash && strcmp(name, GIT_HEAD_FILE))
+ * for HEAD in a detached state or MERGE_HEAD if we're in the
+ * middle of a merge */
+ if (is_oid_ref && !contains_a_slash && (strcmp(name, GIT_HEAD_FILE) && strcmp(name, GIT_MERGE_HEAD_FILE)))
return GIT_EINVALIDREFNAME;
/* A refname can not end with ".lock" */
diff --git a/src/refs.h b/src/refs.h
index bebb1b9..b8f3e2f 100644
--- a/src/refs.h
+++ b/src/refs.h
@@ -17,6 +17,7 @@
#define MAX_GITDIR_TREE_STRUCTURE_PATH_LENGTH 100
#define GIT_HEAD_FILE "HEAD"
+#define GIT_MERGE_HEAD_FILE "MERGE_HEAD"
#define GIT_REFS_HEADS_MASTER_FILE GIT_REFS_HEADS_DIR "master"
struct git_reference {