From 7ebff4143c236527fc180d423273632f2939e1fc Mon Sep 17 00:00:00 2001 From: jsvisa Date: Mon, 30 Sep 2024 14:34:50 +0800 Subject: [PATCH 1/2] feat: use short commit instead of full sha Signed-off-by: jsvisa --- plugin/vim-gh-line.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/vim-gh-line.vim b/plugin/vim-gh-line.vim index c4149d7..c558b92 100644 --- a/plugin/vim-gh-line.vim +++ b/plugin/vim-gh-line.vim @@ -249,9 +249,9 @@ endfunc func! s:Commit(cdDir) if exists('g:gh_use_canonical') && g:gh_use_canonical > 0 - return system(a:cdDir . 'git rev-parse HEAD') + return system(a:cdDir . 'git rev-parse --short HEAD') else - return system(a:cdDir . 'git rev-parse --abbrev-ref HEAD') + return system(a:cdDir . 'git rev-parse --abbrev-ref --short HEAD') endif endfunc From e925be07b1466580ea94cddf08f5c2332190ed24 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Mon, 30 Sep 2024 14:39:53 +0800 Subject: [PATCH 2/2] update test case Signed-off-by: jsvisa --- test/vim-gh-line_test.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/vim-gh-line_test.vim b/test/vim-gh-line_test.vim index 6193491..0b9b295 100644 --- a/test/vim-gh-line_test.vim +++ b/test/vim-gh-line_test.vim @@ -89,7 +89,7 @@ func! s:testCommit(sid) let l:fileDir = resolve(expand("%:p:h")) let l:cdDir = "cd '" . fileDir . "'; " - let l:branch = system(l:cdDir . 'git rev-parse --abbrev-ref HEAD') + let l:branch = system(l:cdDir . 'git rev-parse --abbrev-ref --short HEAD') let g:gh_use_canonical = 0 let l:act = s:callWithSID(a:sid, 'Commit', l:cdDir) @@ -384,4 +384,3 @@ func! s:tryRunAllTests() endfunction command! RunAllTests call s:tryRunAllTests() -