Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #151 from scorphus/master
Browse files Browse the repository at this point in the history
Set `repository:tempDir` as not mandatory (re #140)
  • Loading branch information
andrewsmedina committed Aug 14, 2014
2 parents 0399604 + b15ebe5 commit 571b2ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 2 additions & 7 deletions repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ import (
var tempDir string

func tempDirLocation() string {
if tempDir != "" {
return tempDir
}
var err error
tempDir, err = config.GetString("repository:tempDir")
if err != nil {
panic("You should configure a repository:tempDir for gandalf.")
if tempDir == "" {
tempDir, _ = config.GetString("repository:tempDir")
}
return tempDir
}
Expand Down
10 changes: 10 additions & 0 deletions repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ func (s *S) TestTempDirLocationDontResetTempDir(c *gocheck.C) {
c.Assert(tempDirLocation(), gocheck.Equals, "/var/folders")
}

func (s *S) TestTempDirLocationWhenNotInGandalfConf(c *gocheck.C) {
config.Unset("repository:tempDir")
oldTempDir := tempDir
tempDir = ""
defer func() {
tempDir = oldTempDir
}()
c.Assert(tempDirLocation(), gocheck.Equals, "")
}

func (s *S) TestNewShouldCreateANewRepository(c *gocheck.C) {
tmpdir, err := commandmocker.Add("git", "$*")
c.Assert(err, gocheck.IsNil)
Expand Down

0 comments on commit 571b2ac

Please sign in to comment.