From c7c54de39149e07c5cb03e8d8aa49793f32047de Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 6 Oct 2025 04:27:49 -0500 Subject: cleanup code further --- compare.go | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'compare.go') diff --git a/compare.go b/compare.go index ed362f7..c0452eb 100644 --- a/compare.go +++ b/compare.go @@ -2,8 +2,6 @@ package gitpb import ( "fmt" - - "go.wit.com/log" ) type RepoTag struct { @@ -32,25 +30,34 @@ func (r *Repo) NewCompareRef(t *GitTag) *RepoTag { return rt } -func (t1 *RepoTag) DeleteBranch(t2 *RepoTag) ([]string, []string, error) { - lines1, err1 := t1.r.CountDiffObjectsNew(t1.t.Refname, t2.t.Refname) +func (rt *RepoTag) GetRefname() string { + return rt.t.Refname +} + +func (rt *RepoTag) GetRef() *GitTag { + return rt.t +} + +func (t1 *RepoTag) DeleteBranch(t2 *RepoTag) ([]string, []string, []string, []string, error) { + lines1, cmd1, err1 := t1.r.CountDiffObjectsNEWNEW(t1.t.Refname, t2.t.Refname) // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath) if err1 != nil { // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath, err) - return nil, nil, err1 + return nil, nil, cmd1, nil, err1 } - lines2, err2 := t1.r.CountDiffObjectsNew(t2.t.Refname, t1.t.Refname) + lines2, cmd2, err2 := t1.r.CountDiffObjectsNEWNEW(t2.t.Refname, t1.t.Refname) // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath) if err2 != nil { // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath, err) - return nil, nil, err2 + return nil, nil, cmd1, cmd2, err2 } if (len(lines1) != 0) || (len(lines2) != 0) { - return lines1, lines2, fmt.Errorf("nope") + return lines1, lines2, cmd1, cmd2, fmt.Errorf("nope") } - return lines1, lines2, nil + return lines1, lines2, cmd1, cmd2, nil } +/* func (t1 *RepoTag) LessThanVerbose(t2 *RepoTag) []string { count, err := t1.r.CountDiffObjectsNew(t1.t.Refname, t2.t.Refname) log.Info("lessthan", t1.t.Refname, t2.t.Refname, len(count), t1.r.FullPath) @@ -67,10 +74,11 @@ func (t1 *RepoTag) LessThanVerbose(t2 *RepoTag) []string { func (t1 *RepoTag) Equal(t2 *RepoTag) bool { return false } +*/ // if t1 is user branch, and t2 is devel branch, true if 0 func (t1 *RepoTag) GreaterThan(t2 *RepoTag) []string { - lines, err := t1.r.CountDiffObjectsNew(t2.t.Refname, t1.t.Refname) + lines, _, err := t1.r.CountDiffObjectsNEWNEW(t2.t.Refname, t1.t.Refname) // log.Info("greaterthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath, err) if err != nil { return nil -- cgit v1.2.3