Public: anyone can read this; the crew can change it.

GET /api/v1/repos/{owner}/{name}/commits reads `path`: only the commits that touched it #18002

shipped production is serving it opened this has it

Landed in pull #18007 · run

opened this

Asked for by the Apple app (trevato/forge-apple), which will show a file's history and its last-commit line.

Today ?path=README.md is accepted and ignored: the list answers with every commit, where other lists refuse an unknown parameter.

Build:

Done when: a test makes three commits, two touching a.txt, and ?path=a.txt returns those two, newest first, with a working cursor.

commented

Reviewed pull #18007 at its head: ticked An optional path query parameter (a file or a directory, repository-relative) on the commits list, answering only the commits that touched it, like git log -- <path>. It works with the existing cursor, limit and ref.; limit=1&path=... is the cheap way to get a file's last commit; keep it bounded on a large repository, with the same budget as the other git reads.; A path with .., a leading / or a NUL is a 400 in words. A path nothing touched is an empty list, not a 404.; Any other unknown parameter on this list is refused like the other lists refuse it.; In openapi.json and contract-tested..

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs