func (self *repository) IsTagged(name, sha string, lightweight bool) bool { var err error if sha == "" || sha == "HEAD" { sha, err = self.getRef("HEAD") if err != nil { return false } } if lightweight { err = self.checkGitCommand("describe", "--tags", name) return true } else { err = self.checkGitCommand("describe", name) } if err != nil { grip.CatchError(err) return false } taggedCommit, err := self.runGitCommand("ref-list", "--max-count", "1", sha) if err != nil { grip.CatchError(err) return false } if taggedCommit[0] == sha { return true } return false }
func (self *Collection) SnapshotTableScanCursor() chan *Record { c := make(chan *Record) self.RLock() scanTree := self.tree self.RUnlock() go func() { scanTree.Walk(func(root string, tree *git.TreeEntry) int { if tree.Type == git.ObjectBlob { blob, err := self.db.repo.LookupBlob(tree.Id) if err != nil { blob.Free() grip.CatchError(err) return 0 } c <- &Record{ Name: tree.Name, Value: blob.Contents(), } blob.Free() } else { grip.Info(tree.Name) } return 0 }) close(c) }() return c }
func (self *repository) StageAllPath(path string) { index, err := self.repo.Index() if err != nil { return } callback := func(path, matchedPathSpec string) int { grip.Debugf("updating item %s (%s) in index.", path, matchedPathSpec) return 0 } grip.CatchError(index.UpdateAll([]string{path}, callback)) }