Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

fixes the non-existing .git folder case #2053

Merged
merged 1 commit into from
Oct 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions buffalo/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,16 @@ func buildVersion(version string) string {
run.Logger.Warnf("could not find %s; defaulting to version %s", vcs, version)
return vcs
}

var cmd *exec.Cmd
switch vcs {
case "git":
// If .git folder does not exist return default version
if stat, err := os.Stat(".git"); err != nil || !stat.IsDir() {
run.Logger.Warnf("could not find .git folder; defaulting to version %s", version)
return version
}

cmd = exec.Command("git", "rev-parse", "--short", "HEAD")
case "bzr":
cmd = exec.Command("bzr", "revno")
Expand Down