[PATCH] fetch: allow adding a filter after initial clone.

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

 



Signed-off-by: Xin Li <delphij@xxxxxxxxxx>
---
 builtin/fetch.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index 3ae52c015d..e5faa17ecd 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1790,8 +1790,16 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 	if (depth || deepen_since || deepen_not.nr)
 		deepen = 1;
 
-	if (filter_options.choice && !has_promisor_remote())
-		die("--filter can only be used when extensions.partialClone is set");
+	if (filter_options.choice && !has_promisor_remote()) {
+		char repo_version_string[10];
+
+		xsnprintf(repo_version_string, sizeof(repo_version_string),
+			  "%d", (int)GIT_REPO_VERSION);
+		git_config_set("core.repositoryformatversion",
+			repo_version_string);
+		git_config_set("extensions.partialclone", "origin");
+		promisor_remote_reinit();
+	}
 
 	if (all) {
 		if (argc == 1)
-- 
2.26.2.645.ge9eca65c58-goog




[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