Merge branch 'ac/remote-v-with-object-list-filters'
"git remote -v" now shows the list-objects-filter used during fetching from the remote, if available. * ac/remote-v-with-object-list-filters: builtin/remote.c: teach `-v` to list filters for promisor remotesmaint
commit
2785b71ef9
|
@ -35,6 +35,8 @@ OPTIONS
|
||||||
-v::
|
-v::
|
||||||
--verbose::
|
--verbose::
|
||||||
Be a little more verbose and show remote url after name.
|
Be a little more verbose and show remote url after name.
|
||||||
|
For promisor remotes, also show which filter (`blob:none` etc.)
|
||||||
|
are configured.
|
||||||
NOTE: This must be placed between `remote` and subcommand.
|
NOTE: This must be placed between `remote` and subcommand.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1185,14 +1185,22 @@ static int show_push_info_item(struct string_list_item *item, void *cb_data)
|
||||||
static int get_one_entry(struct remote *remote, void *priv)
|
static int get_one_entry(struct remote *remote, void *priv)
|
||||||
{
|
{
|
||||||
struct string_list *list = priv;
|
struct string_list *list = priv;
|
||||||
struct strbuf url_buf = STRBUF_INIT;
|
struct strbuf remote_info_buf = STRBUF_INIT;
|
||||||
const char **url;
|
const char **url;
|
||||||
int i, url_nr;
|
int i, url_nr;
|
||||||
|
|
||||||
if (remote->url_nr > 0) {
|
if (remote->url_nr > 0) {
|
||||||
strbuf_addf(&url_buf, "%s (fetch)", remote->url[0]);
|
struct strbuf promisor_config = STRBUF_INIT;
|
||||||
|
const char *partial_clone_filter = NULL;
|
||||||
|
|
||||||
|
strbuf_addf(&promisor_config, "remote.%s.partialclonefilter", remote->name);
|
||||||
|
strbuf_addf(&remote_info_buf, "%s (fetch)", remote->url[0]);
|
||||||
|
if (!git_config_get_string_tmp(promisor_config.buf, &partial_clone_filter))
|
||||||
|
strbuf_addf(&remote_info_buf, " [%s]", partial_clone_filter);
|
||||||
|
|
||||||
|
strbuf_release(&promisor_config);
|
||||||
string_list_append(list, remote->name)->util =
|
string_list_append(list, remote->name)->util =
|
||||||
strbuf_detach(&url_buf, NULL);
|
strbuf_detach(&remote_info_buf, NULL);
|
||||||
} else
|
} else
|
||||||
string_list_append(list, remote->name)->util = NULL;
|
string_list_append(list, remote->name)->util = NULL;
|
||||||
if (remote->pushurl_nr) {
|
if (remote->pushurl_nr) {
|
||||||
|
@ -1204,9 +1212,9 @@ static int get_one_entry(struct remote *remote, void *priv)
|
||||||
}
|
}
|
||||||
for (i = 0; i < url_nr; i++)
|
for (i = 0; i < url_nr; i++)
|
||||||
{
|
{
|
||||||
strbuf_addf(&url_buf, "%s (push)", url[i]);
|
strbuf_addf(&remote_info_buf, "%s (push)", url[i]);
|
||||||
string_list_append(list, remote->name)->util =
|
string_list_append(list, remote->name)->util =
|
||||||
strbuf_detach(&url_buf, NULL);
|
strbuf_detach(&remote_info_buf, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -78,6 +78,40 @@ test_expect_success 'add another remote' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'setup bare clone for server' '
|
||||||
|
git clone --bare "file://$(pwd)/one" srv.bare &&
|
||||||
|
git -C srv.bare config --local uploadpack.allowfilter 1 &&
|
||||||
|
git -C srv.bare config --local uploadpack.allowanysha1inwant 1
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'filters for promisor remotes are listed by git remote -v' '
|
||||||
|
test_when_finished "rm -rf pc" &&
|
||||||
|
git clone --filter=blob:none "file://$(pwd)/srv.bare" pc &&
|
||||||
|
git -C pc remote -v >out &&
|
||||||
|
grep "srv.bare (fetch) \[blob:none\]" out &&
|
||||||
|
|
||||||
|
git -C pc config remote.origin.partialCloneFilter object:type=commit &&
|
||||||
|
git -C pc remote -v >out &&
|
||||||
|
grep "srv.bare (fetch) \[object:type=commit\]" out
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'filters should not be listed for non promisor remotes (remote -v)' '
|
||||||
|
test_when_finished "rm -rf pc" &&
|
||||||
|
git clone one pc &&
|
||||||
|
git -C pc remote -v >out &&
|
||||||
|
! grep "(fetch) \[.*\]" out
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'filters are listed by git remote -v only' '
|
||||||
|
test_when_finished "rm -rf pc" &&
|
||||||
|
git clone --filter=blob:none "file://$(pwd)/srv.bare" pc &&
|
||||||
|
git -C pc remote >out &&
|
||||||
|
! grep "\[blob:none\]" out &&
|
||||||
|
|
||||||
|
git -C pc remote show >out &&
|
||||||
|
! grep "\[blob:none\]" out
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'check remote-tracking' '
|
test_expect_success 'check remote-tracking' '
|
||||||
(
|
(
|
||||||
cd test &&
|
cd test &&
|
||||||
|
|
Loading…
Reference in New Issue