1
0
Fork 0
forked from forgejo/forgejo
This commit is contained in:
Unknwon 2014-10-06 17:50:00 -04:00
parent 91e5c24a31
commit 64c68220d2
18 changed files with 317 additions and 19 deletions

View file

@ -7,6 +7,7 @@ package git
import (
"bytes"
"container/list"
"os"
"path/filepath"
"strings"
)
@ -46,3 +47,23 @@ func RefEndName(refStr string) string {
func filepathFromSHA1(rootdir, sha1 string) string {
return filepath.Join(rootdir, "objects", sha1[:2], sha1[2:])
}
// isDir returns true if given path is a directory,
// or returns false when it's a file or does not exist.
func isDir(dir string) bool {
f, e := os.Stat(dir)
if e != nil {
return false
}
return f.IsDir()
}
// isFile returns true if given path is a file,
// or returns false when it's a directory or does not exist.
func isFile(filePath string) bool {
f, e := os.Stat(filePath)
if e != nil {
return false
}
return !f.IsDir()
}