Default log commands only show current branch
dblume

dblume commited on 2023-08-24 17:30:58
Showing 2 changed files, with 7 additions and 5 deletions.


Stopped defaulting to "--all", now "log1" and vim's "Log"
just do the current branch.
... ...
@@ -19,7 +19,8 @@
19 19
 	excludesfile = ~/.gitignore
20 20
 	whitespace = trailing-space,space-before-tab,tab-in-indent
21 21
 [alias]
22
-	log1 = log --graph --abbrev-commit --decorate --date=short --format=format:'%C(bold blue)%h%C(reset) %C(bold green)%ad%C(reset) %C(white)%s%C(reset) %C(dim white)%an%C(reset)%C(bold yellow)%d%C(reset)' --all
22
+	log1 = log --graph --abbrev-commit --decorate --date=short --format=format:'%C(bold blue)%h%C(reset) %C(bold green)%ad%C(reset) %C(white)%s%C(reset) %C(dim white)%an%C(reset)%C(bold yellow)%d%C(reset)'
23
+	logall = log --graph --abbrev-commit --decorate --date=short --format=format:'%C(bold blue)%h%C(reset) %C(bold green)%ad%C(reset) %C(white)%s%C(reset) %C(dim white)%an%C(reset)%C(bold yellow)%d%C(reset)' --all
23 24
 	log2 = log --graph --abbrev-commit --decorate --date short --format=format:'%C(bold blue)%h%C(reset) %C(bold cyan)%ad%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''        %C(white)%s%C(reset) %C(dim white)%an%C(reset)' --all
24 25
 	logtree = log --graph --simplify-by-decoration --pretty=format:'%d' --all
25 26
 [pull]
... ...
@@ -253,20 +253,21 @@ function! GitDiff()
253 253
 endfunction
254 254
 command Diff :call GitDiff()
255 255
 
256
-function! GitLog()
256
+function! GitLog(flags)
257 257
     let l:fname = expand('%')
258 258
     if stridx(l:fname, ' -- ') != -1
259 259
         let l:fname = split(l:fname, ' -- ')[-1]
260 260
     endif
261
-    let l:bufname = 'git log -- ' . l:fname
261
+    let l:bufname = 'git log ' . a:flags . '-- ' . l:fname
262 262
     if !ShowBufInNewTab(l:bufname)
263
-        exec 'tabnew | r! git log --no-color --graph --date=short --all --pretty="format:\%h \%ad \%s \%an \%d" -- ' . shellescape(l:fname)
263
+        exec 'tabnew | r! git log --no-color --graph --date=short ' . a:flags . '--pretty="format:\%h \%ad \%s \%an \%d" -- ' . shellescape(l:fname)
264 264
         setl buftype=nofile
265 265
         0d_
266 266
         exec 'silent :file ' . fnameescape(l:bufname)
267 267
     endif
268 268
 endfunction
269
-command Log :call GitLog()
269
+command Logall :call GitLog('--all ')
270
+command Log :call GitLog('')
270 271
 
271 272
 " pastetoggle
272 273
 nmap <leader>p :set invpaste paste?<cr>
273 274