summaryrefslogtreecommitdiff
path: root/doClean.go
blob: 11e4b7e62b8f2bdebcd7c1ce4a78fa033aba845d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main

import (
	"fmt"

	"go.wit.com/lib/protobuf/gitpb"
	"go.wit.com/log"
)

func doClean() error {
	all := me.forge.Repos.SortByFullPath()
	for all.Scan() {
		repo := all.Next()
		if err := doCleanRepo(repo); err != nil {
			badExit(err)
		}
	}
	return nil
}

func doCleanRepo(repo *gitpb.Repo) error {
	log.Info("Cleaning:", repo.GetGoPath())
	if repo.GitConfig == nil {
		return fmt.Errorf("GitConfig == nil")
	}

	for _, l := range repo.GitConfig.Local {
		log.Info("\tlocal branch name:", l.Name)
	}

	for name, b := range repo.GitConfig.Branches {
		log.Info("\tlocal branch name:", name, b.Merge, b.Remote)
	}
	return nil
}