conf: overhaul repository settings (#5932)

This commit is contained in:
ᴜɴᴋɴᴡᴏɴ
2020-02-22 15:22:32 +08:00
committed by GitHub
parent f59a68c531
commit c4a0a40473
23 changed files with 183 additions and 176 deletions

View File

@@ -5,6 +5,7 @@
package conf
import (
"path/filepath"
"strings"
"github.com/pkg/errors"
@@ -25,3 +26,11 @@ func openSSHVersion() (string, error) {
v = strings.TrimSuffix(strings.TrimPrefix(v, "OpenSSH_"), "p")
return v, nil
}
// ensureAbs prepends the WorkDir to the given path if it is not an absolute path.
func ensureAbs(path string) string {
if filepath.IsAbs(path) {
return path
}
return filepath.Join(WorkDir(), path)
}