summaryrefslogtreecommitdiff
path: root/doFix.deleteuser.go
diff options
context:
space:
mode:
Diffstat (limited to 'doFix.deleteuser.go')
-rw-r--r--doFix.deleteuser.go49
1 files changed, 0 insertions, 49 deletions
diff --git a/doFix.deleteuser.go b/doFix.deleteuser.go
index 6247be5..9d62a3c 100644
--- a/doFix.deleteuser.go
+++ b/doFix.deleteuser.go
@@ -334,52 +334,3 @@ func doFixDeleteLocalUserByMaster(repo *gitpb.Repo, localRef *gitpb.GitTag) (err
return log.Errorf("NOT SAFE"), notes
}
-
-// todo: these names are all horrible
-// delete localRef if it's completely contained in the masterRef
-func safeDelete(repo *gitpb.Repo, deleteHash string, keepHash string) error {
- // compare the branches
- hashok, hashbad, cmd1, cmd2, err := repo.CompareHashes(keepHash, deleteHash)
-
- if err != nil {
- // things are really really messed up. might be 'branchless' at this point (?)
- log.Printf("%-13.13s %-55.55s err='%v' %s %v\n", "CMD ERR", repo.FullPath, err, "NOT SAFE TO DELETE. Reload()?", cmd1)
- log.Printf("%-13.13s %-55.55s err='%v' %s %v\n", "CMD ERR", repo.FullPath, err, "NOT SAFE TO DELETE. Reload()?", cmd2)
- return err
- }
-
- // things only in the master branch (safe to ignore)
- for _, line := range hashok {
- parts := strings.Split(line, "%00") // git log doesn't actually convert %00 to NULL
- log.Printf("%-13.13s %-55.55s %v\n", "OK delete", repo.FullPath, parts)
- }
-
- if len(hashbad) > 0 {
- log.Printf("%-13.13s %-55.55s %v\n", "BAD cmd", repo.FullPath, cmd1)
- }
- // things still only in the local branch (bad to delete)
- for _, line := range hashbad {
- parts := strings.Split(line, "%00") // git log doesn't actually convert %00 to NULL
- log.Printf("%-13.13s %-55.55s %v\n", "BAD keep", repo.FullPath, parts)
- }
-
- if len(hashbad) == 0 {
- // todo: force checkout to local master branch
- // before doing this
- cmd := []string{"git", "update-ref", "-d", deleteHash}
- log.Printf("%-13.13s %-55.55s %v %s\n", "CMD OK", repo.FullPath, cmd1, "")
- log.Printf("%-13.13s %-55.55s %v %s\n", "CMD OK", repo.FullPath, cmd2, "")
- log.Printf("%-13.13s %-55.55s %v %s\n", "SAFE TO DELETE", repo.FullPath, cmd, "add --fix")
- if argv.Fix {
- err := repo.RunVerbose(cmd)
- if err != nil {
- log.Info(deleteHash, repo.FullPath)
- s := "local user branch could not be deleted"
- me.sh.BadExit(s, err)
- }
- }
- return ErrorNeedArgvFix
- }
-
- return log.Errorf("NOT SAFE")
-}