git-last-modified on bare repository
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
Quoted 22 lines · Gusted
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 LICENSESAnd 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>...]'
Quoted 1 line
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.
Quoted 10 lines
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:LICENSESOn the bare and non-bare repository.
This looks like a bug to me indeed. Cc'ing Toon.
Thanks!
Patrick
Quoted 23 lines · Patrick Steinhardt
Quoted 22 lines · Gusted
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 LICENSESAnd 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>...]'
Quoted 6 lines
Quoted 1 line
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>...]'
Quoted 9 lines
Quoted 9 lines
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
Quoted 7 lines
Quoted 1 line
On the bare and non-bare repository.
This looks like a bug to me indeed. Cc'ing Toon.
Thanks!
Patrick
Kind Regards
Gusted
Quoted 31 lines · Gusted
Quoted 23 lines · Patrick Steinhardt
Quoted 22 lines · Gusted
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 LICENSESAnd 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>...]'Quoted 6 lines
Quoted 1 line
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.
Quoted 8 lines
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
Quoted 41 lines · Patrick Steinhardt
Quoted 31 lines · Gusted
Quoted 23 lines · Patrick Steinhardt
Quoted 22 lines · Gusted
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 LICENSESAnd 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>...]'Quoted 6 lines
Quoted 1 line
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.
Quoted 8 lines
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>...]'
Quoted 6 lines
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
Quoted 47 lines · Gusted
Quoted 46 lines · Patrick Steinhardt
Quoted 31 lines · Gusted
Quoted 23 lines · Patrick Steinhardt
Quoted 22 lines · Gusted
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 LICENSESAnd 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>...]'Quoted 6 lines
Quoted 1 line
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.
Quoted 8 lines
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.
Quoted 4 lines
Quoted 1 line
Patrick
Yup, git from source works! Do you by any chance know if
05491b90ceis 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
Quoted 10 lines · Patrick Steinhardt
Quoted 5 lines · Gusted
Quoted 1 line · Patrick Steinhardt
[snip]
Yup, git from source works! Do you by any chance know if
05491b90ceis 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).
Quoted 12 lines · Kristoffer Haugsbakk
Quoted 10 lines · Patrick Steinhardt
Quoted 5 lines · Gusted
Quoted 1 line · Patrick Steinhardt
[snip]
Yup, git from source works! Do you by any chance know if
05491b90ceis 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.
Quoted 6 lines
RelNotessays that this will be merged tomaintlater which points at tag v2.52.0 currently.* "git last-modified" used to mishandle "--" to mark the beginning of pathspec, which has been corrected.
(merge05491b90cejs/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.
Quoted 18 lines · Junio C Hamano
Quoted 15 lines · Kristoffer Haugsbakk
Quoted 10 lines · Patrick Steinhardt
Quoted 5 lines · Gusted
Quoted 1 line · Patrick Steinhardt
[snip]
Yup, git from source works! Do you by any chance know if
05491b90ceis 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.
RelNotessays that this will be merged tomaintlater which points at tag v2.52.0 currently.
Quoted 7 lines
Quoted 3 lines
* "git last-modified" used to mishandle "--" to mark the beginning of pathspec, which has been corrected.
(merge05491b90cejs/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.
Quoted 2 lines
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.
Signature · 1 line
D. Ben Knoble
Quoted 23 lines · Patrick Steinhardt
Quoted 22 lines · Gusted
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 LICENSESAnd 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>...]'
Quoted 5 lines
Quoted 1 line
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.
Quoted 10 lines · Patrick Steinhardt
Quoted 9 lines · Gusted
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
Quoted 3 lines
Quoted 1 line
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.
Signature · 2 lines
Cheers, Toon