summaryrefslogtreecommitdiff
path: root/transport.h
diff options
context:
space:
mode:
authorSrinidhi Kaushik <shrinidhi.kaushik@gmail.com>2020-10-03 12:10:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-10-03 16:59:19 (GMT)
commit3b990aa645d1169b7373d12cbf1511ca4633e349 (patch)
tree392838f3dc148baa81116708924b44a3e900b778 /transport.h
parent99a1f9ae10816c2527d7197a5dde714f980b712b (diff)
downloadgit-3b990aa645d1169b7373d12cbf1511ca4633e349.zip
git-3b990aa645d1169b7373d12cbf1511ca4633e349.tar.gz
git-3b990aa645d1169b7373d12cbf1511ca4633e349.tar.bz2
push: parse and set flag for "--force-if-includes"
The previous commit added the necessary machinery to implement the "--force-if-includes" protection, when "--force-with-lease" is used without giving exact object the remote still ought to have. Surface the feature by adding a command line option and a configuration variable to enable it. - Add a flag: "TRANSPORT_PUSH_FORCE_IF_INCLUDES" to indicate that the new option was passed from the command line of via configuration settings; update command line and configuration parsers to set the new flag accordingly. - Introduce a new configuration option "push.useForceIfIncludes", which is equivalent to setting "--force-if-includes" in the command line. - Update "remote-curl" to recognize and pass this option to "send-pack" when enabled. - Update "advise" to catch the reject reason "REJECT_REF_NEEDS_UPDATE", set when the ref status is "REF_STATUS_REJECT_REMOTE_UPDATED" and (optionally) print a help message when the push fails. - The new option is a "no-op" in the following scenarios: * When used without "--force-with-lease". * When used with "--force-with-lease", and if the expected commit on the remote side is specified as an argument. Signed-off-by: Srinidhi Kaushik <shrinidhi.kaushik@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.h')
-rw-r--r--transport.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/transport.h b/transport.h
index ca409ea..24558c0 100644
--- a/transport.h
+++ b/transport.h
@@ -136,6 +136,7 @@ struct transport {
#define TRANSPORT_PUSH_ATOMIC (1<<13)
#define TRANSPORT_PUSH_OPTIONS (1<<14)
#define TRANSPORT_RECURSE_SUBMODULES_ONLY (1<<15)
+#define TRANSPORT_PUSH_FORCE_IF_INCLUDES (1<<16)
int transport_summary_width(const struct ref *refs);
@@ -208,6 +209,9 @@ void transport_check_allowed(const char *type);
/* Request atomic (all-or-nothing) updates when pushing */
#define TRANS_OPT_ATOMIC "atomic"
+/* Require remote changes to be integrated locally. */
+#define TRANS_OPT_FORCE_IF_INCLUDES "force-if-includes"
+
/**
* Returns 0 if the option was used, non-zero otherwise. Prints a
* message to stderr if the option is not used.
@@ -217,11 +221,12 @@ int transport_set_option(struct transport *transport, const char *name,
void transport_set_verbosity(struct transport *transport, int verbosity,
int force_progress);
-#define REJECT_NON_FF_HEAD 0x01
-#define REJECT_NON_FF_OTHER 0x02
-#define REJECT_ALREADY_EXISTS 0x04
-#define REJECT_FETCH_FIRST 0x08
-#define REJECT_NEEDS_FORCE 0x10
+#define REJECT_NON_FF_HEAD 0x01
+#define REJECT_NON_FF_OTHER 0x02
+#define REJECT_ALREADY_EXISTS 0x04
+#define REJECT_FETCH_FIRST 0x08
+#define REJECT_NEEDS_FORCE 0x10
+#define REJECT_REF_NEEDS_UPDATE 0x20
int transport_push(struct repository *repo,
struct transport *connection,