aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--repo.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/repo.go b/repo.go
index dc61d01..d58eebb 100644
--- a/repo.go
+++ b/repo.go
@@ -104,7 +104,12 @@ type File struct {
}
func NewRepo(path string) *Repo {
- err := os.MkdirAll(path, 0775)
+ var err error
+ path, err = filepath.Abs(path)
+ if err != nil {
+ logger.Fatal(err)
+ }
+ err = os.MkdirAll(path, 0775)
if err != nil {
logger.Panic(err)
}
@@ -139,7 +144,10 @@ func (r *Repo) Patcher() Patcher {
}
func (r *Repo) Commit(source string) {
- source = utils.TrimTrailingSeparator(source)
+ source, err := filepath.Abs(source)
+ if err != nil {
+ logger.Fatal(err)
+ }
versions := r.loadVersions()
newVersion := len(versions) // TODO: add newVersion functino
newPath := filepath.Join(r.path, fmt.Sprintf(versionFmt, newVersion))