From: <rsbecker@nexbridge.com>
To: "'Okke Timm'" <okke@timm.sh>, <git@vger.kernel.org>
Subject: RE: [bug?] git diff --cached in a non-git directory
Date: Mon, 9 Sep 2024 11:37:46 -0400 [thread overview]
Message-ID: <05b501db02ce$3bd49e30$b37dda90$@nexbridge.com> (raw)
In-Reply-To: <2886189B-4BB5-4230-B7AF-94F97A13D72F@timm.sh>
On September 9, 2024 10:26 AM, Okke Timm wrote:
>What did you do before the bug happened? (Steps to reproduce your issue) I
>changed into a non-git directory.
>Then I called git with 'git diff --cached', which produced this error:
>
>error: unknown option `cached'
>usage: git diff --no-index [<options>] <path> <path> [...]
>
>What did you expect to happen? (Expected behavior) A helfpul error message.
>
>What happened instead? (Actual behavior) An unhelpful error message saying
that
>cached is an unknown option.
>
>What's different between what you expected and what actually happened?
>Me being confused why git suddenly forgot that `git diff --cached` is an
allowed
>option.
>
>Anything else you want to add:
>Please fix and thank you for this great tool!
>
>Please review the rest of the bug report below.
>You can delete any lines you don't wish to share.
>
>
>[System Info]
>git version:
>git version 2.46.0
>cpu: arm64
>no commit associated with this build
>sizeof-long: 8
>sizeof-size_t: 8
>shell-path: /bin/sh
>feature: fsmonitor--daemon
>libcurl: 8.4.0
>zlib: 1.2.12
>uname: Darwin 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:21 PDT
>2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8103 arm64 compiler info:
>clang: 15.0.0 (clang-1500.3.9.4) libc info: no libc information available
$SHELL
>(typically, interactive shell): /opt/homebrew/bin/bash
>
>
>[Enabled Hooks]
>not run from a git repository - no hooks to show
Because you are not in a git repository clone, the --cached option has no
meaning. It refers to the staging area only, so when not in a clone, git
does not consider --cached as supported because there is no connection
between an external directory and an internal. If you want to perform a diff
from cached vs. external, run the git diff from inside the clone referencing
the internal and external file after --.
next prev parent reply other threads:[~2024-09-09 15:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 14:26 [bug?] git diff --cached in a non-git directory Okke Timm
2024-09-09 15:37 ` rsbecker [this message]
2024-09-09 15:51 ` Okke Timm
2024-09-09 18:40 ` Junio C Hamano
2024-09-09 19:28 ` rsbecker
2024-09-09 20:26 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2024-09-09 14:48 Okke Timm
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='05b501db02ce$3bd49e30$b37dda90$@nexbridge.com' \
--to=rsbecker@nexbridge.com \
--cc=git@vger.kernel.org \
--cc=okke@timm.sh \
/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.