@@ -41,8 +41,12 @@ if [ -n "$MERGES_ARG" ] && [ -n "$SUMMARY_BY_LINE" ]; then
4141fi
4242
4343
44- commit=" "
45- test $# -ne 0 && commit=$*
44+ if [ -n " $SUMMARY_BY_LINE " ]; then
45+ paths=( " $@ " )
46+ else
47+ commit=" "
48+ test $# -ne 0 && commit=$*
49+ fi
4650project=${PWD##*/ }
4751
4852#
@@ -167,18 +171,14 @@ single_file() {
167171# list the author for all file
168172#
169173lines () {
170- if [ -n " $1 " ]; then
171- git ls-files -- $1 | single_file
172- else
173- git ls-files | single_file
174- fi
174+ git ls-files -- " $@ " | single_file
175175}
176176
177177#
178178# get the number of the lines
179179#
180180line_count () {
181- lines $1 | wc -l
181+ lines " $@ " | wc -l
182182}
183183
184184# summary
@@ -187,18 +187,18 @@ echo
187187echo " project : $project "
188188
189189if [ -n " $SUMMARY_BY_LINE " ]; then
190- echo " lines : $( line_count $commit ) "
190+ echo " lines : $( line_count " ${paths[@]} " ) "
191191 echo " authors :"
192- lines $commit | sort | uniq -c | sort -rn | format_authors
192+ lines " ${paths[@]} " | sort | uniq -c | sort -rn | format_authors
193193else
194194
195- # shellcheck disable=SC2046
196- echo " repo age :" $( repository_age)
195+ echo " repo age : $( repository_age) "
196+ # shellcheck disable=SC2086
197+ echo " active : $( active_days $commit ) days"
197198 # shellcheck disable=SC2086
198- echo " active :" " $( active_days $commit ) " days
199- echo " commits :" " $( commit_count) "
199+ echo " commits : $( commit_count $commit ) "
200200 if test " $commit " = " " ; then
201- echo " files :" " $( file_count) "
201+ echo " files : $( file_count) "
202202 fi
203203 echo " authors : "
204204 if [ -n " $DEDUP_BY_EMAIL " ]; then
0 commit comments