aboutsummaryrefslogtreecommitdiffstats
path: root/cache/repo_cache.go
diff options
context:
space:
mode:
Diffstat (limited to 'cache/repo_cache.go')
-rw-r--r--cache/repo_cache.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/cache/repo_cache.go b/cache/repo_cache.go
index 4ca19150..2278b604 100644
--- a/cache/repo_cache.go
+++ b/cache/repo_cache.go
@@ -11,6 +11,7 @@ import (
"sort"
"strconv"
"strings"
+ "time"
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/operations"
@@ -354,11 +355,22 @@ func (c *RepoCache) NewBugWithFiles(title string, message string, files []git.Ha
return nil, err
}
- b, err := operations.CreateWithFiles(author, title, message, files)
+ return c.NewBugRaw(author, time.Now().Unix(), title, message, files, nil)
+}
+
+// NewBugWithFilesMeta create a new bug with attached files for the message, as
+// well as metadata for the Create operation.
+// The new bug is written in the repository (commit)
+func (c *RepoCache) NewBugRaw(author bug.Person, unixTime int64, title string, message string, files []git.Hash, metadata map[string]string) (*BugCache, error) {
+ b, err := operations.CreateWithFiles(author, unixTime, title, message, files)
if err != nil {
return nil, err
}
+ for key, value := range metadata {
+ b.FirstOp().SetMetadata(key, value)
+ }
+
err = b.Commit(c.repo)
if err != nil {
return nil, err