diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-10-27 23:09:49 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-10-27 23:09:49 +0100 |
commit | de0a7effc86aadf6177fdcea52b5ae24c7a85911 (patch) | |
tree | 4c542ec9c7c2b29ad2d1c1329602bc47dc40c4c5 /remote.h | |
parent | Merge branch 'ds/maintenance-part-2' (diff) | |
parent | t, doc: update tests, reference for "--force-if-includes" (diff) | |
download | git-de0a7effc86aadf6177fdcea52b5ae24c7a85911.tar.xz git-de0a7effc86aadf6177fdcea52b5ae24c7a85911.zip |
Merge branch 'sk/force-if-includes'
"git push --force-with-lease[=<ref>]" can easily be misused to lose
commits unless the user takes good care of their own "git fetch".
A new option "--force-if-includes" attempts to ensure that what is
being force-pushed was created after examining the commit at the
tip of the remote ref that is about to be force-replaced.
* sk/force-if-includes:
t, doc: update tests, reference for "--force-if-includes"
push: parse and set flag for "--force-if-includes"
push: add reflog check for "--force-if-includes"
Diffstat (limited to 'remote.h')
-rw-r--r-- | remote.h | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -107,12 +107,20 @@ struct ref { struct object_id new_oid; struct object_id old_oid_expect; /* used by expect-old */ char *symref; + char *tracking_ref; unsigned int force:1, forced_update:1, expect_old_sha1:1, exact_oid:1, - deletion:1; + deletion:1, + /* Need to check if local reflog reaches the remote tip. */ + check_reachable:1, + /* + * Store the result of the check enabled by "check_reachable"; + * implies the local reflog does not reach the remote tip. + */ + unreachable:1; enum { REF_NOT_MATCHED = 0, /* initial value */ @@ -142,6 +150,7 @@ struct ref { REF_STATUS_REJECT_NEEDS_FORCE, REF_STATUS_REJECT_STALE, REF_STATUS_REJECT_SHALLOW, + REF_STATUS_REJECT_REMOTE_UPDATED, REF_STATUS_UPTODATE, REF_STATUS_REMOTE_REJECT, REF_STATUS_EXPECTING_REPORT, @@ -348,6 +357,7 @@ struct ref *get_stale_heads(struct refspec *rs, struct ref *fetch_map); struct push_cas_option { unsigned use_tracking_for_rest:1; + unsigned use_force_if_includes:1; struct push_cas { struct object_id expect; unsigned use_tracking:1; |