diff --git a/bin/git-effort b/bin/git-effort index ee3add4..0d78da7 100755 --- a/bin/git-effort +++ b/bin/git-effort @@ -177,10 +177,6 @@ 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 @@ -191,6 +187,17 @@ if test "${#paths}" -eq 0; then unset save_ifs fi +# set column width to match longest filename +max=0 +for path in "${paths[@]}"; do + cur=${#path} + if [[ $max -lt $cur ]]; then + max=$cur + fi +done +columns=$(( max + 5 )) +export columns + # hide cursor hide_cursor