git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] builtin/remote.c: teach `-v` to list filters for promisor remotes
@ 2022-04-30 13:19 Abhradeep Chakraborty via GitGitGadget
  2022-04-30 21:17 ` Junio C Hamano
  2022-05-03 15:20 ` [PATCH v2] " Abhradeep Chakraborty via GitGitGadget
  0 siblings, 2 replies; 26+ messages in thread
From: Abhradeep Chakraborty via GitGitGadget @ 2022-04-30 13:19 UTC (permalink / raw)
  To: git; +Cc: Abhradeep Chakraborty, Abhradeep Chakraborty

From: Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com>

`git remote -v` (`--verbose`) lists down the names of remotes along with
their urls. It would be beneficial for users to also specify the filter
types for promisor remotes. Something like this -

	origin	remote-url (fetch) [blob:none]
	origin	remote-url (push)

Teach `git remote -v` to also specify the filters for promisor remotes.

Signed-off-by: Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com>
---
    builtin/remote.c: teach -v to list filters for promisor remotes
    
    Fixes #1211 [1]
    
    [1] https://github.com/gitgitgadget/git/issues/1211

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1227%2FAbhra303%2Fpromisor_remote-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1227/Abhra303/promisor_remote-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1227

 builtin/remote.c         |  8 ++++++++
 t/t5616-partial-clone.sh | 11 +++++++++++
 2 files changed, 19 insertions(+)

diff --git a/builtin/remote.c b/builtin/remote.c
index 5f4cde9d784..95e28b534f4 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1190,7 +1190,15 @@ static int get_one_entry(struct remote *remote, void *priv)
 	int i, url_nr;
 
 	if (remote->url_nr > 0) {
+		struct strbuf promisor_config = STRBUF_INIT;
+		const char *partial_clone_filter = NULL;
+
+		strbuf_addf(&promisor_config, "remote.%s.partialclonefilter", remote->name);
 		strbuf_addf(&url_buf, "%s (fetch)", remote->url[0]);
+		if (!git_config_get_string_tmp(promisor_config.buf, &partial_clone_filter))
+			strbuf_addf(&url_buf, " [%s]", partial_clone_filter);
+
+		strbuf_release(&promisor_config);
 		string_list_append(list, remote->name)->util =
 				strbuf_detach(&url_buf, NULL);
 	} else
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index 4a3778d04a8..bf8f3644d3c 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -49,6 +49,17 @@ test_expect_success 'do partial clone 1' '
 	test "$(git -C pc1 config --local remote.origin.partialclonefilter)" = "blob:none"
 '
 
+test_expect_success 'filters for promisor remotes is listed by git remote -v' '
+	git clone --filter=blob:none "file://$(pwd)/srv.bare" pc2 &&
+	git -C pc2 remote -v >out &&
+	grep "[blob:none]" out &&
+
+	git -C pc2 config remote.origin.partialCloneFilter object:type=commit &&
+	git -C pc2 remote -v >out &&
+	grep "[object:type=commit]" out &&
+	rm -rf pc2
+'
+
 test_expect_success 'verify that .promisor file contains refs fetched' '
 	ls pc1/.git/objects/pack/pack-*.promisor >promisorlist &&
 	test_line_count = 1 promisorlist &&

base-commit: 0f828332d5ac36fc63b7d8202652efa152809856
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2022-05-16 15:39 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-30 13:19 [PATCH] builtin/remote.c: teach `-v` to list filters for promisor remotes Abhradeep Chakraborty via GitGitGadget
2022-04-30 21:17 ` Junio C Hamano
2022-05-01 15:57   ` Abhradeep Chakraborty
2022-05-01 16:14     ` Junio C Hamano
2022-05-01 19:38       ` Abhradeep Chakraborty
2022-05-02 10:33         ` Philip Oakley
2022-05-02 14:56           ` Abhradeep Chakraborty
2022-05-03 15:20 ` [PATCH v2] " Abhradeep Chakraborty via GitGitGadget
2022-05-04 17:10   ` Junio C Hamano
2022-05-05 14:12     ` Abhradeep Chakraborty
2022-05-07 14:20   ` [PATCH v3] " Abhradeep Chakraborty via GitGitGadget
2022-05-08 15:33     ` Philippe Blain
2022-05-09 16:29       ` Junio C Hamano
2022-05-09 16:45         ` Philippe Blain
2022-05-08 15:44     ` Philippe Blain
2022-05-09  9:13       ` Abhradeep Chakraborty
2022-05-09 11:32     ` [PATCH v4] " Abhradeep Chakraborty via GitGitGadget
2022-05-09 15:34       ` Taylor Blau
2022-05-09 17:01         ` Philippe Blain
2022-05-09 17:52           ` Junio C Hamano
2022-05-13 13:49             ` Abhradeep Chakraborty
2022-05-13 18:37               ` Junio C Hamano
2022-05-16 15:38                 ` Abhradeep Chakraborty
2022-05-09 17:21         ` Abhradeep Chakraborty
2022-05-09 22:22           ` Taylor Blau
2022-05-09 17:44         ` Abhradeep Chakraborty

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).