Skip to content

Commit

Permalink
Remove fossilfs storage backend
Browse files Browse the repository at this point in the history
  • Loading branch information
kpitt committed Sep 27, 2022
1 parent d14a65a commit 35242af
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 746 deletions.
30 changes: 4 additions & 26 deletions internal/action/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,6 @@ func (s *Action) Clone(c *cli.Context) error {
return s.cloneCheckDecryptionKeys(ctx, mount)
}

// storageBackendOrDefault will return a storage backend that can be clone,
// i.e. specifically backend.FS can't be cloned.
func storageBackendOrDefault(ctx context.Context, repo string) backend.StorageBackend {
// first try to get it from the context.
if be := backend.GetStorageBackend(ctx); be != backend.FS {
return be
}

if strings.HasSuffix(repo, ".fossil") {
return backend.FossilFS
}

if strings.HasSuffix(repo, ".git") {
return backend.GitFS
}

debug.Log("falling back to the default storage backend for clone (GitFS)")

return backend.GitFS
}

func (s *Action) clone(ctx context.Context, repo, mount, path string) error {
if path == "" {
path = config.PwStoreDir(mount)
Expand All @@ -135,9 +114,8 @@ func (s *Action) clone(ctx context.Context, repo, mount, path string) error {
}

// clone repo.
sb := storageBackendOrDefault(ctx, repo)
out.Noticef(ctx, "Cloning %s repository %q to %q...", sb, repo, path)
if _, err := backend.Clone(ctx, sb, repo, path); err != nil {
out.Noticef(ctx, "Cloning repository %q to %q...", repo, path)
if _, err := backend.Clone(ctx, backend.GitFS, repo, path); err != nil {
return exit.Error(exit.Git, err, "failed to clone repo %q to %q: %s", repo, path, err)
}

Expand All @@ -153,7 +131,7 @@ func (s *Action) clone(ctx context.Context, repo, mount, path string) error {
}

// try to init repo config.
out.Noticef(ctx, "Configuring %s repository...", sb)
out.Noticef(ctx, "Configuring Git repository...")

// ask for config values.
username, email, err := s.cloneGetGitConfig(ctx, mount)
Expand All @@ -164,7 +142,7 @@ func (s *Action) clone(ctx context.Context, repo, mount, path string) error {
// initialize repo config.
if err := s.Store.RCSInitConfig(ctx, mount, username, email); err != nil {
debug.Log("Stacktrace: %+v\n", err)
out.Errorf(ctx, "Failed to configure %s: %s", sb, err)
out.Errorf(ctx, "Failed to configure Git: %s", err)
}

if mount != "" {
Expand Down
1 change: 0 additions & 1 deletion internal/action/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ func (s *Action) initLocal(ctx context.Context) error {
}
}
}
// TODO remotes for fossil, etc.

// save config.
if err := s.cfg.Save(); err != nil {
Expand Down
2 changes: 0 additions & 2 deletions internal/backend/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ const (
FS StorageBackend = iota
// GitFS is a filesystem-backed storage with Git.
GitFS
// FossilFS is a filesystem-backed storage with Fossil.
FossilFS
)

func (s StorageBackend) String() string {
Expand Down
3 changes: 0 additions & 3 deletions internal/backend/storage/fossilfs.go

This file was deleted.

21 changes: 0 additions & 21 deletions internal/backend/storage/fossilfs/context.go

This file was deleted.

Loading

0 comments on commit 35242af

Please sign in to comment.