You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
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.
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:git reflog
exposes some of them from reflog, git verify-pack exposes them in packfiles, etc).Changing
CommitObjects
behaviour would not be backwards compatible, but we could expose an equivalent togit log --all
inRepository.Log
by adding anAll bool
option, which would return an iterator over all commits reachable from any reference.go-git/options.go
Lines 323 to 338 in 7853ab6
We would then add a note to
CommitObjects
godoc, since users will usually want to useLog
instead.The text was updated successfully, but these errors were encountered: