summaryrefslogtreecommitdiff
path: root/doClean.go
diff options
context:
space:
mode:
Diffstat (limited to 'doClean.go')
-rw-r--r--doClean.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/doClean.go b/doClean.go
index cfe5b19..0717ad6 100644
--- a/doClean.go
+++ b/doClean.go
@@ -56,17 +56,21 @@ func doCleanRepo(repo *gitpb.Repo) error {
// todo: make sure the master branch is in sync with remote master
continue
}
- hasLocal = true
if name == repo.GetUserBranchName() {
+ hasLocal = true
if err := doCleanUserBranch(repo, b); err != nil {
+ log.Info("\tLOCAL BRANCH ERROR user")
return err
}
+ log.Info("\tLOCAL BRANCH user")
continue
}
if name == repo.GetDevelBranchName() {
if err := doCleanDevelBranch(repo, b); err != nil {
+ log.Info("\tLOCAL BRANCH ERROR devel")
return err
}
+ log.Info("\tLOCAL BRANCH devel")
continue
}
log.Info("\tlocal branch name unknown:", name, b.Merge, b.Remote)
@@ -120,6 +124,18 @@ func doCleanUserBranch(repo *gitpb.Repo, branch *gitpb.GitBranch) error {
repo.RunVerbose([]string{"ls", "-l", ".git/refs/remotes/origin"})
repo.RunVerbose([]string{"cat", filepath.Join(".git/refs/remotes/origin", branch.Name)})
repo.RunVerbose([]string{"cat", filepath.Join(".git/refs/heads", branch.Name)})
+ if err := userToDevelRequiresGitPush(repo, branch.Name); err != nil {
+ log.Info(err)
+ log.Info("THIS USER BRANCH MUST BE PUSHED TO DEVEL", branch.Name)
+ return err
+ }
+ log.Info("THIS USER BRANCH IS CLEAN TO DELETE", branch.Name)
+ if argv.Clean.Force != nil {
+ cmd := []string{"git", "branch", "-D", branch.Name}
+ _, err := repo.RunVerbose(cmd)
+ log.Info(err)
+ return err
+ }
} else {
log.Info("why is this local only branch a problem?", branch.Name)
repo.RunVerbose([]string{"ls", "-l", ".git/refs/remotes/origin"})
@@ -130,12 +146,15 @@ func doCleanUserBranch(repo *gitpb.Repo, branch *gitpb.GitBranch) error {
log.Info(cmd)
}
if err := userToDevelRequiresGitPush(repo, branch.Name); err != nil {
+ log.Info(err)
+ log.Info("THIS USER BRANCH MUST BE PUSHED TO DEVEL", branch.Name)
return err
}
log.Info("THIS USER BRANCH IS CLEAN TO DELETE", branch.Name)
if argv.Clean.Force != nil {
cmd := []string{"git", "branch", "-D", branch.Name}
_, err := repo.RunVerbose(cmd)
+ log.Info(err)
return err
}
}