// commitFiles adds file information to commit func commitFiles(commit *meta.Commit, repo *meta.Repo, files map[string]int) { // Preallocation is the way to go commit.File = make([]meta.File, 0, len(files)) for key, value := range files { if value == status.UNTRACKED || value == status.REMOVED { continue } s, err := crypto.SHA512(key) if err != nil { panic(err) } commit.File = append(commit.File, meta.File{xml.Name{"", "FILE"}, s, key}) } }