package gitpb import ( "fmt" "path/filepath" ) /* func (repo *Repo) DeleteLocalTag(t *GitTag) bool { b1, err := repo.CountDiffObjects(branch, remote) // should be zero if err != nil { return err } if b1 == 0 { cmd := []string{"git", "branch", "-D", repo.GetDevelBranchName()} _, err := repo.RunVerboseOnError(cmd) return err } else { return fmt.Errorf("local branch has patches not in remote") } } */ // deletes the devel local branch if it is a subset of the remote devel branch func (repo *Repo) DeleteLocalBranch(branch string) ([]string, error) { remote := filepath.Join("origin", branch) if !repo.IsBranchRemote(branch) { return nil, fmt.Errorf("no remote branch") } b1, _, err := repo.CountDiffObjectsNEWNEW(branch, remote) // should be zero if err != nil { return nil, err } if len(b1) == 0 { // log.Info("SAFE TO DELETE?") /* cmd := []string{"git", "branch", "-D", repo.GetDevelBranchName()} _, err := repo.RunVerboseOnError(cmd) */ return nil, nil } // log.Info("LOCAL NOT SAFE TO DELETE", repo.FullPath) return b1, fmt.Errorf("local branch has patches not in remote") } // deletes the devel local branch if it is a subset of the remote devel branch func (repo *Repo) DeleteLocalDevelBranch() error { branch := repo.GetDevelBranchName() remote := filepath.Join("origin", branch) if !repo.IsDevelRemote() { return fmt.Errorf("no remote branch") } b1, err := repo.CountDiffObjects(branch, remote) // should be zero if err != nil { return err } if b1 == 0 { cmd := []string{"git", "branch", "-D", repo.GetDevelBranchName()} _, err := repo.RunVerboseOnError(cmd) return err } else { return fmt.Errorf("local branch has patches not in remote") } }