This file is indexed.

/usr/bin/git-effort is in git-extras 1.9.1-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash

tmp="$(mktemp --suffix=-git-effort)"
above='0'
color=

trap "rm -rf '$tmp'" EXIT

#
# get date for the given <commit>
#

date() {
  git log --pretty='format: %ai' $1 | cut -d ' ' -f 2
}

#
# hide cursor
#

hide_cursor() {
  printf '\033[?25l'
}

#
# show cursor
#

show_cursor() {
  printf '\033[?25h'
  printf '\033[m\n'
  exit 1
}

#
# get active days for the given <commit>
#

active_days() {
  date $1 | uniq | awk '
    { sum += 1 }
    END { print sum }
  '
}

#
# set 'color' based on the given <num>
#

color_for() {
  test $1 -gt 10 && color='33'
  test $1 -gt 25 && color='33;1'
  test $1 -gt 50 && color='93'
  test $1 -gt 75 && color='93;1'
  test $1 -gt 100 && color='31'
  test $1 -gt 125 && color='31;1'
  test $1 -gt 150 && color='91'
  test $1 -gt 200 && color='91;1'
}

#
# compute the effort of the given <file ...>
#

effort() {
  for file in $@; do
    commits=`git log --oneline $file | wc -l`
    color='90'

    # ignore <= --above
    test $commits -le $above && continue

    # commits
    color_for $commits
    len=${#file}
    dot="."
    f_dot=$file
    i=0 ; while test $i -lt $((45-$len)) ; do
      f_dot=$f_dot$dot
      i=$(($i+1))
    done

    printf "  \033[${color}m%s %-10d" $f_dot $commits

    # active days
    active=`active_days $file`
    color_for $active
    printf "\033[${color}m %d\033[0m\n" $active
  done
}

#
# print heading
#

heading() {
  echo
  printf "  %-45s %-10s %s\n" 'file' 'commits' 'active days'
  echo
}

#
# output sorted results
#

sort_effort() {
  clear
  echo
  heading
  cat $tmp | sort -rn -k 2
}

# --above <n-commits>

if test "$1" = "--above"; then
  shift; above=$1
  shift
fi

# [file ...]

if test $# -ge 1; then
  files=$@
else
  files=`git ls-files`
fi

# hide cursor

hide_cursor
trap show_cursor INT

# loop files

heading
effort $files | tee $tmp && sort_effort
echo

show_cursor