Skip to content

Commit

Permalink
Merge pull request #2 from driusan/v0.3-dev
Browse files Browse the repository at this point in the history
V0.3.1 Release
  • Loading branch information
driusan committed Jan 16, 2016
2 parents 2d2d793 + e0da760 commit f0433ab
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
5 changes: 3 additions & 2 deletions bugapp/Commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (
func Commit(args ArgumentList) {
options := make(map[string]bool)
if !args.HasArgument("--no-autoclose") {
options["autoclose"] = false
} else {
options["autoclose"] = true
} else {
options["autoclose"] = false
}

scm, _, err := scm.DetectSCM(options)
if err != nil {
fmt.Printf("Error: %s\n", err.Error())
Expand Down
2 changes: 1 addition & 1 deletion bugapp/Version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import (
)

func Version() {
fmt.Printf("%s version 0.3-dev\n", os.Args[0])
fmt.Printf("%s version 0.3.1\n", os.Args[0])

}
2 changes: 1 addition & 1 deletion scm/GitManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (a GitManager) getDeletedIdentifiers(dir bugs.Directory) []string {
continue
}
if file[0:1] == "D" && strings.HasSuffix(file, "Identifier") {
ghRegex := regexp.MustCompile("-Github:(\\s*)(.*)")
ghRegex := regexp.MustCompile("(?im)^-Github:(\\s*)(.*)(\\s*)$^")
diff := exec.Command("git", "diff", "--staged", "--", file[3:])
diffout, _ := diff.CombinedOutput()
if matches := ghRegex.FindStringSubmatch(string(diffout)); len(matches) > 2 {
Expand Down
15 changes: 10 additions & 5 deletions scm/GitManager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,8 @@ func (m GitTester) GetManager() SCMHandler {
}

func TestGitBugRenameCommits(t *testing.T) {
if os.Getenv("TRAVIS") == "true" {
// I think this is related to the version of git installed
// on Travis, but the apt add-on won't let us install a newer
// version to test. For now, this test gets skipped.
t.Skip("Test failing under Travis for unknown reasons.")
if os.Getenv("TRAVIS") == "true" && os.Getenv("TRAVIS_OS_NAME") == "linux" {
t.Skip("Skipping test which fails only under Travis for unknown reasons..")
return
}
gm := GitTester{}
Expand Down Expand Up @@ -139,3 +136,11 @@ func TestGitFilesOutsideOfBugNotCommited(t *testing.T) {
gm.handler = GitManager{}
runtestCommitDirtyTree(&gm, t)
}

func TestGitManagerGetType(t *testing.T) {
manager := GitManager{}

if getType := manager.GetSCMType(); getType != "git" {
t.Error("Incorrect SCM Type for GitManager. Got " + getType)
}
}
11 changes: 6 additions & 5 deletions scm/TestHelpers_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package scm

import (
"fmt"
"github.com/driusan/bug/bugs"
"io/ioutil"
"os"
Expand Down Expand Up @@ -58,6 +59,7 @@ func assertLogs(tester ManagerTester, t *testing.T, titles []string, diffs []str
} else {
if diff != diffs[i] {
t.Error("Incorrect diff for " + titles[i])
fmt.Fprintf(os.Stderr, "Got %s, expected %s", diff, diffs[i])
}
}
}
Expand All @@ -68,7 +70,6 @@ func runtestRenameCommitsHelper(tester ManagerTester, t *testing.T, expectedDiff
defer tester.TearDown()
if err != nil {
t.Error("Could not initialize repo")
panic("Something went wrong trying to initialize git:" + err.Error())
return
}

Expand All @@ -77,10 +78,10 @@ func runtestRenameCommitsHelper(tester ManagerTester, t *testing.T, expectedDiff
t.Error("Could not get manager")
return
}
os.Mkdir("issues", 0755)
runCmd("bug", "create", "-n", "Test bug")
os.MkdirAll("issues/Test-bug", 0755)
ioutil.WriteFile("issues/Test-bug/Description", []byte(""), 0644)
m.Commit(bugs.Directory(tester.GetWorkDir()), "Initial commit")
runCmd("bug", "relabel", "1", "Renamed bug")
runCmd("bug", "relabel", "1", "Renamed", "bug")
m.Commit(bugs.Directory(tester.GetWorkDir()), "This is a test rename")

tester.AssertCleanTree(t)
Expand All @@ -100,7 +101,7 @@ func runtestCommitDirtyTree(tester ManagerTester, t *testing.T) {
return
}
os.Mkdir("issues", 0755)
runCmd("bug", "create", "-n", "Test bug")
runCmd("bug", "create", "-n", "Test", "bug")
if err = ioutil.WriteFile("donotcommit.txt", []byte(""), 0644); err != nil {
t.Error("Could not write file")
return
Expand Down

0 comments on commit f0433ab

Please sign in to comment.