Skip to content

Commit

Permalink
Merge pull request #44 from dpaz/issue43
Browse files Browse the repository at this point in the history
Solved the issue #43
  • Loading branch information
mcuadros authored Jun 20, 2017
2 parents 91cee51 + 17a6f3d commit 6a4eb75
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/code-generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const (
frequenciesTmplPath = "internal/code-generator/assets/frequencies.go.tmpl"
frequenciesTmpl = "frequencies.go.tmpl"

commitPath = ".linguist/.git/refs/heads/master"
commitPath = ".linguist/.git/HEAD"
)

type generatorFiles struct {
Expand Down Expand Up @@ -106,5 +106,15 @@ func getCommit(path string) (string, error) {
return "", err
}

if string(commit) == "ref: refs/heads/master\n" {
path = ".linguist/.git/" + string(commit[5:len(commit)-1])
commit, err := ioutil.ReadFile(path)
if err != nil {
return "", err
}

return string(commit), nil
}

return string(commit), nil
}

0 comments on commit 6a4eb75

Please sign in to comment.