From aefd88057ec64740aecc38a4214311cfb5dbd797 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Mon, 11 Mar 2013 18:58:57 +0100 Subject: [PATCH] simplify git detection --- plugin/signify.vim | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/plugin/signify.vim b/plugin/signify.vim index 05bdeb1..14995d6 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -226,16 +226,11 @@ function! s:diff_get(path) abort if executable('git') let orig_dir = getcwd() - let wt = fnamemodify(a:path, ':h') - exe 'cd '. wt - let gd = system('git rev-parse --git-dir')[:-2] " remove newline + exe 'cd '. fnamemodify(a:path, ':h') + let diff = system('git diff --no-ext-diff -U0 -- '. a:path .' | grep "^@@ "') if !v:shell_error - let wt = fnamemodify(gd, ':h') - let diff = system('git --work-tree '. wt .' --git-dir '. gd .' diff --no-ext-diff -U0 -- '. a:path .' | grep "^@@ "') - if !v:shell_error - exe 'cd '. orig_dir - return diff - endif + exe 'cd '. orig_dir + return diff endif exe 'cd '. orig_dir endif