aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_create.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-03-28 01:21:41 +0100
committerMichael Muré <batolettre@gmail.com>2019-03-28 01:21:41 +0100
commit0a71e6d269e60f844a2d08069ca5bdee9b91b388 (patch)
tree25afa74bdf5e3a394a398b5996fb0554306429d4 /bug/op_create.go
parent029861fa0ee99845dfdc3c0e38748608109233ed (diff)
downloadgit-bug-0a71e6d269e60f844a2d08069ca5bdee9b91b388.tar.gz
commands: display comment's id in "git bug comment"
Diffstat (limited to 'bug/op_create.go')
-rw-r--r--bug/op_create.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/bug/op_create.go b/bug/op_create.go
index 42d40f71..d5852db9 100644
--- a/bug/op_create.go
+++ b/bug/op_create.go
@@ -30,9 +30,17 @@ func (op *CreateOperation) Hash() (git.Hash, error) {
}
func (op *CreateOperation) Apply(snapshot *Snapshot) {
+ hash, err := op.Hash()
+ if err != nil {
+ // Should never error unless a programming error happened
+ // (covered in OpBase.Validate())
+ panic(err)
+ }
+
snapshot.Title = op.Title
comment := Comment{
+ id: string(hash),
Message: op.Message,
Author: op.Author,
UnixTime: timestamp.Timestamp(op.UnixTime),
@@ -42,13 +50,6 @@ func (op *CreateOperation) Apply(snapshot *Snapshot) {
snapshot.Author = op.Author
snapshot.CreatedAt = op.Time()
- hash, err := op.Hash()
- if err != nil {
- // Should never error unless a programming error happened
- // (covered in OpBase.Validate())
- panic(err)
- }
-
snapshot.Timeline = []TimelineItem{
&CreateTimelineItem{
CommentTimelineItem: NewCommentTimelineItem(hash, comment),