This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Closed
Description
Currently, our main way to access all commits is CommitObjects
, which iterates all commits in a repository, no matter if they are reachable from references or not. This leads to two problems:
- It is sometimes confusing to iterate over dangling commits. These are very frequent on local repositories that have been subject to local work, rebases, etc. In git, it is pretty hard to iterate over dangling commits. AFAIK there is no porcelain command exposing all of them together (
git reflog
exposes some of them from reflog, git verify-pack exposes them in packfiles, etc). - On large repositories, iterating over all commits is significantly slower than getting all reachable commits. The former requires decoding all object headers in every packfile, which on large repositories is slower than just traversing history from all references.
Changing CommitObjects
behaviour would not be backwards compatible, but we could expose an equivalent to git log --all
in Repository.Log
by adding an All bool
option, which would return an iterator over all commits reachable from any reference.
Lines 323 to 338 in 7853ab6
We would then add a note to CommitObjects
godoc, since users will usually want to use Log
instead.