public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* git-last-modified on bare repository
@ 2026-01-05 13:35 Gusted
  2026-01-05 15:03 ` Patrick Steinhardt
  0 siblings, 1 reply; 11+ messages in thread
From: Gusted @ 2026-01-05 13:35 UTC (permalink / raw)
  To: git

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 <command> [<revision>...] -- [<file>...]'

Is a worktree required for this to work?

Because it was talking about revision, I quickly checked a refspec as 
input and it looks like I found another way to trigger a BUG.

$ git last-modified -- HEAD:LICENSES
BUG: builtin/last-modified.c:456: paths remaining beyond boundary in 
last-modified
[1]    202076 IOT instruction (core dumped)  git last-modified -- 
HEAD:LICENSES

On the bare and non-bare repository.

Kind Regards
Gusted

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-last-modified on bare repository
  2026-01-05 13:35 git-last-modified on bare repository Gusted
@ 2026-01-05 15:03 ` Patrick Steinhardt
  2026-01-05 15:06   ` Gusted
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Patrick Steinhardt @ 2026-01-05 15:03 UTC (permalink / raw)
  To: Gusted; +Cc: git, Toon Claes

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 <command> [<revision>...] -- [<file>...]'
> 
> 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.

> Because it was talking about revision, I quickly checked a refspec as input
> and it looks like I found another way to trigger a BUG.
> 
> $ git last-modified -- HEAD:LICENSES
> BUG: builtin/last-modified.c:456: paths remaining beyond boundary in
> last-modified
> [1]    202076 IOT instruction (core dumped)  git last-modified --
> HEAD:LICENSES
> 
> On the bare and non-bare repository.

This looks like a bug to me indeed. Cc'ing Toon.

Thanks!

Patrick

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-last-modified on bare repository
  2026-01-05 15:03 ` Patrick Steinhardt
@ 2026-01-05 15:06   ` Gusted
  2026-01-05 15:17     ` Patrick Steinhardt
  2026-01-05 15:17   ` Kristoffer Haugsbakk
  2026-01-12 15:15   ` Toon Claes
  2 siblings, 1 reply; 11+ messages in thread
From: Gusted @ 2026-01-05 15:06 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git, Toon Claes

On 1/5/26 4:03 PM, 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 <command> [<revision>...] -- [<file>...]'
>>
>> 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.
> 

Ah, sorry the typo is on me from copying the wrong command from the 
shell history. It produces the same output with using LICENSES as path.

$ git last-modified -- LICENSES
fatal: ambiguous argument 'LICENSES': unknown revision or path not in 
the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

>> Because it was talking about revision, I quickly checked a refspec as input
>> and it looks like I found another way to trigger a BUG.
>>
>> $ git last-modified -- HEAD:LICENSES
>> BUG: builtin/last-modified.c:456: paths remaining beyond boundary in
>> last-modified
>> [1]    202076 IOT instruction (core dumped)  git last-modified --
>> HEAD:LICENSES
>>
>> On the bare and non-bare repository.
> 
> This looks like a bug to me indeed. Cc'ing Toon.
> 
> Thanks!
> 
> Patrick

Kind Regards
Gusted

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-last-modified on bare repository
  2026-01-05 15:03 ` Patrick Steinhardt
  2026-01-05 15:06   ` Gusted
@ 2026-01-05 15:17   ` Kristoffer Haugsbakk
  2026-01-12 15:15   ` Toon Claes
  2 siblings, 0 replies; 11+ messages in thread
From: Kristoffer Haugsbakk @ 2026-01-05 15:17 UTC (permalink / raw)
  To: Patrick Steinhardt, Gusted; +Cc: git, Toon Claes

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 <command> [<revision>...] -- [<file>...]'
>>
>> 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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-last-modified on bare repository
  2026-01-05 15:06   ` Gusted
@ 2026-01-05 15:17     ` Patrick Steinhardt
  2026-01-06  9:42       ` Gusted
  0 siblings, 1 reply; 11+ messages in thread
From: Patrick Steinhardt @ 2026-01-05 15:17 UTC (permalink / raw)
  To: Gusted; +Cc: git, Toon Claes

On Mon, Jan 05, 2026 at 04:06:39PM +0100, Gusted wrote:
> On 1/5/26 4:03 PM, 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 <command> [<revision>...] -- [<file>...]'
> > > 
> > > 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.
> > 
> 
> Ah, sorry the typo is on me from copying the wrong command from the shell
> history. It produces the same output with using LICENSES as path.
> 
> $ git last-modified -- LICENSES
> fatal: ambiguous argument 'LICENSES': unknown revision or path not in the
> working tree.
> Use '--' to separate paths from revisions, like this:
> 'git <command> [<revision>...] -- [<file>...]'

Hm, interesting, this works for me in a bare repository. Has this
already been fixed...? Indeed, bisecting this points to 05491b90ce
(last-modified: support sparse checkouts, 2025-11-29). So you should
probably try with Git's "master" branch.

Patrick

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-last-modified on bare repository
  2026-01-05 15:17     ` Patrick Steinhardt
@ 2026-01-06  9:42       ` Gusted
  2026-01-06  9:58         ` Patrick Steinhardt
  0 siblings, 1 reply; 11+ messages in thread
From: Gusted @ 2026-01-06  9:42 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git, Toon Claes

On 1/5/26 4:17 PM, Patrick Steinhardt wrote:
> On Mon, Jan 05, 2026 at 04:06:39PM +0100, Gusted wrote:
>> On 1/5/26 4:03 PM, 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 <command> [<revision>...] -- [<file>...]'
>>>>
>>>> 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.
>>>
>>
>> Ah, sorry the typo is on me from copying the wrong command from the shell
>> history. It produces the same output with using LICENSES as path.
>>
>> $ git last-modified -- LICENSES
>> fatal: ambiguous argument 'LICENSES': unknown revision or path not in the
>> working tree.
>> Use '--' to separate paths from revisions, like this:
>> 'git <command> [<revision>...] -- [<file>...]'
> 
> Hm, interesting, this works for me in a bare repository. Has this
> already been fixed...? Indeed, bisecting this points to 05491b90ce
> (last-modified: support sparse checkouts, 2025-11-29). So you should
> probably try with Git's "master" branch.
> 
> Patrick

Yup, git from source works! Do you by any chance know if 05491b90ce is 
going to be in v2.52.1?

Kind Regards
Gusted

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-last-modified on bare repository
  2026-01-06  9:42       ` Gusted
@ 2026-01-06  9:58         ` Patrick Steinhardt
  2026-01-06 10:54           ` Kristoffer Haugsbakk
  0 siblings, 1 reply; 11+ messages in thread
From: Patrick Steinhardt @ 2026-01-06  9:58 UTC (permalink / raw)
  To: Gusted; +Cc: git, Toon Claes, Junio C Hamano

On Tue, Jan 06, 2026 at 10:42:55AM +0100, Gusted wrote:
> On 1/5/26 4:17 PM, Patrick Steinhardt wrote:
> > On Mon, Jan 05, 2026 at 04:06:39PM +0100, Gusted wrote:
> > > On 1/5/26 4:03 PM, 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 <command> [<revision>...] -- [<file>...]'
> > > > > 
> > > > > 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.
> > > > 
> > > 
> > > Ah, sorry the typo is on me from copying the wrong command from the shell
> > > history. It produces the same output with using LICENSES as path.
> > > 
> > > $ git last-modified -- LICENSES
> > > fatal: ambiguous argument 'LICENSES': unknown revision or path not in the
> > > working tree.
> > > Use '--' to separate paths from revisions, like this:
> > > 'git <command> [<revision>...] -- [<file>...]'
> > 
> > Hm, interesting, this works for me in a bare repository. Has this
> > already been fixed...? Indeed, bisecting this points to 05491b90ce
> > (last-modified: support sparse checkouts, 2025-11-29). So you should
> > probably try with Git's "master" branch.
> > 
> > Patrick
> 
> Yup, git from source works! Do you by any chance know if 05491b90ce is going
> to be in v2.52.1?

No idea, point releases are typically done rather ad-hoc. Let me Cc
Junio though so that he's aware that we might want to pick this if we
ever release v2.52.1.

Patrick

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-last-modified on bare repository
  2026-01-06  9:58         ` Patrick Steinhardt
@ 2026-01-06 10:54           ` Kristoffer Haugsbakk
  2026-01-07  0:01             ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Kristoffer Haugsbakk @ 2026-01-06 10:54 UTC (permalink / raw)
  To: Patrick Steinhardt, Gusted; +Cc: git, Toon Claes, Junio C Hamano

On Tue, Jan 6, 2026, at 10:58, Patrick Steinhardt wrote:
> On Tue, Jan 06, 2026 at 10:42:55AM +0100, Gusted wrote:
>> On 1/5/26 4:17 PM, Patrick Steinhardt wrote:
>>>[snip]
>>
>> Yup, git from source works! Do you by any chance know if 05491b90ce is going
>> to be in v2.52.1?
>
> No idea, point releases are typically done rather ad-hoc. Let me Cc
> Junio though so that he's aware that we might want to pick this if we
> ever release v2.52.1.

`RelNotes` says that this will be merged to `maint` later which points
at tag v2.52.0 currently.

     * "git last-modified" used to mishandle "--" to mark the beginning of
       pathspec, which has been corrected.
       (merge 05491b90ce js/last-modified-with-sparse-checkouts later to maint).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-last-modified on bare repository
  2026-01-06 10:54           ` Kristoffer Haugsbakk
@ 2026-01-07  0:01             ` Junio C Hamano
  2026-01-07 17:12               ` D. Ben Knoble
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2026-01-07  0:01 UTC (permalink / raw)
  To: Kristoffer Haugsbakk; +Cc: Patrick Steinhardt, Gusted, git, Toon Claes

"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:

> On Tue, Jan 6, 2026, at 10:58, Patrick Steinhardt wrote:
>> On Tue, Jan 06, 2026 at 10:42:55AM +0100, Gusted wrote:
>>> On 1/5/26 4:17 PM, Patrick Steinhardt wrote:
>>>>[snip]
>>>
>>> Yup, git from source works! Do you by any chance know if 05491b90ce is going
>>> to be in v2.52.1?
>>
>> No idea, point releases are typically done rather ad-hoc. Let me Cc
>> Junio though so that he's aware that we might want to pick this if we
>> ever release v2.52.1.
>
> `RelNotes` says that this will be merged to `maint` later which points
> at tag v2.52.0 currently.
>
>      * "git last-modified" used to mishandle "--" to mark the beginning of
>        pathspec, which has been corrected.
>        (merge 05491b90ce js/last-modified-with-sparse-checkouts later to maint).

These are really "if we will produce a release out of 'maint', the
topics marked with these can cleanly be merged to be part of it",
and does not answer "if we ever have 2.52.1?" at all, though ;-)

I am on a bereavement leave now, so expect that my response will be
leaky and slow.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-last-modified on bare repository
  2026-01-07  0:01             ` Junio C Hamano
@ 2026-01-07 17:12               ` D. Ben Knoble
  0 siblings, 0 replies; 11+ messages in thread
From: D. Ben Knoble @ 2026-01-07 17:12 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Kristoffer Haugsbakk, Patrick Steinhardt, Gusted, git, Toon Claes

On Tue, Jan 6, 2026 at 7:01 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
>
> > On Tue, Jan 6, 2026, at 10:58, Patrick Steinhardt wrote:
> >> On Tue, Jan 06, 2026 at 10:42:55AM +0100, Gusted wrote:
> >>> On 1/5/26 4:17 PM, Patrick Steinhardt wrote:
> >>>>[snip]
> >>>
> >>> Yup, git from source works! Do you by any chance know if 05491b90ce is going
> >>> to be in v2.52.1?
> >>
> >> No idea, point releases are typically done rather ad-hoc. Let me Cc
> >> Junio though so that he's aware that we might want to pick this if we
> >> ever release v2.52.1.
> >
> > `RelNotes` says that this will be merged to `maint` later which points
> > at tag v2.52.0 currently.
> >
> >      * "git last-modified" used to mishandle "--" to mark the beginning of
> >        pathspec, which has been corrected.
> >        (merge 05491b90ce js/last-modified-with-sparse-checkouts later to maint).
>
> These are really "if we will produce a release out of 'maint', the
> topics marked with these can cleanly be merged to be part of it",
> and does not answer "if we ever have 2.52.1?" at all, though ;-)

Good to know; I'd had questions about that as well.

> I am on a bereavement leave now, so expect that my response will be
> leaky and slow.

Sorry to hear that. The only thing I know for sure is it gets easier with time.

-- 
D. Ben Knoble

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-last-modified on bare repository
  2026-01-05 15:03 ` Patrick Steinhardt
  2026-01-05 15:06   ` Gusted
  2026-01-05 15:17   ` Kristoffer Haugsbakk
@ 2026-01-12 15:15   ` Toon Claes
  2 siblings, 0 replies; 11+ messages in thread
From: Toon Claes @ 2026-01-12 15:15 UTC (permalink / raw)
  To: Gusted; +Cc: git, Patrick Steinhardt

Patrick Steinhardt <ps@pks.im> writes:

> On Mon, Jan 05, 2026 at 02:35:56PM +0100, Gusted wrote:
>> Because it was talking about revision, I quickly checked a refspec as input
>> and it looks like I found another way to trigger a BUG.
>> 
>> $ git last-modified -- HEAD:LICENSES
>> BUG: builtin/last-modified.c:456: paths remaining beyond boundary in
>> last-modified
>> [1]    202076 IOT instruction (core dumped)  git last-modified --
>> HEAD:LICENSES
>> 
>> On the bare and non-bare repository.
>
> This looks like a bug to me indeed. Cc'ing Toon.

Okay, there are various things going on.

First. If you do:

    $ git last-modified -- HEAD:LICENSES

On Git 2.52.0, then you're getting the BUG. On 'master' you'll get
simply no output.

But if you do:

    $ git last-modified HEAD:LICENSES

Then you actually trigger the same bug as you've reported before.
"HEAD:LICENSES" resolves to a tree oid. So that command is basically the
same as:

    $ git last-modified b79c618f6a11fc6f550dc98ef3227ef77b3132aa

In both situation you get a BUG. And I'm still working on a fix.

-- 
Cheers,
Toon

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-01-12 15:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 13:35 git-last-modified on bare repository Gusted
2026-01-05 15:03 ` Patrick Steinhardt
2026-01-05 15:06   ` Gusted
2026-01-05 15:17     ` Patrick Steinhardt
2026-01-06  9:42       ` Gusted
2026-01-06  9:58         ` Patrick Steinhardt
2026-01-06 10:54           ` Kristoffer Haugsbakk
2026-01-07  0:01             ` Junio C Hamano
2026-01-07 17:12               ` D. Ben Knoble
2026-01-05 15:17   ` Kristoffer Haugsbakk
2026-01-12 15:15   ` Toon Claes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox