summaryrefslogtreecommitdiff
path: root/reloadRepoState.go
blob: b4928c72f874df2ffe3cb0d7718ab3100a9e104c (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
36
37
38
39
40
41
42
package gitpb

// does processing on the go.mod and go.sum files

import (
	"go.wit.com/log"
)

func (repo *Repo) setRepoState() {
	if repo == nil {
		return
	}
	if repo.IsDirty() {
		repo.State = "dirty"
		return
	}
	if repo.GetUserVersion() == "uerr" {
		// user has not made user branches
	} else {
		if repo.GetUserVersion() != repo.GetDevelVersion() {
			repo.State = "merge to devel"
			return
		}
	}
	if repo.GetDevelVersion() != repo.GetMasterVersion() {
		repo.State = "merge to main"
		return
	}
	if repo.GetLastTag() != repo.GetMasterVersion() {
		repo.State = "unchanged"
		return
	}

	if repo.CheckBranches() {
		repo.State = "PERFECT"
		return
	}
	log.Info("Branches are not Perfect", repo.GetFullPath())
	log.Info("Branches are not Perfect", repo.GetFullPath())
	log.Info("Branches are not Perfect", repo.GetFullPath())
	repo.State = "unknown branches"
}