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

1  2 
builtin/push.c
builtin/receive-pack.c
diff --combined builtin/push.c
index 50bbfd62b135b6f4454c3cdd4e74cf227c24a1a5,333a1fb05939e9ee6bd313e7a2f77216c098fb0f..7b1b66c36ac14cb29db9dbbbd5b6f4d27b67d91c
@@@ -15,14 -15,12 +15,14 @@@ static const char * const push_usage[] 
        NULL,
  };
  
- static int thin;
+ static int thin = 1;
  static int deleterefs;
  static const char *receivepack;
  static int verbosity;
  static int progress = -1;
  
 +static struct push_cas_option cas;
 +
  static const char **refspec;
  static int refspec_nr;
  static int refspec_alloc;
@@@ -315,16 -313,8 +315,15 @@@ static int push_with_options(struct tra
        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)
 +                      die("underlying transport does not support --%s option",
 +                          CAS_OPT_NAME);
 +              transport->smart_options->cas = &cas;
 +      }
 +
        if (verbosity > 0)
                fprintf(stderr, _("Pushing to %s\n"), transport->url);
        err = transport_push(transport, refspec_nr, refspec, flags,
@@@ -455,19 -445,15 +454,19 @@@ int cmd_push(int argc, const char **arg
                OPT_BIT( 0 , "all", &flags, N_("push all refs"), TRANSPORT_PUSH_ALL),
                OPT_BIT( 0 , "mirror", &flags, N_("mirror all refs"),
                            (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),
 -              OPT_BOOLEAN( 0, "delete", &deleterefs, N_("delete refs")),
 -              OPT_BOOLEAN( 0 , "tags", &tags, N_("push tags (can't be used with --all or --mirror)")),
 +              OPT_BOOL( 0, "delete", &deleterefs, N_("delete refs")),
 +              OPT_BOOL( 0 , "tags", &tags, N_("push tags (can't be used with --all or --mirror)")),
                OPT_BIT('n' , "dry-run", &flags, N_("dry run"), TRANSPORT_PUSH_DRY_RUN),
                OPT_BIT( 0,  "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN),
                OPT_BIT('f', "force", &flags, N_("force updates"), TRANSPORT_PUSH_FORCE),
 +              { OPTION_CALLBACK,
 +                0, CAS_OPT_NAME, &cas, N_("refname>:<expect"),
 +                N_("require old value of ref to be at this value"),
 +                PARSE_OPT_OPTARG, parseopt_push_cas_option },
                { OPTION_CALLBACK, 0, "recurse-submodules", &flags, N_("check"),
                        N_("control recursive pushing of submodules"),
                        PARSE_OPT_OPTARG, option_parse_recurse_submodules },
 -              OPT_BOOLEAN( 0 , "thin", &thin, N_("use thin pack")),
 +              OPT_BOOL( 0 , "thin", &thin, N_("use thin pack")),
                OPT_STRING( 0 , "receive-pack", &receivepack, "receive-pack", N_("receive pack program")),
                OPT_STRING( 0 , "exec", &receivepack, "receive-pack", N_("receive pack program")),
                OPT_BIT('u', "set-upstream", &flags, N_("set upstream for git pull/status"),
diff --combined builtin/receive-pack.c
index 7434d9b4a2d62e619b15fc6aa238e8caa62277cd,fc6d53ab2d1189b817a58e15843999549f1cc530..b7e71a04f61798ed72282f683a6fcd3c156007ab
@@@ -8,7 -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"
@@@ -39,6 -38,7 +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 -870,8 +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 -977,10 +978,10 @@@ int cmd_receive_pack(int argc, const ch
                                stateless_rpc = 1;
                                continue;
                        }
+                       if (!strcmp(arg, "--reject-thin-pack-for-testing")) {
+                               fix_thin = 0;
+                               continue;
+                       }
  
                        usage(receive_pack_usage);
                }