mirror of
https://github.com/MichaelMure/git-bug.git
synced 2025-01-06 01:44:27 +03:00
Merge pull request #84 from Steap/allow-empty-comment-message
Allow empty messages in comments.
This commit is contained in:
commit
171acad619
@ -58,10 +58,6 @@ func (op *AddCommentOperation) Validate() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if text.Empty(op.Message) {
|
|
||||||
return fmt.Errorf("message is empty")
|
|
||||||
}
|
|
||||||
|
|
||||||
if !text.Safe(op.Message) {
|
if !text.Safe(op.Message) {
|
||||||
return fmt.Errorf("message is not fully printable")
|
return fmt.Errorf("message is not fully printable")
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ func TestValidate(t *testing.T) {
|
|||||||
NewSetTitleOp(rene, unix, "title", "multi\nline"),
|
NewSetTitleOp(rene, unix, "title", "multi\nline"),
|
||||||
NewSetTitleOp(rene, unix, "title\u001b", "title2"),
|
NewSetTitleOp(rene, unix, "title\u001b", "title2"),
|
||||||
NewSetTitleOp(rene, unix, "title", "title2\u001b"),
|
NewSetTitleOp(rene, unix, "title", "title2\u001b"),
|
||||||
NewAddCommentOp(rene, unix, "", nil),
|
|
||||||
NewAddCommentOp(rene, unix, "message\u001b", nil),
|
NewAddCommentOp(rene, unix, "message\u001b", nil),
|
||||||
NewAddCommentOp(rene, unix, "message", []git.Hash{git.Hash("invalid")}),
|
NewAddCommentOp(rene, unix, "message", []git.Hash{git.Hash("invalid")}),
|
||||||
NewSetStatusOp(rene, unix, 1000),
|
NewSetStatusOp(rene, unix, 1000),
|
||||||
|
@ -58,6 +58,7 @@ func runShowBug(cmd *cobra.Command, args []string) error {
|
|||||||
indent := " "
|
indent := " "
|
||||||
|
|
||||||
for i, comment := range snapshot.Comments {
|
for i, comment := range snapshot.Comments {
|
||||||
|
var message string
|
||||||
fmt.Printf("%s#%d %s <%s>\n\n",
|
fmt.Printf("%s#%d %s <%s>\n\n",
|
||||||
indent,
|
indent,
|
||||||
i,
|
i,
|
||||||
@ -65,9 +66,15 @@ func runShowBug(cmd *cobra.Command, args []string) error {
|
|||||||
comment.Author.Email,
|
comment.Author.Email,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if comment.Message == "" {
|
||||||
|
message = colors.GreyBold("No description provided.")
|
||||||
|
} else {
|
||||||
|
message = comment.Message
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Printf("%s%s\n\n\n",
|
fmt.Printf("%s%s\n\n\n",
|
||||||
indent,
|
indent,
|
||||||
comment.Message,
|
message,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user