All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: <git@vger.kernel.org>,  Zhelyo Zhelev <zhelyo@gmail.com>
Subject: Re: [PATCH] checkout: quote invalid treeish in error message
Date: Thu, 25 Dec 2025 08:43:58 +0900	[thread overview]
Message-ID: <xmqqecojo37l.fsf@gitster.g> (raw)
In-Reply-To: <20251224203253.881129-1-sandals@crustytoothpaste.net> (brian m. carlson's message of "Wed, 24 Dec 2025 20:32:53 +0000")

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> We received a report that invoking "git restore -source my_base_branch"
> resulted in the confusing error message "fatal: could not resolve
> ource".  This looked like a typo in our error message, but it is
> actually because "-source" is missing its second dash and is being
> resolved as "-s ource".  However, due to the lack of the quoting
> recommended in CodingGuidelines, this is confusing to the reader and
> we can do better.
>
> Add the necessary quoting to this message.  With this change, we now get
> this less confusing message:
>
>     fatal: could not resolve 'ource'
>
> Reported-by: Zhelyo Zhelev <zhelyo@gmail.com>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
>  builtin/checkout.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Obviously the right thing to do.  Thanks.

>
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 66b69df6e6..261699e2f5 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -1899,7 +1899,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
>  		struct object_id rev;
>  
>  		if (repo_get_oid_mb(the_repository, opts->from_treeish, &rev))
> -			die(_("could not resolve %s"), opts->from_treeish);
> +			die(_("could not resolve '%s'"), opts->from_treeish);
>  
>  		setup_new_branch_info_and_source_tree(&new_branch_info,
>  						      opts, &rev,

      reply	other threads:[~2025-12-24 23:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-22  9:16 [BUG] git restore: typo in error message "could not resolve ource" Zhelyo Zhelev
2025-12-22 11:56 ` brian m. carlson
2025-12-22 13:19   ` Junio C Hamano
2025-12-24 20:32     ` [PATCH] checkout: quote invalid treeish in error message brian m. carlson
2025-12-24 23:43       ` 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

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

  git send-email \
    --in-reply-to=xmqqecojo37l.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sandals@crustytoothpaste.net \
    --cc=zhelyo@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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.