Skip to content

Commit

Permalink
plugin/magit.vim: add magit#show_version() and g:magit_version (fix #69)
Browse files Browse the repository at this point in the history
integration will check version VS git release version
  • Loading branch information
jreybert committed Apr 15, 2016
1 parent 7d5f6a0 commit 3064f25
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugin/magit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ if exists('g:loaded_magit') || !executable('git') || &cp
endif
let g:loaded_magit = 1

let g:vimagit_version = [1, 6, 0]

" Initialisation {{{

" FIXME: find if there is a minimum vim version required
Expand Down Expand Up @@ -1165,6 +1167,12 @@ function! magit#jump_to()
execute "edit " . "+" . line . " " filename
endfunction

function! magit#show_version()
return g:vimagit_version[0] . "." .
\ g:vimagit_version[1] . "." .
\ g:vimagit_version[2]
endfunction

command! Magit call magit#show_magit('v')
command! MagitOnly call magit#show_magit('c')

Expand Down
1 change: 1 addition & 0 deletions test/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ declare -A test_scripts=(
[addDir.vader]='newdir\/'
[jump.vader]='books\/models.py|27|60|books\/isbn_search.py|54'
[commit.vader]='books/models.py|bootstrap'
[version.vader]='foo'
#[addSubmodule.vader]='subdjooks'
)
9 changes: 9 additions & 0 deletions test/version.vader
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Include: setup.inc

Execute (Jump to hunk):
let vimagit_git_version=magit#utils#strip(Git_cmd("git --work-tree=".$VIMAGIT_PATH." --git-dir=".$VIMAGIT_PATH."/.git describe --tags --abbrev=0"))
call Git_verbose_log("git version: '" . vimagit_git_version . "'")
call Git_verbose_log("vimagit version: '" . magit#show_version() . "'")
Assert(vimagit_git_version == magit#show_version())

Include: cleanup.inc

0 comments on commit 3064f25

Please sign in to comment.