Exemplo n.º 1
0
// TemoraryCsvPath returns the repository's path to the temp folder.
func TemporaryCsvPath(r *git.Repository) (string, error) {
	// Create unique csv file name through path.
	fileName := strings.Replace(r.Path(), "/", "_", -1)
	var buffer bytes.Buffer
	// Current path
	currentPath, err := os.Getwd()
	if err != nil {
		return "", err
	}
	buffer.WriteString(currentPath)
	buffer.WriteString("/tmp/")
	buffer.WriteString(fileName)
	buffer.WriteString(".csv")
	return buffer.String(), nil
}
Exemplo n.º 2
0
func nukeRepo(repo *git.Repository) {
	repo.Free()
	os.RemoveAll(repo.Path())
}