Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
04e43fa2
H
hub
项目概览
github
/
hub
11 个月 前同步成功
通知
3
Star
22523
Fork
2406
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
04e43fa2
编写于
7月 31, 2017
作者:
M
Mislav Marohnić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use full text editor filename at call site for greppability
上级
4837835d
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
11 addition
and
24 deletion
+11
-24
commands/issue.go
commands/issue.go
+2
-2
commands/pull_request.go
commands/pull_request.go
+2
-2
commands/release.go
commands/release.go
+4
-4
github/editor.go
github/editor.go
+3
-11
github/editor_test.go
github/editor_test.go
+0
-5
未找到文件。
commands/issue.go
浏览文件 @
04e43fa2
...
...
@@ -364,7 +364,7 @@ func createIssue(cmd *Command, args *Args) {
if
cmd
.
FlagPassed
(
"message"
)
{
title
,
body
=
readMsg
(
flagIssueMessage
)
}
else
if
cmd
.
FlagPassed
(
"file"
)
{
title
,
body
,
editor
,
err
=
readMsgFromFile
(
flagIssueFile
,
flagIssueEdit
,
"ISSUE"
,
"issue"
)
title
,
body
,
editor
,
err
=
readMsgFromFile
(
flagIssueFile
,
flagIssueEdit
,
"ISSUE
_EDITMSG
"
,
"issue"
)
utils
.
Check
(
err
)
}
else
{
message
:=
""
...
...
@@ -382,7 +382,7 @@ text is the title and the rest is the description.`, project)
}
}
editor
,
err
:=
github
.
NewEditor
(
"ISSUE"
,
"issue"
,
message
)
editor
,
err
:=
github
.
NewEditor
(
"ISSUE
_EDITMSG
"
,
"issue"
,
message
)
utils
.
Check
(
err
)
editor
.
AddCommentedSection
(
helpMessage
)
...
...
commands/pull_request.go
浏览文件 @
04e43fa2
...
...
@@ -226,7 +226,7 @@ func pullRequest(cmd *Command, args *Args) {
if
cmd
.
FlagPassed
(
"message"
)
{
title
,
body
=
readMsg
(
flagPullRequestMessage
)
}
else
if
cmd
.
FlagPassed
(
"file"
)
{
title
,
body
,
editor
,
err
=
readMsgFromFile
(
flagPullRequestFile
,
flagPullRequestEdit
,
"PULLREQ"
,
"pull request"
)
title
,
body
,
editor
,
err
=
readMsgFromFile
(
flagPullRequestFile
,
flagPullRequestEdit
,
"PULLREQ
_EDITMSG
"
,
"pull request"
)
utils
.
Check
(
err
)
}
else
if
flagPullRequestIssue
==
""
{
headForMessage
:=
headTracking
...
...
@@ -270,7 +270,7 @@ of text is the title and the rest is the description.`, fullBase, fullHead)
helpMessage
=
helpMessage
+
"
\n\n
Changes:
\n\n
"
+
strings
.
TrimSpace
(
commitLogs
)
}
editor
,
err
=
github
.
NewEditor
(
"PULLREQ"
,
"pull request"
,
message
)
editor
,
err
=
github
.
NewEditor
(
"PULLREQ
_EDITMSG
"
,
"pull request"
,
message
)
utils
.
Check
(
err
)
editor
.
AddCommentedSection
(
helpMessage
)
...
...
commands/release.go
浏览文件 @
04e43fa2
...
...
@@ -303,7 +303,7 @@ func createRelease(cmd *Command, args *Args) {
if
cmd
.
FlagPassed
(
"message"
)
{
title
,
body
=
readMsg
(
flagReleaseMessage
)
}
else
if
cmd
.
FlagPassed
(
"file"
)
{
title
,
body
,
editor
,
err
=
readMsgFromFile
(
flagReleaseFile
,
flagReleaseEdit
,
"RELEASE"
,
"release"
)
title
,
body
,
editor
,
err
=
readMsgFromFile
(
flagReleaseFile
,
flagReleaseEdit
,
"RELEASE
_EDITMSG
"
,
"release"
)
utils
.
Check
(
err
)
}
else
{
message
:=
""
...
...
@@ -312,7 +312,7 @@ func createRelease(cmd *Command, args *Args) {
Write a message for this release. The first block of
text is the title and the rest is the description.`
,
tagName
,
project
.
String
())
editor
,
err
:=
github
.
NewEditor
(
"RELEASE"
,
"release"
,
message
)
editor
,
err
:=
github
.
NewEditor
(
"RELEASE
_EDITMSG
"
,
"release"
,
message
)
utils
.
Check
(
err
)
editor
.
AddCommentedSection
(
helpMessage
)
...
...
@@ -391,7 +391,7 @@ func editRelease(cmd *Command, args *Args) {
if
cmd
.
FlagPassed
(
"message"
)
{
title
,
body
=
readMsg
(
flagReleaseMessage
)
}
else
if
cmd
.
FlagPassed
(
"file"
)
{
title
,
body
,
editor
,
err
=
readMsgFromFile
(
flagReleaseFile
,
flagReleaseEdit
,
"RELEASE"
,
"release"
)
title
,
body
,
editor
,
err
=
readMsgFromFile
(
flagReleaseFile
,
flagReleaseEdit
,
"RELEASE
_EDITMSG
"
,
"release"
)
utils
.
Check
(
err
)
if
title
==
""
{
...
...
@@ -404,7 +404,7 @@ func editRelease(cmd *Command, args *Args) {
Write a message for this release. The first block of
text is the title and the rest is the description.`
,
tagName
,
project
.
String
())
editor
,
err
:=
github
.
NewEditor
(
"RELEASE"
,
"release"
,
message
)
editor
,
err
:=
github
.
NewEditor
(
"RELEASE
_EDITMSG
"
,
"release"
,
message
)
utils
.
Check
(
err
)
editor
.
AddCommentedSection
(
helpMessage
)
...
...
github/editor.go
浏览文件 @
04e43fa2
...
...
@@ -15,11 +15,12 @@ import (
"github.com/github/hub/git"
)
func
NewEditor
(
file
Prefix
,
topic
,
message
string
)
(
editor
*
Editor
,
err
error
)
{
messageFile
,
err
:=
getMessageFile
(
filePrefix
)
func
NewEditor
(
file
name
,
topic
,
message
string
)
(
editor
*
Editor
,
err
error
)
{
gitDir
,
err
:=
git
.
Dir
(
)
if
err
!=
nil
{
return
}
messageFile
:=
filepath
.
Join
(
gitDir
,
filename
)
program
,
err
:=
git
.
Editor
()
if
err
!=
nil
{
...
...
@@ -164,12 +165,3 @@ func readTitleAndBody(reader io.Reader, cs string) (title, body string, err erro
return
}
func
getMessageFile
(
about
string
)
(
string
,
error
)
{
gitDir
,
err
:=
git
.
Dir
()
if
err
!=
nil
{
return
""
,
err
}
return
filepath
.
Join
(
gitDir
,
fmt
.
Sprintf
(
"%s_EDITMSG"
,
about
)),
nil
}
github/editor_test.go
浏览文件 @
04e43fa2
...
...
@@ -160,8 +160,3 @@ Dem body.
assert
.
Equal
(
t
,
"# Dat title"
,
title
)
assert
.
Equal
(
t
,
"Dem body."
,
body
)
}
func
TestGetMessageFile
(
t
*
testing
.
T
)
{
gitPullReqMsgFile
,
_
:=
getMessageFile
(
"PULLREQ"
)
assert
.
T
(
t
,
strings
.
Contains
(
gitPullReqMsgFile
,
"PULLREQ_EDITMSG"
))
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录