diff options
author | Paulo Gomes <pjbgf@linux.com> | 2023-07-08 12:34:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-08 12:34:25 +0100 |
commit | dc17aae6503560777a665c9cfb0d2fcb3a9a9274 (patch) | |
tree | d7235df1afd2959f3fb5e9dc122424887b620bbc /common_test.go | |
parent | 7e143ceb36ed6d46462f3c37f07993f9a10f91e3 (diff) | |
parent | a9a658ee4ecb0c2f0fcb1962b7c6a408a8116309 (diff) | |
download | go-git-dc17aae6503560777a665c9cfb0d2fcb3a9a9274.tar.gz |
Merge pull request #808 from ricci2511/plainopen-tilde-path-fix
*: Handle 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, "", "") |