git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Han-Wen Nienhuys <hanwenn@gmail.com>,
	Han-Wen Nienhuys <hanwen@google.com>
Subject: Re: [PATCH] refs: drop force_create argument of create_reflog API
Date: Mon, 22 Nov 2021 11:00:57 -0800	[thread overview]
Message-ID: <xmqq4k84f21i.fsf@gitster.g> (raw)
In-Reply-To: <pull.1144.git.git.1637590749342.gitgitgadget@gmail.com> (Han-Wen Nienhuys via GitGitGadget's message of "Mon, 22 Nov 2021 14:19:08 +0000")

"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Han-Wen Nienhuys <hanwen@google.com>
>
> There is only one caller, builtin/checkout.c, and it hardcodes
> force_create=1.
>
> This argument was introduced in abd0cd3a301 (refs: new public ref function:
> safe_create_reflog, 2015-07-21), which promised to immediately use it in a
> follow-on commit, but that never happened.
>
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---

Thanks.  It's an obvious simplification.  I wish all our changes were
like this ;-)

> diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
> index b314b81a45b..98f827edfb7 100644
> --- a/t/helper/test-ref-store.c
> +++ b/t/helper/test-ref-store.c
> @@ -181,11 +181,10 @@ static int cmd_reflog_exists(struct ref_store *refs, const char **argv)
>  static int cmd_create_reflog(struct ref_store *refs, const char **argv)
>  {
>  	const char *refname = notnull(*argv++, "refname");
> -	int force_create = arg_flags(*argv++, "force-create");
>  	struct strbuf err = STRBUF_INIT;
>  	int ret;
>  
> -	ret = refs_create_reflog(refs, refname, force_create, &err);
> +	ret = refs_create_reflog(refs, refname, &err);
>  	if (err.len)
>  		puts(err.buf);
>  	return ret;
> diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh
> index 49718b7ea7f..c89cef2d26b 100755
> --- a/t/t1405-main-ref-store.sh
> +++ b/t/t1405-main-ref-store.sh
> @@ -108,7 +108,7 @@ test_expect_success 'delete_reflog(HEAD)' '
>  '
>  
>  test_expect_success 'create-reflog(HEAD)' '
> -	$RUN create-reflog HEAD 1 &&
> +	$RUN create-reflog HEAD &&
>  	git reflog exists HEAD
>  '
>  
> diff --git a/t/t1406-submodule-ref-store.sh b/t/t1406-submodule-ref-store.sh
> index 0a87058971e..f1e57a9c051 100755
> --- a/t/t1406-submodule-ref-store.sh
> +++ b/t/t1406-submodule-ref-store.sh
> @@ -92,7 +92,7 @@ test_expect_success 'delete_reflog() not allowed' '
>  '
>  
>  test_expect_success 'create-reflog() not allowed' '
> -	test_must_fail $RUN create-reflog HEAD 1
> +	test_must_fail $RUN create-reflog HEAD
>  '
>  
>  test_done
>
> base-commit: cd3e606211bb1cf8bc57f7d76bab98cc17a150bc

      reply	other threads:[~2021-11-22 19:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 14:19 [PATCH] refs: drop force_create argument of create_reflog API Han-Wen Nienhuys via GitGitGadget
2021-11-22 19:00 ` 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=xmqq4k84f21i.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=hanwen@google.com \
    --cc=hanwenn@gmail.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).