From c4a38c92dc60594b35538d645265d99b190049c7 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 7 Dec 2023 15:43:13 -0500 Subject: [PATCH] Return first, not last, value for FugitiveConfigGet() --- autoload/fugitive.vim | 4 ++-- plugin/fugitive.vim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index b4e8440..9b6363e 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1118,7 +1118,7 @@ function! fugitive#Config(...) abort let callback = a:000[1:-1] endif elseif a:0 >= 2 && type(a:2) == type({}) && has_key(a:2, 'GetAll') - return get(fugitive#ConfigGetAll(a:1, a:2), 0, default) + return get(fugitive#ConfigGetAll(a:1, a:2), -1, default) elseif a:0 >= 2 let dir = s:Dir(a:2) let name = a:1 @@ -1200,7 +1200,7 @@ function! s:config_GetAll(name) dict abort endfunction function! s:config_Get(name, ...) dict abort - return get(self.GetAll(a:name), 0, a:0 ? a:1 : '') + return get(self.GetAll(a:name), -1, a:0 ? a:1 : '') endfunction function! s:config_GetRegexp(pattern) dict abort diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index d88fb8c..86e6576 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -168,7 +168,7 @@ endfunction " argument can be either the object returned by FugitiveConfig(), or a Git " dir or buffer number to be passed along to FugitiveConfig(). function! FugitiveConfigGet(name, ...) abort - return get(call('FugitiveConfigGetAll', [a:name] + (a:0 ? [a:1] : [])), 0, get(a:, 2, '')) + return get(call('FugitiveConfigGetAll', [a:name] + (a:0 ? [a:1] : [])), -1, get(a:, 2, '')) endfunction " FugitiveConfigGetAll() is like FugitiveConfigGet() but returns a list of