From 3064f25ae54fc06fe9da2b390a39db70457fe012 Mon Sep 17 00:00:00 2001
From: Jerome Reybert <jreybert@gmail.com>
Date: Fri, 15 Apr 2016 12:27:13 +0200
Subject: [PATCH] plugin/magit.vim: add magit#show_version() and
 g:magit_version (fix #69)

integration will check version VS git release version
---
 plugin/magit.vim   | 8 ++++++++
 test/test.config   | 1 +
 test/version.vader | 9 +++++++++
 3 files changed, 18 insertions(+)
 create mode 100644 test/version.vader

diff --git a/plugin/magit.vim b/plugin/magit.vim
index a930b75..bfac4e9 100644
--- a/plugin/magit.vim
+++ b/plugin/magit.vim
@@ -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
@@ -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')
 
diff --git a/test/test.config b/test/test.config
index 2cbd58e..3e496eb 100644
--- a/test/test.config
+++ b/test/test.config
@@ -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'
             )
diff --git a/test/version.vader b/test/version.vader
new file mode 100644
index 0000000..0dd443d
--- /dev/null
+++ b/test/version.vader
@@ -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
-- 
GitLab