Beispiel #1
0
func Log(repo *libgit.Repository, args []string) error {
	if len(args) != 0 {
		fmt.Fprintf(os.Stderr, "Usage: go-git log\nNo options are currently supported.\n")
		return errors.New("No options are currently supported for log")
	}
	head, err := getHeadId(repo)
	if err != nil {
		return err
	}

	// CommitsBefore also returns the commit passed..
	l, err := repo.CommitsBefore(head)
	if err != nil {
		return err
	}
	for e := l.Front(); e != nil; e = e.Next() {
		c, ok := e.Value.(*libgit.Commit)
		if ok {
			printCommit(c)
		}
	}
	return nil

}