git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] list-objects: check if filter is NULL before using

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 12, 2018, 17:47 UTC
Message-ID
<xmqqfu1raodi.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180611215126.205944-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 8 quoted lines
> In partial_clone_get_default_filter_spec(), the
> core_partial_clone_filter_default variable may be NULL; ensure that it
> is not NULL before using it.
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> This was noticed by someone else at $DAY_JOB when trying to use a
> partial clone with no core.partialclonefilter set.
Thanks, will queue.
Show 37 quoted lines
> ---
>  list-objects-filter-options.c | 2 ++
>  t/t0410-partial-clone.sh      | 8 ++++++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
> index 6a3cc985c4..c0e2bd6a06 100644
> --- a/list-objects-filter-options.c
> +++ b/list-objects-filter-options.c
> @@ -146,6 +146,8 @@ void partial_clone_get_default_filter_spec(
>  	/*
>  	 * Parse default value, but silently ignore it if it is invalid.
>  	 */
> +	if (!core_partial_clone_filter_default)
> +		return;
>  	gently_parse_list_objects_filter(filter_options,
>  					 core_partial_clone_filter_default,
>  					 NULL);
> diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
> index cc18b75c03..4984ca583d 100755
> --- a/t/t0410-partial-clone.sh
> +++ b/t/t0410-partial-clone.sh
> @@ -23,7 +23,15 @@ promise_and_delete () {
>  	delete_object repo "$HASH"
>  }
>  
> +test_expect_success 'extensions.partialclone without filter' '
> +	test_create_repo server &&
> +	git clone --filter="blob:none" "file://$(pwd)/server" client &&
> +	git -C client config --unset core.partialclonefilter &&
> +	git -C client fetch origin
> +'
> +
>  test_expect_success 'missing reflog object, but promised by a commit, passes fsck' '
> +	rm -rf repo &&
>  	test_create_repo repo &&
>  	test_commit -C repo my_commit &&
Previous: Jonathan Tan
Message 2 of 2 in “list-objects: check if filter is NULL before using”
  1. list-objects: check if filter is NULL before usingJonathan Tan, Jun 11, 2018
  2. Junio C HamanoJun 12, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.