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
db72f829
Commit
db72f829
authored
Oct 8, 2015
by
Jerome Reybert
Browse files
Options
Downloads
Patches
Plain Diff
plugin/magit.vim: fix issue of some rare hunk staging (because of some whitespaces)
parent
4a2e8b18
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
+12
-2
12 additions, 2 deletions
plugin/magit.vim
with
12 additions
and
2 deletions
plugin/magit.vim
+
12
−
2
View file @
db72f829
...
...
@@ -545,12 +545,17 @@ function! s:mg_git_apply(selection)
if
(
selection
[
-1
]
!~
'^\s*$'
)
let
selection
+=
[
''
]
endif
silent
let
git_result
=<
SID
>
mg_system
(
"git apply --cached -"
,
selection
)
" when passing List to system as input, there are some rare and
" difficultly reproductable cases failing because of whitespaces
let
tmp
=
tempname
()
call
writefile
(
selection
,
tmp
)
silent
let
git_result
=<
SID
>
mg_system
(
"git apply --cached - < "
.
tmp
)
if
(
v
:
shell_error
!=
0
)
echoerr
"Git error: "
.
git_result
echoerr
"Tried to aply this"
echoerr
string
(
a:selection
)
endif
call
delete
(
tmp
)
endfunction
" s:mg_git_unapply: helper function to unstage a selection
...
...
@@ -568,12 +573,17 @@ function! s:mg_git_unapply(selection, mode)
if
(
selection
[
-1
]
!~
'^\s*$'
)
let
selection
+=
[
''
]
endif
silent
let
git_result
=<
SID
>
mg_system
(
"git apply "
.
cached_flag
.
" --reverse - "
,
selection
)
" when passing List to system as input, there are some rare and
" difficultly reproductable cases failing because of whitespaces
let
tmp
=
tempname
()
call
writefile
(
selection
,
tmp
)
silent
let
git_result
=<
SID
>
mg_system
(
"git apply "
.
cached_flag
.
" --reverse - < "
.
tmp
)
if
(
v
:
shell_error
!=
0
)
echoerr
"Git error: "
.
git_result
echoerr
"Tried to unaply this"
echoerr
string
(
a:selection
)
endif
call
delete
(
tmp
)
endfunction
" s:mg_get_section: helper function to get the current section, according to
...
...
...
...
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