Merge branch 'maint'
authorJunio C Hamano <junkio@cox.net>
Wed, 7 Mar 2007 22:45:25 +0000 (14:45 -0800)
committerJunio C Hamano <junkio@cox.net>
Wed, 7 Mar 2007 22:45:25 +0000 (14:45 -0800)
* maint:
Catch write_ref_sha1 failure in receive-pack
make t8001 work on Mac OS X again

1  2 
receive-pack.c
diff --combined receive-pack.c
index 7f1dcc045c0818db3d515755e4bf1ae0d82f9647,ea6872e46f8707b2f2fe6d77ed449a3f8471792a..dda98549ca47bd1a253a22ca389eced5d95f11ef
@@@ -109,7 -109,7 +109,7 @@@ static int update(struct command *cmd
        struct ref_lock *lock;
  
        cmd->error_string = NULL;
 -      if (!strncmp(name, "refs/", 5) && check_ref_format(name + 5)) {
 +      if (!prefixcmp(name, "refs/") && check_ref_format(name + 5)) {
                cmd->error_string = "funny refname";
                return error("refusing to create funny ref '%s' locally",
                             name);
        }
        if (deny_non_fast_forwards && !is_null_sha1(new_sha1) &&
            !is_null_sha1(old_sha1) &&
 -          !strncmp(name, "refs/heads/", 11)) {
 +          !prefixcmp(name, "refs/heads/")) {
                struct commit *old_commit, *new_commit;
                struct commit_list *bases, *ent;
  
                        cmd->error_string = "failed to lock";
                        return error("failed to lock %s", name);
                }
-               write_ref_sha1(lock, new_sha1, "push");
+               if (write_ref_sha1(lock, new_sha1, "push")) {
+                       cmd->error_string = "failed to write";
+                       return -1; /* error() already called */
+               }
                fprintf(stderr, "%s: %s -> %s\n", name, old_hex, new_hex);
        }
        return 0;