git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] list-objects: check if filter is NULL before using
Date: Tue, 12 Jun 2018 10:47:05 -0700	[thread overview]
Message-ID: <xmqqfu1raodi.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180611215126.205944-1-jonathantanmy@google.com> (Jonathan Tan's message of "Mon, 11 Jun 2018 14:51:26 -0700")

Jonathan Tan <jonathantanmy@google.com> writes:

> 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.

> ---
>  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 &&

      reply	other threads:[~2018-06-12 17:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 21:51 [PATCH] list-objects: check if filter is NULL before using Jonathan Tan
2018-06-12 17:47 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqfu1raodi.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).