summaryrefslogtreecommitdiff
path: root/reloadRepoState.go
blob: 322c5b07d697a3364e0850f7aa9237eb43739ce1 (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
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() != 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"
}