Commit df30eac1 by Jakob Pfender

refs: Allow MERGE_HEAD in normalize_name()

Do not return with EINVALIDREFNAME when trying to normalize MERGE_HEAD's
name.
parent fee4c425
...@@ -1692,8 +1692,9 @@ static int normalize_name(char *buffer_out, const char *name, int is_oid_ref) ...@@ -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 /* Object id refname have to contain at least one slash, except
* for HEAD in a detached state */ * for HEAD in a detached state or MERGE_HEAD if we're in the
if (is_oid_ref && !contains_a_slash && strcmp(name, GIT_HEAD_FILE)) * 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; return GIT_EINVALIDREFNAME;
/* A refname can not end with ".lock" */ /* A refname can not end with ".lock" */
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#define MAX_GITDIR_TREE_STRUCTURE_PATH_LENGTH 100 #define MAX_GITDIR_TREE_STRUCTURE_PATH_LENGTH 100
#define GIT_HEAD_FILE "HEAD" #define GIT_HEAD_FILE "HEAD"
#define GIT_MERGE_HEAD_FILE "MERGE_HEAD"
#define GIT_REFS_HEADS_MASTER_FILE GIT_REFS_HEADS_DIR "master" #define GIT_REFS_HEADS_MASTER_FILE GIT_REFS_HEADS_DIR "master"
struct git_reference { struct git_reference {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment