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