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

Re: [PATCH] checkout: quote invalid treeish in error message

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 24, 2025, 23:43 UTC
Message-ID
<xmqqecojo37l.fsf@gitster.g>
In-Reply-To
<20251224203253.881129-1-sandals@crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 18 quoted lines
> 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.
Show 14 quoted lines
>
> 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,
Previous: brian m. carlson
Message 5 of 5 in “[BUG] git restore: typo in error message "could not resolve ource"”
  1. Zhelyo ZhelevDec 22, 2025
  2. brian m. carlsonDec 22, 2025
  3. Junio C HamanoDec 22, 2025
  4. checkout: quote invalid treeish in error messagebrian m. carlson, Dec 24, 2025
  5. Junio C HamanoDec 24, 2025

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.