builtin/push.c: use OPT_BOOL, not OPT_BOOLEAN

The command line parser of "git push" for "--tags", "--delete", and
"--thin" options still used outdated OPT_BOOLEAN.  Because these
options do not give escalating levels when given multiple times,
they should use OPT_BOOL.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote-http: use argv-array

Instead of using a hand-managed argument array, use argv-array API
to manage dynamically formulated command line.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
push: beginning of compare-and-swap "force/delete safety"

This teaches the deepest part of the callchain for "git push" (and
"git send-pack") to optionally allow "the old value of the ref must
be this, otherwise fail this push" we discussed earlier.

Nobody sets the new "expect_old_sha1" bitfield yet, so this is still
a no-op, though.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c: add command line option parser for --lockref

The intended sematics is:

 * "--lockref" alone, without specifying the details, will protect
   _all_ remote refs that are going to be updated by requiring their
   current value to be the same as the remote-tracking branch we
   have for them, unless otherwise specified;

 * "--lockref=refname", without specifying the expected value, will
   protect that refname, if it is going to be updated, by requiring
   its current value to be the same as the remote-tracking branch we
   have for it;

 * "--lockref=refname:value" will protect that refname, if it is
   going to be updated, by requiring its current value to be the
   same as the specified value (which is allowed to be different
   from the remote-tracking branch we have for the refname, or we do
   not even have to have such a remote-tracking branch when this
   form is used); and

 * "--no-lockref" will cancel all the previous --lockref on the
   command line.

In any of the forms, when we try to use a remote-tracking branch for
the remote ref being updated, it is an error if there is no such
remote-tracking branch on our end.

Because the command line options are parsed _before_ we know which
remote we are pushing to, there needs further processing to the
parsed data after we instantiate the transport object to:

 * expand "refname" given by the user to a full refname to be
   matched with the list of "struct ref" used in match_push_refs()
   and set_ref_status_for_push(); and

 * learning the actual local ref that is the remote-tracking branch
   for the specified remote ref.

Further, some processing need to be deferred until we find the set
of remote refs and match_push_refs() returns, to:

 * find the ones that need to be checked after explicit ones have
   been processed for "--lockref" (no specific details); and

 * find conflicting requests, e.g. "--lockref=master:X" and
   "--lockref=heads/master:Y" given together, needs to wait until we
   can expand "master" and "heads/master" to "refs/heads/master".

These post-processing will be the topic of later patches.

Oh, of course, the option name is still not cast in stone.

Update "git push" and "git send-pack" to parse this commnd line
option.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
WIP: pass cas option down to transport

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jc/push-cas' into pu

* jc/push-cas:
  WIP: pass cas option down to transport
  remote.c: add command line option parser for --lockref
  push: beginning of compare-and-swap "force/delete safety"
  remote-http: use argv-array
  builtin/push.c: use OPT_BOOL, not OPT_BOOLEAN
  cache.h: move remote/connect API out of it