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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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

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
 them.
++
+* `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.
 
 feature.manyFiles::
 	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)
 		else
 			*flags &= ~TRANSPORT_PUSH_FORCE_IF_INCLUDES;
 
+		return 0;
+	} else if (!strcmp(k, "feature.experimental")) {
+		/*
+		 * Set `push.forceIfIncludesWithLease` to true,
+		 * if experimental features are enabled.
+		 */
+		if (git_config_bool(k, v))
+			*flags |= TRANSPORT_PUSH_FORCE_IF_INCLUDES;
+		else
+			*flags &= ~TRANSPORT_PUSH_FORCE_IF_INCLUDES;
+
 		return 0;
 	}
 	return git_default_config(k, v, NULL);
-- 
2.28.0




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux