diff --git a/bin/git-effort b/bin/git-effort index 4528ec9a3..e4bc12ade 100755 --- a/bin/git-effort +++ b/bin/git-effort @@ -104,7 +104,7 @@ effort() { len=${#path} dot="." f_dot="$path" - i=0 ; while test $i -lt $((45-$len)) ; do + i=0 ; while test $i -lt $(( $columns - $len )) ; do f_dot=$f_dot$dot i=$(($i+1)) done @@ -124,7 +124,7 @@ effort() { heading() { echo - printf " %-45s %-10s %s\n" 'path' 'commits' 'active days' + printf " %-${columns}s %-10s %s\n" 'path' 'commits' 'active days' echo } @@ -177,6 +177,10 @@ fi args_to_git_log="${args_to_git_log#\ \'\'}" export args_to_git_log +# set column width to match longest filename +columns=$(( $(git ls-files | awk '{ print length }' | sort -rn | head -1 ) + 5 )) +export columns + # [path ...] if test "${#paths}" -eq 0; then