diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-07-09 22:01:06 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-23 09:18:19 +0400 |
commit | 91048a9537a4716c84934e4f8ed114a20606d3ff (patch) | |
tree | 7421ff6ea3478b843f112a4abf0d8674dbe5a5b3 /builtin | |
parent | 28f5d176110d2ed768a0a49159993c7a02d8cb15 (diff) |
push --force-with-lease: implement logic to populate old_sha1_expect[]
This plugs the push_cas_option data collected by the command line
option parser to the transport system with a new function
apply_push_cas(), which is called after match_push_refs() has
already been called.
At this point, we know which remote we are talking to, and what
remote refs we are going to update, so we can fill in the details
that may have been missing from the command line, such as
(1) what abbreviated refname the user gave us matches the actual
refname at the remote; and
(2) which remote-tracking branch in our local repository to read
the value of the object to expect at the remote.
to populate the old_sha1_expect[] field of each of the remote ref.
As stated in the documentation, the use of remote-tracking branch
as the default is a tentative one, and we may come up with a better
logic as we gain experience.
Still nobody uses this information, which is the topic of the next
patch.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/push.c | 7 | ||||
-rw-r--r-- | builtin/send-pack.c | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/builtin/push.c b/builtin/push.c index 31a5ba085d..2fd0a70fa8 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -299,6 +299,13 @@ static int push_with_options(struct transport *transport, int flags) if (thin) transport_set_option(transport, TRANS_OPT_THIN, "yes"); + 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, diff --git a/builtin/send-pack.c b/builtin/send-pack.c index a23b26db17..6027ead5a9 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -242,6 +242,9 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) if (match_push_refs(local_refs, &remote_refs, nr_refspecs, refspecs, flags)) return -1; + if (!is_empty_cas(&cas)) + apply_push_cas(&cas, remote, remote_refs); + set_ref_status_for_push(remote_refs, args.send_mirror, args.force_update); |