diff --git a/README.markdown b/README.markdown index 9f88405..9413661 100644 --- a/README.markdown +++ b/README.markdown @@ -29,8 +29,9 @@ the buffer. Use `:Ggrep` to search the work tree (or any arbitrary commit) with `git grep`, skipping over that which is not tracked in the repository. -`:Glog` loads all previous revisions of a file into the quickfix list so -you can iterate over them and watch the file evolve. +`:Gclog` and `:Gllog` load all previous commits into the quickfix or location +list. Give them a range (e.g., using visual mode and `:'<,'>Gclog`) to +iterate over every change to that portion of the current file. `:Gread` is a variant of `git checkout -- filename` that operates on the buffer rather than the filename. This means you can use `u` to undo it diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 4abfd4a..9169239 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3804,7 +3804,7 @@ function! s:LogParse(state, target, dir, line) abort return [] endfunction -function! s:Log(type, bang, line1, count, args) abort +function! s:Log(type, bang, line1, count, args, legacy) abort let dir = s:Dir() exe s:DirCheck(dir) let listnr = a:type =~# '^l' ? 0 : -1 @@ -3863,16 +3863,19 @@ function! s:Log(type, bang, line1, count, args) abort \ ['--no-color', '--no-ext-diff', '--pretty=format:fugitive ' . format] + \ args + paths + extra) let state = {'context': 'init', 'child_found': 0, 'queue': []} - let title = (listnr < 0 ? ':Glog ' : ':Gllog ') . s:fnameescape(args + paths) + let title = (listnr < 0 ? ':Gclog ' : ':Gllog ') . s:fnameescape(args + paths) + if empty(paths + extra) && a:legacy && len(s:Relative('/')) + let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after + endif return s:QuickfixStream(listnr, title, cmd, !a:bang, s:function('s:LogParse'), state, path, dir) . after endfunction call s:command("-bang -nargs=? -range=-1 -addr=windows -complete=customlist,s:GrepComplete Ggrep", "grep") call s:command("-bang -nargs=? -complete=customlist,s:GrepComplete Gcgrep :execute s:GrepSubcommand(-1, -1, 0, 0, '', )") call s:command("-bang -nargs=? -complete=customlist,s:GrepComplete Glgrep :execute s:GrepSubcommand(0, 0, 0, 0, '', )") -call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Glog :exe s:Log('c',0,,,)") -call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Gclog :exe s:Log('c',0,,,)") -call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Gllog :exe s:Log('l',0,,,)") +call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Glog :exe s:Log('c',0,,,, 1)") +call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Gclog :exe s:Log('c',0,,,, 0)") +call s:command("-bang -nargs=? -range=-1 -addr=other -complete=customlist,s:LogComplete Gllog :exe s:Log('l',0,,,, 0)") " Section: :Gedit, :Gpedit, :Gsplit, :Gvsplit, :Gtabedit, :Gread diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 96fb92b..0198d1a 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -78,19 +78,19 @@ that are part of Git repositories). *fugitive-:Glgrep* :Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'. - *fugitive-:Glog* *fugitive-:Gclog* -:Glog[!] [args] Use git-log [args] to load the commit history into the - |quickfix| list. Jump to the first commit unless [!] + *fugitive-:Gclog* *fugitive-:Glog* +:Gclog[!] [args] Use git-log [args] to load the commit history into the +:Glog[!] [args] |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}Gclog[!] [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 - the entire file. + first diff hunk for each commit. Use :0Gclog to + target the entire file. *fugitive-:Gllog* -:Gllog [args] Like |:Glog|, but use the location list instead of the +:Gllog [args] Like |:Gclog|, but use the location list instead of the |quickfix| list. *fugitive-:Gedit* *fugitive-:Ge*