Skip to content

Commit ed1b3fc

Browse files
committed
Fix git local dir on relative paths
Since we launched the git command with .Cwd configured to the target directory, we were creating nested paths when passed relative --local-dir. While at it, reference the brew formula.
1 parent 47d8d87 commit ed1b3fc

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ ready to run on your desktop or in a cluster.
100100

101101
We also provide a [docker image](https://hub.docker.com/r/bpineau/katafygio/).
102102

103+
On MacOs, you can use the brew formula:
104+
```bash
105+
brew install bpineau/tap/katafygio
106+
```
107+
103108
You can also deploy with the provided [helm](https://helm.sh/) chart:
104109
```shell
105110
helm install --name kf-backups --namespace kube-system assets/helm-chart/katafygio/

pkg/store/git/git.go

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"os"
77
"os/exec"
8+
"path/filepath"
89
"time"
910

1011
"github.com/spf13/afero"
@@ -145,6 +146,11 @@ func (s *Store) Status() (changed bool, err error) {
145146
// CloneOrInit create a new local repository, either with "git clone" (if a GitURL
146147
// to clone from is provided), or "git init" (in the absence of GitURL).
147148
func (s *Store) CloneOrInit() (err error) {
149+
s.LocalDir, err = filepath.Abs(s.LocalDir)
150+
if err != nil {
151+
return fmt.Errorf("can't find local dir absolute path (broken cwd?): %v", err)
152+
}
153+
148154
if !s.DryRun {
149155
err = appFs.MkdirAll(s.LocalDir, 0700)
150156
if err != nil {

0 commit comments

Comments
 (0)