Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
vimagit
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
jreybert
vimagit
Commits
c74160be
Commit
c74160be
authored
Nov 30, 2015
by
Jerome Reybert
Browse files
Options
Downloads
Patches
Plain Diff
plugin/magit.vim: move s:magit_commit_mode to buffer variable b:magit_current_commit_mode
parent
78c2d56e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugin/magit.vim
+21
-21
21 additions, 21 deletions
plugin/magit.vim
with
21 additions
and
21 deletions
plugin/magit.vim
+
21
−
21
View file @
c74160be
...
...
@@ -122,9 +122,9 @@ function! s:mg_get_info()
silent
put
=
g:magit_section_info
.
cur_repo
.
': '
.
magit#git#top_dir
()
silent
put
=
g:magit_section_info
.
cur_branch
.
': '
.
branch
silent
put
=
g:magit_section_info
.
cur_commit
.
': '
.
commit
if
(
s
:magit_commit_mode
!=
''
)
if
(
b
:magit_
current_
commit_mode
!=
''
)
silent
put
=
g:magit_section_info
.
commit_mode
.
': '
\
.
g:magit_commit_mode
[
s
:magit_commit_mode
]
\
.
g:magit_commit_mode
[
b
:magit_
current_
commit_mode
]
endif
silent
put
=
''
silent
put
=
'Press h to display help'
...
...
@@ -211,23 +211,16 @@ function! s:mg_get_stashes()
endif
endfunction
" s:magit_commit_mode: global variable which states in which commit mode we are
" values are:
" '': not in commit mode
" 'CC': normal commit mode, next commit command will create a new commit
" 'CA': amend commit mode, next commit command will ament current commit
" 'CF': fixup commit mode, it should not be a global state mode
let
s:magit_commit_mode
=
''
" s:mg_get_commit_section: this function writes in current buffer the commit
" section. It is a commit message, depending on
s
:magit_commit_mode
" section. It is a commit message, depending on
b
:magit_
current_
commit_mode
" WARNING: this function writes in file, it should only be called through
" protected functions like magit#update_buffer
" param[in]
s
:magit_commit_mode: this function uses global commit mode
" param[in]
b
:magit_
current_
commit_mode: this function uses global commit mode
" 'CC': prepare a brand new commit message
" 'CA': get the last commit message
function
!
s:mg_get_commit_section
()
if
(
s
:magit_commit_mode
!=
''
)
if
(
b
:magit_
current_
commit_mode
!=
''
)
silent
put
=
''
silent
put
=
g:magit_sections
.
commit_start
call
<
SID
>
mg_section_help
(
'commit'
)
...
...
@@ -236,9 +229,9 @@ function! s:mg_get_commit_section()
let
git_dir
=
magit#git#git_dir
()
" refresh the COMMIT_EDITMSG file
if
(
s
:magit_commit_mode
==
'CC'
)
if
(
b
:magit_
current_
commit_mode
==
'CC'
)
silent
!
call
magit#utils#
system
(
"GIT_EDITOR=/bin/false git commit -e 2> /dev/null"
)
elseif
(
s
:magit_commit_mode
==
'CA'
)
elseif
(
b
:magit_
current_
commit_mode
==
'CA'
)
silent
!
call
magit#utils#
system
(
"GIT_EDITOR=/bin/false git commit --amend -e 2> /dev/null"
)
endif
if
(
filereadable
(
git_dir
.
'COMMIT_EDITMSG'
)
)
...
...
@@ -549,7 +542,7 @@ function! magit#update_buffer()
call
winrestview
(
l
:
winview
)
if
(
s
:magit_commit_mode
!=
''
)
if
(
b
:magit_
current_
commit_mode
!=
''
)
let
commit_section_pat_start
=
'^'
.
g:magit_sections
.
commit_start
.
'$'
silent
!
let
section_line
=
search
(
commit_section_pat_start
,
"w"
)
silent
!
call
cursor
(
section_line
+
2
+<
SID
>
mg_get_inline_help_line_nb
(
'commit'
),
0
)
...
...
@@ -644,6 +637,13 @@ function! magit#show_magit(display, ...)
"setlocal readonly
let
b:state
=
deepcopy
(
g:magit
#
state
#
state
)
" s:magit_commit_mode: global variable which states in which commit mode we are
" values are:
" '': not in commit mode
" 'CC': normal commit mode, next commit command will create a new commit
" 'CA': amend commit mode, next commit command will ament current commit
" 'CF': fixup commit mode, it should not be a global state mode
let
b:magit_current_commit_mode
=
''
call
magit#utils#setbufnr
(
bufnr
(
buffer_name
))
call
magit#
sign
#init
()
...
...
@@ -896,25 +896,25 @@ endfunction
" magit#commit_command: entry function for commit mode
" INFO: it has a different effect if current section is commit section or not
" param[in] mode: commit mode
" 'CF': do not set global
s
:magit_commit_mode, directly call magit#git_commit
" 'CF': do not set global
b
:magit_
current_
commit_mode, directly call magit#git_commit
" 'CA'/'CF': if in commit section mode, call magit#git_commit, else just set
" global state variable
s
:magit_commit_mode,
" global state variable
b
:magit_
current_
commit_mode,
function
!
magit#commit_command
(
mode
)
if
(
a:mode
==
'CF'
)
call
<
SID
>
mg_git_commit
(
a:mode
)
else
let
section
=<
SID
>
mg_get_section
()
if
(
section
==
'commit_start'
)
if
(
s
:magit_commit_mode
==
''
)
if
(
b
:magit_
current_
commit_mode
==
''
)
echoerr
"Error, commit section should not be enabled"
return
endif
" when we do commit, it is prefered ot commit the way we prepared it
" (.i.e normal or amend), whatever we commit with CC or CA.
call
<
SID
>
mg_git_commit
(
s
:magit_commit_mode
)
let
s
:magit_commit_mode
=
''
call
<
SID
>
mg_git_commit
(
b
:magit_
current_
commit_mode
)
let
b
:magit_
current_
commit_mode
=
''
else
let
s
:magit_commit_mode
=
a:mode
let
b
:magit_
current_
commit_mode
=
a:mode
endif
endif
call
magit#update_buffer
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment