diff options
author | ricci2511 <ricardo.christmann@protonmail.com> | 2023-07-07 14:44:54 +0200 |
---|---|---|
committer | ricci2511 <ricardo.christmann@protonmail.com> | 2023-07-07 14:44:54 +0200 |
commit | a9a658ee4ecb0c2f0fcb1962b7c6a408a8116309 (patch) | |
tree | 6830c423805028118a4a273ef08005590c9aa77c /common_test.go | |
parent | 252b5d240274e99eec8a63e4906b54f097c5f693 (diff) | |
download | go-git-a9a658ee4ecb0c2f0fcb1962b7c6a408a8116309.tar.gz |
*: Add test for paths starting with tilde
Diffstat (limited to 'common_test.go')
-rw-r--r-- | common_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/common_test.go b/common_test.go index 7f9b84b..ff4d6b8 100644 --- a/common_test.go +++ b/common_test.go @@ -151,6 +151,26 @@ func (s *BaseSuite) TemporalDir() (path string, clean func()) { return } +func (s *BaseSuite) TemporalHomeDir() (path string, clean func()) { + home, err := os.UserHomeDir() + if err != nil { + panic(err) + } + + fs := osfs.New(home) + relPath, err := util.TempDir(fs, "", "") + if err != nil { + panic(err) + } + + path = fs.Join(fs.Root(), relPath) + clean = func() { + _ = util.RemoveAll(fs, relPath) + } + + return +} + func (s *BaseSuite) TemporalFilesystem() (fs billy.Filesystem, clean func()) { fs = osfs.New(os.TempDir()) path, err := util.TempDir(fs, "", "") |