Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions bin/git-summary
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ if [ -n "$MERGES_ARG" ] && [ -n "$SUMMARY_BY_LINE" ]; then
fi


commit=""
test $# -ne 0 && commit=$*
if [ -n "$SUMMARY_BY_LINE" ]; then
paths=( "$@" )
else
commit=""
test $# -ne 0 && commit=$*
fi
project=${PWD##*/}

#
Expand Down Expand Up @@ -167,18 +171,14 @@ single_file() {
# list the author for all file
#
lines() {
if [ -n "$1" ]; then
git ls-files -- $1 | single_file
else
git ls-files | single_file
fi
git ls-files -- "$@" | single_file
}

#
# get the number of the lines
#
line_count() {
lines $1 | wc -l
lines "$@" | wc -l
}

# summary
Expand All @@ -187,18 +187,18 @@ echo
echo " project : $project"

if [ -n "$SUMMARY_BY_LINE" ]; then
echo " lines : $(line_count $commit)"
echo " lines : $(line_count "${paths[@]}")"
echo " authors :"
lines $commit | sort | uniq -c | sort -rn | format_authors
lines "${paths[@]}" | sort | uniq -c | sort -rn | format_authors
else

# shellcheck disable=SC2046
echo " repo age :" $(repository_age)
echo " repo age : $(repository_age)"
# shellcheck disable=SC2086
echo " active : $(active_days $commit) days"
# shellcheck disable=SC2086
echo " active :" "$(active_days $commit)" days
echo " commits :" "$(commit_count)"
echo " commits : $(commit_count $commit)"
if test "$commit" = ""; then
echo " files :" "$(file_count)"
echo " files : $(file_count)"
fi
echo " authors : "
if [ -n "$DEDUP_BY_EMAIL" ]; then
Expand Down