From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Zhelyo Zhelev <zhelyo@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] git restore: typo in error message "could not resolve ource"
Date: Mon, 22 Dec 2025 11:56:09 +0000 [thread overview]
Message-ID: <aUkx2XYCP75GrCsS@fruit.crustytoothpaste.net> (raw)
In-Reply-To: <CAMxgZ8KqU9BUJ6T7DLct3CaEh9EYdcMO=dBAMPyQsb=knekSuQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]
On 2025-12-22 at 09:16:07, Zhelyo Zhelev wrote:
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
>
> What did you do before the bug happened? (Steps to reproduce your issue)
> I executed the following command in repository: git restore -source
> my_base_branch
> I have reproduced this on both Windows (git version 2.52.0.windows.1)
> and Ubuntu (git version 2.52.0).
I can also reproduce this using Git 2.51.0.338.gd7d06c2dae8 on Debian
unstable.
> What did you expect to happen? (Expected behavior)
> The error message should be:
> fatal: could not resolve source
>
> What happened instead? (Actual behavior)
> The error message is:
> fatal: could not resolve ource
>
> What's different between what you expected and what actually happened?
> There is a typo in the displayed error message - the first letter 's'
> is missing from the word "source" in the output.
I think this is due to a typo in your command and I'll explain why it
happens.
You wrote `git restore -source`, not `git restore --source`. Most
programs use double dashes for long options, including Git. Part of the
reason the second dash is necessary is that `-source` is interpreted as
`-s ource`, or the equivalent of `--source=ource`. Git was confused
because `ource` didn't match any revision it could check out and
obviously that's because you didn't intend that at all.
So I think this is functioning as designed and isn't actually a typo in
Git. The code appears to be in `builtin/checkout.c`:
builtin/checkout.c: die(_("could not resolve %s"), opts->from_treeish);
That shows that it prints "could not resolve" and then the thing it
tried to resolve as a branch.
--
brian m. carlson (they/them)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2025-12-22 11:56 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 [this message]
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
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=aUkx2XYCP75GrCsS@fruit.crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=git@vger.kernel.org \
--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.