mirror of
https://github.com/tj/git-extras.git
synced 2026-09-13 08:56:19 -04:00
perf: reduce calls to git log
This commit is contained in:
parent
73973049d6
commit
203b7649a2
|
|
@ -36,10 +36,7 @@ show_cursor_and_cleanup() {
|
|||
#
|
||||
|
||||
active_days() {
|
||||
date $1 | uniq | awk '
|
||||
{ sum += 1 }
|
||||
END { print sum }
|
||||
'
|
||||
uniq <(echo "$1") | wc -l
|
||||
}
|
||||
|
||||
#
|
||||
|
|
@ -63,7 +60,8 @@ color_for() {
|
|||
|
||||
effort() {
|
||||
file=$1
|
||||
commits=`git log --oneline "$file" | wc -l`
|
||||
local commit_dates=`date $file`
|
||||
commits=`echo "$commit_dates" | wc -l`
|
||||
color='90'
|
||||
|
||||
# ignore <= --above
|
||||
|
|
@ -82,7 +80,7 @@ effort() {
|
|||
msg=$(printf " \033[${color}m%s %-10d" $f_dot $commits)
|
||||
|
||||
# active days
|
||||
active=`active_days "$file"`
|
||||
active=`active_days "$commit_dates"`
|
||||
color_for $active
|
||||
msg="$msg $(printf "\033[${color}m %d\033[0m\n" $active)"
|
||||
echo "$msg"
|
||||
|
|
|
|||
Loading…
Reference in a new issue