git/builtin
Junio C Hamano 28f5d17611 remote.c: add command line option parser for "--force-with-lease"
Update "git push" and "git send-pack" to parse this commnd line
option.

The intended sematics is:

 * "--force-with-lease" 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 some reasonable
   default, unless otherwise specified;

 * "--force-with-lease=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 some reasonable
   default.

 * "--force-with-lease=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; and

 * "--no-force-with-lease" will cancel all the previous --force-with-lease on the
   command line.

For now, "some reasonable default" is tentatively defined as "the
value of the remote-tracking branch we have for the ref of the
remote being updated", and it is an error if we do not have such a
remote-tracking branch.  But this is known to be fragile, its use is
not yet recommended, and hopefully we will find more reasonable
default as we gain experience with this feature.  The manual marks
the feature as experimental unless the expected value is specified
explicitly for this reason.

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 in order to find the
ones that need to be checked after explicit ones have been processed
for "--force-with-lease" (no specific details).

These post-processing will be the topic of the next patch.

This option was originally called "cas" (for "compare and swap"),
the name which nobody liked because it was too technical.  The
second attempt called it "lockref" (because it is conceptually like
pushing after taking a lock) but the word "lock" was hated because
it implied that it may reject push by others, which is not the way
this option works.  This round calls it "force-with-lease".  You
assume you took the lease on the ref when you fetched to decide what
the rebased history should be, and you can push back only if the
lease has not been broken.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-22 22:02:55 -07:00
..
add.c Merge branch 'jc/add-ignore-removal' 2013-04-26 15:28:09 -07:00
annotate.c
apply.c Merge branch 'tr/maint-apply-non-git-patch-parsefix' 2013-06-26 15:08:09 -07:00
archive.c pkt-line: provide a LARGE_PACKET_MAX static buffer 2013-02-20 13:42:22 -08:00
bisect--helper.c i18n: bisect--helper: mark parseopt strings for translation 2012-08-20 12:23:15 -07:00
blame.c Merge branch 'tr/line-log' 2013-06-02 16:00:44 -07:00
branch.c branch: colour upstream branches 2013-04-15 11:04:44 -07:00
bundle.c
cat-file.c cat-file: print tags raw for "cat-file -p" 2013-04-17 14:48:45 -07:00
check-attr.c Merge branch 'maint' 2012-09-17 15:59:34 -07:00
check-ignore.c Merge branch 'as/check-ignore' 2013-05-29 14:23:40 -07:00
check-ref-format.c
checkout-index.c Use imperative form in help usage to describe an action 2012-08-22 12:02:28 -07:00
checkout.c builtin/checkout.c: don't leak memory in check_tracking_name 2013-06-18 07:25:06 -07:00
clean.c Merge branch 'as/check-ignore' 2013-01-23 21:19:10 -08:00
clone.c refs: implement simple transactions for the packed-refs file 2013-06-20 15:50:17 -07:00
column.c i18n: column: mark parseopt strings for translation 2012-08-20 12:23:16 -07:00
commit-tree.c commit-tree: document -S option consistently 2013-03-25 15:01:22 -07:00
commit.c Merge branch 'jh/libify-note-handling' 2013-06-24 13:48:30 -07:00
config.c Merge branch 'mm/color-auto-default' 2013-06-20 16:02:33 -07:00
count-objects.c count-objects: add -H option to humanize sizes 2013-04-10 13:27:26 -07:00
credential.c git credential fill: output the whole 'struct credential' 2012-06-25 11:56:24 -07:00
describe.c Merge branch 'mh/reflife' 2013-06-14 08:46:14 -07:00
diff-files.c
diff-index.c update-index/diff-index: use core.preloadindex to improve performance 2012-11-02 11:38:29 -04:00
diff-tree.c
diff.c cmd_diff(): make it obvious which cases are exclusive of each other 2013-05-28 09:25:01 -07:00
fast-export.c fast-{import,export}: use get_sha1_hex() to read from marks file 2013-05-07 16:20:40 -07:00
fetch-pack.c cache.h: move remote/connect API out of it 2013-07-08 14:34:24 -07:00
fetch.c Merge branch 'mh/reflife' 2013-06-14 08:46:14 -07:00
fmt-merge-msg.c Merge branch 'rt/commentchar-fmt-merge-msg' into maint 2013-04-26 11:10:47 -07:00
for-each-ref.c Merge branch 'nd/i18n-parseopt-help' 2012-09-07 11:09:09 -07:00
fsck.c fsck: don't put a void*-shaped peg in a char*-shaped hole 2013-05-28 09:25:01 -07:00
gc.c silence git gc --auto --quiet output 2012-09-27 17:57:26 -07:00
grep.c Sync with 1.8.1 maintenance track 2013-04-03 09:18:01 -07:00
hash-object.c i18n: hash-object: mark parseopt strings for translation 2012-08-20 12:23:17 -07:00
help.c Merge branch 'ph/builtin-srcs-are-in-subdir-these-days' 2013-06-26 15:07:48 -07:00
index-pack.c clone: open a shortcut for connectivity check 2013-05-28 08:07:20 -07:00
init-db.c i18n: init-db: mark parseopt strings for translation 2012-08-20 12:23:17 -07:00
log.c Merge branch 'jc/topo-author-date-sort' 2013-07-01 12:41:23 -07:00
ls-files.c Merge branch 'mh/ref-races' 2013-06-30 15:40:05 -07:00
ls-remote.c ls-remote: document the '--get-url' option 2012-09-07 10:58:35 -07:00
ls-tree.c pathspec: save the non-wildcard length part 2012-11-19 13:08:28 -08:00
mailinfo.c Merge branch 'jc/same-encoding' into maint 2012-12-07 14:10:56 -08:00
mailsplit.c mailsplit: sort maildir filenames more cleverly 2013-03-02 22:52:44 -08:00
merge-base.c use logical OR (||) instead of binary OR (|) in logical context 2013-06-13 14:47:07 -07:00
merge-file.c i18n: merge-file: mark parseopt strings for translation 2012-08-20 12:23:18 -07:00
merge-index.c Which merge_file() function do you mean? 2012-12-09 23:05:27 -08:00
merge-ours.c
merge-recursive.c
merge-tree.c merge-tree: handle directory/empty conflict correctly 2013-05-06 22:17:00 -07:00
merge.c merge: use help_unknown_ref() 2013-05-08 15:34:33 -07:00
mktag.c
mktree.c i18n: mktree: mark parseopt strings for translation 2012-08-20 12:23:18 -07:00
mv.c i18n: mv: mark parseopt strings for translation 2012-08-20 12:23:18 -07:00
name-rev.c name-rev: allow to specify a subpath for --refs option 2013-06-18 12:02:02 -07:00
notes.c Merge branch 'ph/builtin-srcs-are-in-subdir-these-days' 2013-06-26 15:07:48 -07:00
pack-objects.c Merge branch 'jk/peel-ref' 2012-10-25 06:42:27 -04:00
pack-redundant.c Fix sizeof usage in get_permutations 2012-12-13 11:13:44 -08:00
pack-refs.c pack-refs: merge code from pack-refs.{c,h} into refs.{c,h} 2013-05-01 15:33:11 -07:00
patch-id.c
prune-packed.c prune-packed: avoid implying "1" is DRY_RUN in prune_packed_objects() 2013-05-28 09:20:54 -07:00
prune.c Merge branch 'nd/prune-packed-dryrun-verbose' 2013-06-06 12:17:52 -07:00
push.c remote.c: add command line option parser for "--force-with-lease" 2013-07-22 22:02:55 -07:00
read-tree.c diff-lib, read-tree, unpack-trees: mark cache_entry array paramters const 2013-06-02 15:31:14 -07:00
receive-pack.c cache.h: move remote/connect API out of it 2013-07-08 14:34:24 -07:00
reflog.c Merge branch 'jc/prune-all' 2013-05-29 14:23:04 -07:00
remote-ext.c
remote-fd.c
remote.c remote: check for superfluous arguments in 'git remote add' 2013-04-24 13:12:51 -07:00
replace.c fix "builtin-*" references to be "builtin/*" 2013-06-18 11:05:51 -07:00
rerere.c i18n: rerere: mark parseopt strings for translation 2012-08-20 12:23:19 -07:00
reset.c reset: update documentation to require only tree-ish with paths 2013-01-16 12:50:23 -08:00
rev-list.c Move print_commit_list to libgit.a 2012-10-29 03:08:30 -04:00
rev-parse.c rev-parse: add --prefix option 2013-06-17 13:30:01 -07:00
revert.c cherry-pick/revert: make usage say '<commit-ish>...' 2013-04-24 09:48:01 -07:00
rm.c rm: introduce advice.rmHints to shorten messages 2013-06-12 16:59:55 -07:00
send-pack.c remote.c: add command line option parser for "--force-with-lease" 2013-07-22 22:02:55 -07:00
shortlog.c builtin/shortlog.c: make usage string consistent with log 2013-04-22 08:00:54 -07:00
show-branch.c Merge branch 'jc/topo-author-date-sort' 2013-07-01 12:41:23 -07:00
show-ref.c exclude_existing(): set existing_refs.strdup_strings 2013-06-02 15:28:47 -07:00
stripspace.c Allow custom "comment char" 2013-01-16 12:48:22 -08:00
symbolic-ref.c git symbolic-ref --delete $symref 2012-10-21 12:17:38 -07:00
tag.c Merge branch 'ph/tag-force-no-warn-on-creation' into maint 2013-04-03 09:24:51 -07:00
tar-tree.c
unpack-file.c
unpack-objects.c remove superfluous newlines in error messages 2012-04-30 15:45:51 -07:00
update-index.c update-index: allow "-h" to also display options 2013-02-23 23:49:33 -08:00
update-ref.c Use imperative form in help usage to describe an action 2012-08-22 12:02:28 -07:00
update-server-info.c i18n: update-server-info: mark parseopt strings for translation 2012-08-22 10:58:29 -07:00
upload-archive.c pkt-line: provide a LARGE_PACKET_MAX static buffer 2013-02-20 13:42:22 -08:00
var.c ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT 2012-05-24 17:16:41 -07:00
verify-pack.c i18n: verify-pack: mark parseopt strings for translation 2012-08-22 10:58:29 -07:00
verify-tag.c gpg_interface: allow to request status return 2013-02-14 09:30:04 -08:00
write-tree.c i18n: write-tree: mark parseopt strings for translation 2012-08-22 10:58:29 -07:00