Merge branch 'mh/avoid-rewriting-packed-refs' into maint
[gitweb.git] / sha1_name.c
index c7c5ab376ccb56b3a4f4533f61293bd543ea8097..603e667faa6b935ed5c44fc7d67188088bdfaa84 100644 (file)
@@ -1331,7 +1331,10 @@ void strbuf_branchname(struct strbuf *sb, const char *name, unsigned allowed)
 
 int strbuf_check_branch_ref(struct strbuf *sb, const char *name)
 {
-       strbuf_branchname(sb, name, INTERPRET_BRANCH_LOCAL);
+       if (startup_info->have_repository)
+               strbuf_branchname(sb, name, INTERPRET_BRANCH_LOCAL);
+       else
+               strbuf_addstr(sb, name);
        if (name[0] == '-')
                return -1;
        strbuf_splice(sb, 0, 0, "refs/heads/", 11);