-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move .REVIEW_COMMENT_STATE to .git #36
Conversation
|
||
let l:pr = split(system([s:script_dir . 'pr-id.sh', trim(l:owner), trim(l:name), trim(l:current_branch)]), "\n") | ||
|
||
let l:pr = systemlist([s:script_dir . 'pr-id.sh', l:owner, l:name, l:current_branch]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
systemlist を使えば split
不要できれいになる
@@ -33,12 +28,17 @@ endfunction | |||
function! g:goshiteki#add_review_comment() range abort | |||
let s:add_review_comment_tempname = tempname() | |||
let s:git_root = trim(system(['git', 'rev-parse', '--show-toplevel'])) . '/' | |||
let s:git_dir = getenv('GIT_DIR') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GIT_DIR
対策がちょっと入ってしまった
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let s:git_dir = getenv('GIT_DIR') | |
let s:git_dir = getenv('GIT_DIR') || '.git' |
を使うと一撃でやりたいことできそうで、下のifがいらない気がする?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vim script は ||
の結果が整数型になるのでそれは NG
@@ -68,8 +67,8 @@ endfunction | |||
|
|||
function! g:goshiteki#post_submit(status, tempname, pr_id) abort | |||
let l:body = join(readfile(a:tempname), "\n") | |||
call system([s:script_dir . 'submit-review.sh', a:pr_id, l:body, a:status, "./.REVIEW_COMMENT_STATE"]) | |||
echo "Submit review(status: " . "a:status" . ")" | |||
call system([s:script_dir . 'submit-review.sh', a:pr_id, l:body, a:status, s:git_root . s:git_dir . '/REVIEW_COMMENT_STATE']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.git
の中なので .
始まりのファイル名もやめた
@@ -2,7 +2,7 @@ | |||
|
|||
# review-comments readme.md 1 body json | |||
review-comments() { | |||
local REVIEW_COMMENT_STATE="./.REVIEW_COMMENT_STATE" | |||
local REVIEW_COMMENT_STATE=$(git rev-parse --show-toplevel)/${GIT_DIR:-.git}/REVIEW_COMMENT_STATE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
シェルスクリプト側は一行で書ける
REVIEW_COMMENT_STATE
を.git
以下に移動(fix Goshiteki のステートがカレントディレクトリーに置かれている #23)\n
を使っている箇所以外はシングルクォートに統一systemlist
への置き換えで読みやすく