From: Kristoffer Haugsbakk Date: Mon, 05 Jan 2026 15:17:09 GMT Subject: Re: git-last-modified on bare repository Message-ID: In-Reply-To: On Mon, Jan 5, 2026, at 16:03, Patrick Steinhardt wrote: > On Mon, Jan 05, 2026 at 02:35:56PM +0100, Gusted wrote: >> Hi, >> >> Now trying to actually make Forgejo use git last-modified after being >> pointed to the non-yet-documented options but I quickly noticed that it >> looks like it does not work as intended on bare repositories when looking >> specifying files. >> >> $ git clone https://codeberg.org/Gusted/math-accuracy >> $ cd math-accuracy >> $ git last-modified -- LICENSES >> 768f05837e7db2832425bc3b65d0f524e81b2769 LICENSES >> >> And on a bare repository: >> >> $ git clone --bare https://codeberg.org/Gusted/math-accuracy >> $ cd math-accuracy.git >> $ git last-modified -- LICENSE >> fatal: ambiguous argument 'LICENSE': unknown revision or path not in the >> working tree. >> Use '--' to separate paths from revisions, like this: >> 'git [...] -- [...]' >> >> Is a worktree required for this to work? > > A worktree is not required for this to work. The problem is that you've > got a typo in there: you say "LICENSE", but the actual file is called > "LICENSES". If you spell it correctly it should work alright. The error message is more generic than it needs to be though. It has seen a `--` but it falls back to “revision or path”. A more pointed error error message “unknown path” would make it harder to make the mistake of dismissing the error as a bogus one. Of course, separate issue and all.