aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository_test.go')
-rw-r--r--repository_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/repository_test.go b/repository_test.go
index d18816f..9e000a3 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -8,6 +8,7 @@ import (
"io"
"os"
"os/exec"
+ "os/user"
"path/filepath"
"regexp"
"strings"
@@ -543,6 +544,29 @@ func (s *RepositorySuite) TestPlainOpen(c *C) {
c.Assert(r, NotNil)
}
+func (s *RepositorySuite) TestPlainOpenTildePath(c *C) {
+ dir, clean := s.TemporalHomeDir()
+ defer clean()
+
+ r, err := PlainInit(dir, false)
+ c.Assert(err, IsNil)
+ c.Assert(r, NotNil)
+
+ currentUser, err := user.Current()
+ c.Assert(err, IsNil)
+ // remove domain for windows
+ username := currentUser.Username[strings.Index(currentUser.Username, "\\")+1:]
+
+ homes := []string{"~/", "~" + username + "/"}
+ for _, home := range homes {
+ path := strings.Replace(dir, strings.Split(dir, ".tmp")[0], home, 1)
+
+ r, err = PlainOpen(path)
+ c.Assert(err, IsNil)
+ c.Assert(r, NotNil)
+ }
+}
+
func (s *RepositorySuite) TestPlainOpenBare(c *C) {
dir, clean := s.TemporalDir()
defer clean()