MCPcopy Index your code
hub / github.com/go-git/go-git / Log

Method Log

repository.go:1248–1282  ·  view source on GitHub ↗

Log returns the commit history from the given LogOptions.

(o *LogOptions)

Source from the content-addressed store, hash-verified

1246
1247// Log returns the commit history from the given LogOptions.
1248func (r *Repository) Log(o *LogOptions) (object.CommitIter, error) {
1249 fn := commitIterFunc(o.Order)
1250 if fn == nil {
1251 return nil, fmt.Errorf("invalid Order=%v", o.Order)
1252 }
1253
1254 var (
1255 it object.CommitIter
1256 err error
1257 )
1258 if o.All {
1259 it, err = r.logAll(fn)
1260 } else {
1261 it, err = r.log(o.From, fn)
1262 }
1263
1264 if err != nil {
1265 return nil, err
1266 }
1267
1268 if o.FileName != nil {
1269 // for `git log --all` also check parent (if the next commit comes from the real parent)
1270 it = r.logWithFile(*o.FileName, it, o.All)
1271 }
1272 if o.PathFilter != nil {
1273 it = r.logWithPathFilter(o.PathFilter, it, o.All)
1274 }
1275
1276 if o.Since != nil || o.Until != nil {
1277 limitOptions := object.LogLimitOptions{Since: o.Since, Until: o.Until}
1278 it = r.logWithLimit(it, limitOptions)
1279 }
1280
1281 return it, nil
1282}
1283
1284func (r *Repository) log(from plumbing.Hash, commitIterFunc func(*object.Commit) object.CommitIter) (object.CommitIter, error) {
1285 h := from

Callers 15

TestCloneMirrorMethod · 0.80
TestLogMethod · 0.80
TestLogAllMethod · 0.80
TestLogAllOrderByTimeMethod · 0.80
TestLogHeadMethod · 0.80
TestLogErrorMethod · 0.80
TestLogFileNextMethod · 0.80
TestLogFileForEachMethod · 0.80
TestLogNonHeadFileMethod · 0.80
TestLogAllFileForEachMethod · 0.80

Calls 6

logAllMethod · 0.95
logMethod · 0.95
logWithFileMethod · 0.95
logWithPathFilterMethod · 0.95
logWithLimitMethod · 0.95
commitIterFuncFunction · 0.85

Tested by 15

TestCloneMirrorMethod · 0.64
TestLogMethod · 0.64
TestLogAllMethod · 0.64
TestLogAllOrderByTimeMethod · 0.64
TestLogHeadMethod · 0.64
TestLogErrorMethod · 0.64
TestLogFileNextMethod · 0.64
TestLogFileForEachMethod · 0.64
TestLogNonHeadFileMethod · 0.64
TestLogAllFileForEachMethod · 0.64