Exemplo n.º 1
0
//Commit will add and commit the given entry into the repository that lays unter
//the given datadir.
func Commit(datadir string, project data.ProjectName, entry data.Entry) error {
	err := gitAdd(datadir, ".")
	if err != nil {
		return errgo.Notef(err, "can not add file to repository")
	}

	message := project.String() + " - " + entry.Type().String() + " - " +
		entry.GetTimeStamp().Format(data.TimeStampFormat)

	err = gitCommit(datadir, message)
	if err != nil {
		return errgo.Notef(err, "can not commit file to repository")
	}

	return nil
}