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
fb8c66a3
Commit
fb8c66a3
authored
Oct 18, 2015
by
Jerome Reybert
Browse files
Options
Downloads
Patches
Plain Diff
autoload/magit/state.vim: cd top dir when looking for file state
parent
04651213
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
autoload/magit/state.vim
+53
-47
53 additions, 47 deletions
autoload/magit/state.vim
autoload/magit/utils.vim
+4
-0
4 additions, 0 deletions
autoload/magit/utils.vim
with
57 additions
and
47 deletions
autoload/magit/state.vim
+
53
−
47
View file @
fb8c66a3
...
@@ -88,6 +88,9 @@ endfunction
...
@@ -88,6 +88,9 @@ endfunction
" param[in] status: one character status code of the file (AMDRCU?)
" param[in] status: one character status code of the file (AMDRCU?)
" param[in] filename: filename
" param[in] filename: filename
function
!
magit#
state
#add_file
(
mode
,
status
,
filename
)
dict
function
!
magit#
state
#add_file
(
mode
,
status
,
filename
)
dict
let
dir
=
getcwd
()
try
call
magit#utils#
lcd
(
magit#utils#top_dir
())
let
dev_null
=
(
a:status
==
'?'
)
?
" /dev/null "
:
" "
let
dev_null
=
(
a:status
==
'?'
)
?
" /dev/null "
:
" "
let
staged_flag
=
(
a:mode
==
'staged'
)
?
" --staged "
:
" "
let
staged_flag
=
(
a:mode
==
'staged'
)
?
" --staged "
:
" "
let
diff_cmd
=
"git diff --no-ext-diff "
.
staged_flag
.
let
diff_cmd
=
"git diff --no-ext-diff "
.
staged_flag
.
...
@@ -135,6 +138,9 @@ function! magit#state#add_file(mode, status, filename) dict
...
@@ -135,6 +138,9 @@ function! magit#state#add_file(mode, status, filename) dict
call
add
(
hunk
.
lines
,
diff_line
)
call
add
(
hunk
.
lines
,
diff_line
)
endfor
endfor
endif
endif
finally
call
magit#utils#
lcd
(
dir
)
endtry
endfunction
endfunction
" magit#state#update: update self.dict
" magit#state#update: update self.dict
...
...
This diff is collapsed.
Click to expand it.
autoload/magit/utils.vim
+
4
−
0
View file @
fb8c66a3
...
@@ -36,6 +36,10 @@ endfunction
...
@@ -36,6 +36,10 @@ endfunction
" s:magit_cd_cmd: plugin variable to choose lcd/cd command, 'lcd' if exists,
" s:magit_cd_cmd: plugin variable to choose lcd/cd command, 'lcd' if exists,
" 'cd' otherwise
" 'cd' otherwise
let
s:magit_cd_cmd
=
exists
(
'*haslocaldir'
)
&&
haslocaldir
()
?
'lcd '
:
'cd '
let
s:magit_cd_cmd
=
exists
(
'*haslocaldir'
)
&&
haslocaldir
()
?
'lcd '
:
'cd '
" magit#utils#lcd: helper function to lcd. use cd if lcd doesn't exists
function
!
magit#utils#
lcd
(
dir
)
execute
s:magit_cd_cmd
.
a:dir
endfunction
" magit#utils#system: wrapper for system, which only takes String as input in vim,
" magit#utils#system: wrapper for system, which only takes String as input in vim,
" although it can take String or List input in neovim.
" although it can take String or List input in neovim.
...
...
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