Sync with 'maint'
[gitweb.git] / builtin / receive-pack.c
index e3eb5fc0588a79b2b6c29bccdaf71ba49dc14c1f..67ce1ef105d1494e7905e66750b14676e082e11c 100644 (file)
@@ -8,6 +8,7 @@
 #include "commit.h"
 #include "object.h"
 #include "remote.h"
+#include "connect.h"
 #include "transport.h"
 #include "string-list.h"
 #include "sha1-array.h"
@@ -38,6 +39,7 @@ static int quiet;
 static int prefer_ofs_delta = 1;
 static int auto_update_server_info;
 static int auto_gc = 1;
+static int fix_thin = 1;
 static const char *head_name;
 static void *head_name_to_free;
 static int sent_capabilities;
@@ -524,7 +526,8 @@ static const char *update(struct command *cmd)
                return NULL; /* good */
        }
        else {
-               lock = lock_any_ref_for_update(namespaced_name, old_sha1, 0);
+               lock = lock_any_ref_for_update(namespaced_name, old_sha1,
+                                              0, NULL);
                if (!lock) {
                        rp_error("failed to lock %s", name);
                        return "failed to lock";
@@ -869,7 +872,8 @@ static const char *unpack(int err_fd)
                keeper[i++] = "--stdin";
                if (fsck_objects)
                        keeper[i++] = "--strict";
-               keeper[i++] = "--fix-thin";
+               if (fix_thin)
+                       keeper[i++] = "--fix-thin";
                keeper[i++] = hdr_arg;
                keeper[i++] = keep_arg;
                keeper[i++] = NULL;
@@ -975,6 +979,10 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
                                stateless_rpc = 1;
                                continue;
                        }
+                       if (!strcmp(arg, "--reject-thin-pack-for-testing")) {
+                               fix_thin = 0;
+                               continue;
+                       }
 
                        usage(receive_pack_usage);
                }