Merge branch 'wk/submodule-on-branch'
[gitweb.git] / builtin / receive-pack.c
index 5c85bb4b498f23209ef51cd5a0ed998bb92342a0..85bba356fab7743506f00bb0c5ca955eb9112bd5 100644 (file)
@@ -478,7 +478,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
        struct ref_lock *lock;
 
        /* only refs/... are allowed */
-       if (prefixcmp(name, "refs/") || check_refname_format(name + 5, 0)) {
+       if (!starts_with(name, "refs/") || check_refname_format(name + 5, 0)) {
                rp_error("refusing to create funny ref '%s' remotely", name);
                return "funny refname";
        }
@@ -509,7 +509,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
        }
 
        if (!is_null_sha1(old_sha1) && is_null_sha1(new_sha1)) {
-               if (deny_deletes && !prefixcmp(name, "refs/heads/")) {
+               if (deny_deletes && starts_with(name, "refs/heads/")) {
                        rp_error("denying ref deletion for %s", name);
                        return "deletion prohibited";
                }
@@ -533,7 +533,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
 
        if (deny_non_fast_forwards && !is_null_sha1(new_sha1) &&
            !is_null_sha1(old_sha1) &&
-           !prefixcmp(name, "refs/heads/")) {
+           starts_with(name, "refs/heads/")) {
                struct object *old_object, *new_object;
                struct commit *old_commit, *new_commit;
 
@@ -853,7 +853,7 @@ static struct command *read_head_info(struct sha1_array *shallow)
                if (!line)
                        break;
 
-               if (len == 48 && !prefixcmp(line, "shallow ")) {
+               if (len == 48 && starts_with(line, "shallow ")) {
                        if (get_sha1_hex(line + 8, old_sha1))
                                die("protocol error: expected shallow sha, got '%s'", line + 8);
                        sha1_array_append(shallow, old_sha1);
@@ -1059,7 +1059,6 @@ static void update_shallow_info(struct command *commands,
        struct command *cmd;
        int *ref_status;
        remove_nonexistent_theirs_shallow(si);
-       /* XXX remove_nonexistent_ours_in_pack() */
        if (!si->nr_ours && !si->nr_theirs) {
                shallow_update = 0;
                return;
@@ -1179,9 +1178,6 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
        if (!enter_repo(dir, 0))
                die("'%s' does not appear to be a git repository", dir);
 
-       if (is_repository_shallow() && stateless_rpc)
-               die("attempt to push into a shallow repository");
-
        git_config(receive_pack_config, NULL);
 
        if (0 <= transfer_unpack_limit)