diff mbox series

[v2,2/2] push: enable "forceIfIncludesWithLease" by default

Message ID 20200912150459.8282-3-shrinidhi.kaushik@gmail.com
State New
Headers show
Series push: make "--force-with-lease" safer | expand

Commit Message

Srinidhi Kaushik Sept. 12, 2020, 3:04 p.m. UTC
Set `push.forceIfIncludesWithLease` to `true` if experimental
features are enabled.

Signed-off-by: Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>
 Documentation/config/feature.txt |  6 ++++++
 builtin/push.c                   | 11 +++++++++++
 2 files changed, 17 insertions(+)


Junio C Hamano Sept. 12, 2020, 6:22 p.m. UTC | #1
Srinidhi Kaushik <shrinidhi.kaushik@gmail.com> writes:

> Set `push.forceIfIncludesWithLease` to `true` if experimental
> features are enabled.


We enable something to the guinea-pig audience if we consider that
it should become the default eventually for everybody.  I did not
see enough justification why this should be on for everybody
diff mbox series


diff --git a/Documentation/config/feature.txt b/Documentation/config/feature.txt
index c0cbf2bb1c..4a8a386132 100644
--- a/Documentation/config/feature.txt
+++ b/Documentation/config/feature.txt
@@ -18,6 +18,12 @@  skipping more commits at a time, reducing the number of round trips.
 * `protocol.version=2` speeds up fetches from repositories with many refs by
 allowing the client to specify which refs to list before the server lists
+* `push.forceIfIncludesWithLease=true` adds `--force-if-includes` as an
+additional option along with `--force-with-lease[=<refname>[:<expect>]`
+when "<refname>" or "<expect>" valus are unspecified for linkgit:git-push[1].
+Allows forced updates only if the local branch has incorporated changes
+from the remote-tracking ref.
 	Enable config options that optimize for repos with many files in the
diff --git a/builtin/push.c b/builtin/push.c
index 7fb07eb38e..658694edff 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -540,6 +540,17 @@  static int git_push_config(const char *k, const char *v, void *cb)
+		return 0;
+	} else if (!strcmp(k, "feature.experimental")) {
+		/*
+		 * Set `push.forceIfIncludesWithLease` to true,
+		 * if experimental features are enabled.
+		 */
+		if (git_config_bool(k, v))
+		else
 		return 0;
 	return git_default_config(k, v, NULL);