diff options
| author | Jeff Carr <[email protected]> | 2024-02-24 04:50:31 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-24 04:50:31 -0600 |
| commit | ddd95e9afc926d9e0a4a372dbf433d81c3db3207 (patch) | |
| tree | 2b0e6788c5a877c528d4287be2de90de51795c9b /tagWindow.go | |
| parent | 2a62d23482aefc506b9cbb4114edb4c368830194 (diff) | |
GitPull() detects local only branches
Diffstat (limited to 'tagWindow.go')
| -rw-r--r-- | tagWindow.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tagWindow.go b/tagWindow.go index 683fee8..e756b49 100644 --- a/tagWindow.go +++ b/tagWindow.go @@ -318,6 +318,29 @@ func (rs *RepoStatus) LocalTagExists(findname string) bool { return false } +// returns true if 'taggy' is _ONLY_ a local tag +// this means you can not do a git pull or git push on it +func (rs *RepoStatus) IsOnlyLocalTag(taggy string) bool { + // first make sure the tag is actually even local + if !rs.LocalTagExists(taggy) { + // this means it's not even local now. + return false + } + // okay, taggy exists, does it exist in a remote repo? + for _, t := range rs.Tags.ListAll() { + tagname := t.TagString() + if strings.HasPrefix(tagname, "refs/remotes") { + path, filename := filepath.Split(tagname) + if filename == taggy { + log.Log(REPOWARN, "found tag:", path, filename, "from", rs.Path()) + return false + } + } + } + // we couldn't find the local tag anywhere remote, so it's probably only local + return true +} + func (t *Tag) Age() time.Duration { const gitLayout = "Mon Jan 2 15:04:05 2006 -0700" tagTime, _ := time.Parse(gitLayout, t.date.String()) @@ -373,3 +396,9 @@ func (rs *RepoStatus) NewestTag() *Tag { } return newest } + +func (rs *RepoStatus) DumpTags() { + for _, t := range rs.Tags.ListAll() { + log.Log(REPOWARN, "tag", t.ref.String(), t.date.String(), t.tag.String()) + } +} |
