Re: [PATCH RFC v2 0/5] Introduce git-last-modified(1) command
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 1, 2025, 21:06 UTC
- Message-ID
- <xmqq5xgbk4d2.fsf@gitster.g>
- In-Reply-To
- <f0c508cc-5c6b-4c4b-a3f3-0cdd8d1071e5@app.fastmail.com>
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
Show 8 quoted lines
> It feels like the command strays a bit from the usual patterns to me. For paths/files > that is. I like this: > > ``` > $ git last-modified -r refs.c refs.h > 062b914c841329a003f74e1340ea5178391274a6 refs.c > 47478802daddf3f9916111307f153c6298ffc0bc refs.h > ```
I am not getting this example. Unless "-r" stands for "reverse", the above looks totally expected.
Show 10 quoted lines
> I ask for two files and I get those in the output. > > But for individual files in subdirectories: > > ``` > $ git last-modified refs.c refs.h Documentation/git-last-modified.adoc Documentation/git-config.adoc > 3691fe72d927658ae77ade7fe967544fc6739e67 Documentation > 062b914c841329a003f74e1340ea5178391274a6 refs.c > 47478802daddf3f9916111307f153c6298ffc0bc refs.h > ```
I am indifferent with this outcome. I do not mind the tool giving Documentation/ even when paths inside it are asked about, when it is not asked to go recursive.
Show 10 quoted lines
> Same as if I ask for `Documentation`: > > ``` > $ git last-modified refs.c refs.h Documentation/ > 3691fe72d927658ae77ade7fe967544fc6739e67 Documentation > 062b914c841329a003f74e1340ea5178391274a6 refs.c > 47478802daddf3f9916111307f153c6298ffc0bc refs.h > ``` > > But I didn’t ask for the directory first. I asked for two files.
I do not see anything unexpected. Have you seen "git ls-tree" output without -r(ecursive) before?
$ git ls-tree HEAD refs.c refs.h Documentation
040000 tree a0f7113f63a19b70dff14bfd9f8f82809f5068e1 Documentation
100644 blob dce5c49ca2ba65fd6a2974e38f67134215bee369 refs.c
100644 blob 46a6008e07f2624239139cd8b2ff712545f07d3f refs.hAs I understand that this tool was written primarily to implement scripts like repository browsers showing https://github.com/git/git I do not mind non-recursive behaviour being the default. After all I view it as a plumbing.
Show 12 quoted lines
> I have to use `-r` (recurse): > > ``` > $ git last-modified -r refs.c refs.h Documentation/git-last-modified.adoc Documentation/git-config.adoc > 3691fe72d927658ae77ade7fe967544fc6739e67 Documentation/git-last-modified.adoc > 062b914c841329a003f74e1340ea5178391274a6 refs.c > 47478802daddf3f9916111307f153c6298ffc0bc refs.h > 0fbe93b36c05bbf4156c157f27998938ce312265 Documentation/git-config.adoc > ``` > > And `-r` with a directory like `Documentation` will recurse through that > directory.
Totally expected.