Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1020291: git: "git diff --cached" gives confusing error when run outside Git repository

370 views
Skip to first unread message

Ansgar

unread,
Sep 19, 2022, 8:00:03 AM9/19/22
to
Package: git
Version: 1:2.37.2-1
Severity: normal
Tags: upstream
Control: found -1 1:2.35.1-1

Hi,

running "git diff --cached" outside a Git repository gives a confusing
error message:

+---
| $ git diff --cached
| error: unknown option `cached'
| [very long usage]
+---

This is very confusing: after all the "--cached" option still exists!

Very careful reading makes one notice that the very long usage message
starts with "usage: git diff --no-index"; this mode indeed has no
"--cached" option, but it was automatically selected.

It would be more helful if the error message would just state that
"git diff --cached" must be with inside a Git repository.

Ansgar

-- System Information:
Debian Release: bookworm/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (300, 'buildd-unstable'), (300, 'unstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.19.0-1-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages git depends on:
ii git-man 1:2.37.2-1
ii libc6 2.34-7
ii libcurl3-gnutls 7.85.0-1
ii liberror-perl 0.17029-1
ii libexpat1 2.4.8-1
ii libpcre2-8-0 10.40-1
ii perl 5.34.0-5
ii zlib1g 1:1.2.11.dfsg-4.1

Versions of packages git recommends:
ii ca-certificates 20211016
ii less 590-1
ii openssh-client [ssh-client] 1:9.0p1-1+b1
ii patch 2.7.6-7

Versions of packages git suggests:
ii gettext-base 0.21-9
pn git-cvs <none>
pn git-daemon-run | git-daemon-sysvinit <none>
pn git-doc <none>
pn git-email <none>
ii git-gui 1:2.37.2-1
pn git-mediawiki <none>
pn git-svn <none>
ii gitk 1:2.37.2-1
pn gitweb <none>

-- no debconf information
0 new messages