Merge branch 'nd/push-no-thin'
authorJunio C Hamano <gitster@pobox.com>
Wed, 11 Sep 2013 21:56:58 +0000 (14:56 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Sep 2013 21:56:59 +0000 (14:56 -0700)
"git push --no-thin" was a no-op by mistake.

* nd/push-no-thin:
push: respect --no-thin

builtin/push.c
builtin/receive-pack.c
t/t5516-fetch-push.sh
index 50bbfd62b135b6f4454c3cdd4e74cf227c24a1a5..7b1b66c36ac14cb29db9dbbbd5b6f4d27b67d91c 100644 (file)
@@ -15,7 +15,7 @@ static const char * const push_usage[] = {
        NULL,
 };
 
-static int thin;
+static int thin = 1;
 static int deleterefs;
 static const char *receivepack;
 static int verbosity;
@@ -315,8 +315,7 @@ static int push_with_options(struct transport *transport, int flags)
        if (receivepack)
                transport_set_option(transport,
                                     TRANS_OPT_RECEIVEPACK, receivepack);
-       if (thin)
-               transport_set_option(transport, TRANS_OPT_THIN, "yes");
+       transport_set_option(transport, TRANS_OPT_THIN, thin ? "yes" : NULL);
 
        if (!is_empty_cas(&cas)) {
                if (!transport->smart_options)
index 7434d9b4a2d62e619b15fc6aa238e8caa62277cd..b7e71a04f61798ed72282f683a6fcd3c156007ab 100644 (file)
@@ -39,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;
@@ -870,7 +871,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;
@@ -976,6 +978,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);
                }
index 4691d51b8cde48dbb97ac5dfc1e3b75fe90f8da3..99c32d75391bb02fae779ad831879903abca5d25 100755 (executable)
@@ -1172,4 +1172,21 @@ test_expect_success 'push --follow-tag only pushes relevant tags' '
        test_cmp expect actual
 '
 
+test_expect_success 'push --no-thin must produce non-thin pack' '
+       cat >>path1 <<\EOF &&
+keep base version of path1 big enough, compared to the new changes
+later, in order to pass size heuristics in
+builtin/pack-objects.c:try_delta()
+EOF
+       git commit -am initial &&
+       git init no-thin &&
+       git --git-dir=no-thin/.git config receive.unpacklimit 0 &&
+       git push no-thin/.git refs/heads/master:refs/heads/foo &&
+       echo modified >> path1 &&
+       git commit -am modified &&
+       git repack -adf &&
+       rcvpck="git receive-pack --reject-thin-pack-for-testing" &&
+       git push --no-thin --receive-pack="$rcvpck" no-thin/.git refs/heads/master:refs/heads/foo
+'
+
 test_done