Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use git rev-parse to get the branch name

and prevent the annoying newline from being injected into the log file.
  • Loading branch information...
commit a42b51c69afd86ef3c7c20bbd17489040825b6d7 1 parent ea3df38
Andy Dawson authored
Showing with 3 additions and 5 deletions.
  1. +3 −5 plugin/activity-log.vim
8 plugin/activity-log.vim
View
@@ -13,7 +13,7 @@
"
" Section: Documentation
"
-" The vim activity log plugin logs when you create, open or write a file.
+" The vim activity log plugin logs when you create, open or write a file.
"
" This provides you with a detailed log of what you've been up to. By default
" the activity log files are stored in the ~/activity/ directory and are named
@@ -124,10 +124,8 @@ function s:LogAction(action)
let l:message = l:time . ';' . a:action . ';' . l:file
if g:activity_log_append_git_branch
- let l:branch = system('cd ' . fnameescape(expand("%:h")) . "; git branch --no-color 2> /dev/null | sed -e '/^[^*]/d'")
- if (l:branch =~ "^* ")
- let l:message = l:message . ';' . substitute(l:branch, '\* ', '', '')
- endif
+ let l:branch = system('cd ' . fnameescape(expand("%:h")) . "; git rev-parse -q --abbrev-ref HEAD 2> /dev/null")
+ let l:message = l:message . ';' . substitute(l:branch, '\v\C\n$', '', '')
endif
call s:WriteLogAction(l:message)
endfunction
Please sign in to comment.
Something went wrong with that request. Please try again.