compat/poll: sleep 1 millisecond to avoid busy wait
[gitweb.git] / builtin / receive-pack.c
index 78fe8ee62fdfc45051b4f52dffc37e7fa1eb961d..c3230817db4a7676eb74335b254f30597e66edd9 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;
 
@@ -828,14 +828,10 @@ static void execute_commands(struct command *commands,
                }
        }
 
-       if (shallow_update) {
-               if (!checked_connectivity)
-                       error("BUG: run 'git fsck' for safety.\n"
-                             "If there are errors, try to remove "
-                             "the reported refs above");
-               if (alt_shallow_file && *alt_shallow_file)
-                       unlink(alt_shallow_file);
-       }
+       if (shallow_update && !checked_connectivity)
+               error("BUG: run 'git fsck' for safety.\n"
+                     "If there are errors, try to remove "
+                     "the reported refs above");
 }
 
 static struct command *read_head_info(struct sha1_array *shallow)
@@ -853,7 +849,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 +1055,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;
@@ -1088,10 +1083,6 @@ static void update_shallow_info(struct command *commands,
                        cmd->skip_update = 1;
                }
        }
-       if (alt_shallow_file && *alt_shallow_file) {
-               unlink(alt_shallow_file);
-               alt_shallow_file = NULL;
-       }
        free(ref_status);
 }