Skip to content

Commit b8c9d17

Browse files
feat: 🔧 control including wiki for backups via option in config file
1 parent 159a628 commit b8c9d17

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed

cmd/root.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var rootCmd = &cobra.Command{
4747
IncludeOrgs: []string{},
4848
ExcludeOrgs: []string{},
4949
IncludeForks: false,
50+
IncludeWiki: true,
5051
Workspace: "",
5152
Cron: "",
5253
BackupDir: config.GetBackupDir(backupDir),

pkg/bitbucket/bitbucket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (c BitbucketClient) Sync(cfg config.Config) error {
4040
defer wg.Done()
4141
sem <- struct{}{}
4242
gitSync.CloneOrUpdateRepo(cfg.Workspace, repo.Name, cfg)
43-
if repo.Has_wiki {
43+
if cfg.IncludeWiki && repo.Has_wiki {
4444
gitSync.SyncWiki(cfg.Workspace, repo.Name, cfg)
4545
}
4646
<-sem

pkg/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type Config struct {
2424
IncludeOrgs []string `mapstructure:"include_orgs"`
2525
ExcludeOrgs []string `mapstructure:"exclude_orgs"`
2626
IncludeForks bool `mapstructure:"include_forks"`
27+
IncludeWiki bool `mapstructure:"include_wiki"`
2728
BackupDir string `mapstructure:"backup_dir"`
2829
Workspace string `mapstructure:"workspace"`
2930
Cron string `mapstructure:"cron"`
@@ -98,6 +99,7 @@ func SaveConfig(config Config, cfgFile string) error {
9899
viper.Set("include_orgs", config.IncludeOrgs)
99100
viper.Set("exclude_orgs", config.ExcludeOrgs)
100101
viper.Set("include_forks", config.IncludeForks)
102+
viper.Set("include_wiki", config.IncludeWiki)
101103
viper.Set("backup_dir", config.BackupDir)
102104
viper.Set("platform", config.Platform)
103105
viper.Set("server", config.Server)

pkg/github/github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (c GitHubClient) Sync(cfg config.Config) error {
4949
defer wg.Done()
5050
sem <- struct{}{}
5151
gitSync.CloneOrUpdateRepo(repo.GetOwner().GetLogin(), repo.GetName(), cfg)
52-
if repo.GetHasWiki() {
52+
if cfg.IncludeWiki && repo.GetHasWiki() {
5353
gitSync.SyncWiki(repo.GetOwner().GetLogin(), repo.GetName(), cfg)
5454
}
5555
<-sem

pkg/gitlab/gitlab.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (c GitlabClient) Sync(cfg config.Config) error {
4242
defer wg.Done()
4343
sem <- struct{}{}
4444
gitSync.CloneOrUpdateRepo(project.Namespace.FullPath, project.Path, cfg)
45-
if project.WikiEnabled {
45+
if cfg.IncludeWiki && project.WikiEnabled {
4646
gitSync.SyncWiki(project.Namespace.FullPath, project.Path, cfg)
4747
}
4848
<-sem

0 commit comments

Comments
 (0)