diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 1c877c7..4813df6 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3111,24 +3111,19 @@ function! s:Log(cmd, bang, line1, line2, ...) abort let before = substitute(args, ' --\S\@!.*', '', '') let after = strpart(args, len(before)) let path = s:Relative('/') - let relative = path[1:-1] - if path =~# '^/\.git\%(/\|$\)' || len(after) + if path =~# '^/\.git\%(/\|$\)' || a:line2 < 0 let path = '' + elseif a:line2 > 0 + let before .= ' -L ' . s:shellesc(a:line1 . ',' . a:line2 . ':' . path[1:-1]) + else + let after = (len(after) > 3 ? after : ' -- ') . path[1:-1] endif - if before !~# '\s[^[:space:]-]' + if len(path) && before !~# '\s[^[:space:]-]' let owner = s:Owner(@%) if len(owner) let before .= ' ' . s:shellesc(owner) endif endif - if relative =~# '^\.git\%(/\|$\)' - let relative = '' - endif - if len(relative) && a:line2 > 0 - let before .= ' -L ' . s:shellesc(a:line1 . ',' . a:line2 . ':' . relative) - elseif len(relative) && (empty(after) || a:line2 == 0) - let after = (len(after) > 3 ? after : ' -- ') . relative - endif let grepformat = &grepformat let grepprg = &grepprg try @@ -3138,12 +3133,6 @@ function! s:Log(cmd, bang, line1, line2, ...) abort \ s:shellesc('--pretty=format:fugitive://'.s:Dir().'//%H'.path.'::'.format), '%#') let &grepformat = '%Cdiff %.%#,%C--- %.%#,%C+++ %.%#,%Z@@ -%\d%\+\,%\d%\+ +%l\,%\d%\+ @@,%-G-%.%#,%-G+%.%#,%-G %.%#,%A%f::%m,%-G%.%#' exe a:cmd . (a:bang ? '! ' : ' ') . s:ShellExpand(before . after) - if len(path) && a:line2 == -1 - redraw - echohl WarningMsg - echo ':Glog will soon default to all files. Use :0Glog to target current file' - echohl NONE - endif finally let &grepformat = grepformat let &grepprg = grepprg diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 16f20f1..37e472d 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -75,14 +75,11 @@ that are part of Git repositories). :Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'. *fugitive-:Glog* -:Glog [args] Load the commit history into the |quickfix| list. - Additional git-log arguments can be given (for - example, --reverse). Provide "--" in the argument - list to target all commits. Otherwise, only commits - changing the current file will be targeted. This - special casing is slated to be removed. +:Glog[!] [args] Use git-log [args] to load the commit history into the + |quickfix| list. Jump to the first commit unless [!] + is given. -:{range}Glog [args] Use git-log -L to load previous revisions of the given +:{range}Glog[!] [args] Use git-log -L to load previous revisions of the given range of the current file into the |quickfix| list. The cursor is positioned on the first line of the first diff hunk for each commit. Use :0Glog to target