diff --git a/bin/git-effort b/bin/git-effort index f2d410f..6ee45bb 100755 --- a/bin/git-effort +++ b/bin/git-effort @@ -54,13 +54,13 @@ color_for() { } # -# compute the effort of the given +# compute the effort of the given # effort() { - file=$1 + path=$1 local commit_dates - commit_dates=`dates "$file"` + commit_dates=`dates "$path"` [ $? -gt 0 ] && exit 255 # Ensure it's not just an empty line @@ -77,9 +77,9 @@ effort() { # commits color_for $(( $commits - $above )) - len=${#file} + len=${#path} dot="." - f_dot="$file" + f_dot="$path" i=0 ; while test $i -lt $((45-$len)) ; do f_dot=$f_dot$dot i=$(($i+1)) @@ -100,7 +100,7 @@ effort() { heading() { echo - printf " %-45s %-10s %s\n" 'file' 'commits' 'active days' + printf " %-45s %-10s %s\n" 'path' 'commits' 'active days' echo } @@ -118,7 +118,7 @@ sort_effort() { above_index=0 has_above=false next_is_above=false -num_files=0 +num_paths=0 # Some implementations of `seq` gives "1\n0" for seq 0 if [ $# -gt 0 ] ; then @@ -145,7 +145,7 @@ if [ $# -gt 0 ] ; then --*) ;; *) - num_files=$(( num_files + 1 )) + num_paths=$(( num_paths + 1 )) ;; esac done @@ -159,7 +159,7 @@ fi args_before_above=`printf " %q" "${@:1:$above_index}"` -num_args=$(( i - num_files )) +num_args=$(( i - num_paths )) if $has_above ; then offset=2 ; else offset=0 ; fi from=$(( 1 + above_index + offset )) len=$(( num_args - $(( above_index + offset)) )) @@ -171,15 +171,15 @@ shift $num_args export args_to_git_log -# [file ...] +# [path ...] -declare -a files=() +declare -a paths=() if test $# -ge 1; then - files=("$@") + paths=("$@") else save_ifs=$IFS IFS=`echo -en "\n\b"` - files=(`git ls-files`) + paths=(`git ls-files`) IFS=$safe_ifs unset save_ifs fi @@ -207,10 +207,10 @@ if [ $? -eq 0 ] ; then fi heading -# send files to effort -printf "%s\0" "${files[@]}" | xargs -0 -n 1 -P 4 -I % bash $bash_params -c "effort \"%\"" | tee $tmp +# send paths to effort +printf "%s\0" "${paths[@]}" | xargs -0 -n 1 -P 4 -I % bash $bash_params -c "effort \"%\"" | tee $tmp -# if more than one file, sort and print +# if more than one path, sort and print test "$(wc -l $tmp | awk '{print $1}')" -gt 1 && sort_effort echo diff --git a/man/git-effort.1 b/man/git-effort.1 index 5813cad..ce9afef 100644 --- a/man/git-effort.1 +++ b/man/git-effort.1 @@ -1,13 +1,13 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GIT\-EFFORT" "1" "July 2015" "" "Git Extras" +.TH "GIT\-EFFORT" "1" "August 2015" "" "Git Extras" . .SH "NAME" \fBgit\-effort\fR \- Show effort statistics on file(s) . .SH "SYNOPSIS" -\fBgit\-effort\fR [\-\-above ] [] [] +\fBgit\-effort\fR [\-\-above ] [] [[\-\-] \.\.\.] . .SH "DESCRIPTION" Shows effort statistics about files in the repository\. @@ -40,12 +40,15 @@ to read about options to limit which commits are counted\. Note: \fBgit\-effort\fR does not accept commit ranges\. . .P - +[\-\-] \.\.\. . .P -Only display effort statistics for a specific filename\. +Only count commits that touches the given paths\. . .SH "EXAMPLES" +Note: Output will first appear unsorted, then the screen is cleared and the sorted list is output\. The initial unsorted list is not shown in the examples for brevity\. +. +.P Displays "effort" statistics: . .IP "" 4 @@ -72,11 +75,29 @@ $ git effort \-\-after="one year ago" \-\-above 5 \-\-author="Leila Muhtasib" file commits active days git\-extras 15 12 - git\-release 6 9 + git\-release 6 4 git\-effort 6 2 git\-ignore 4 4 - git\-changelog 3 5 - git\-graft 2 3 + git\-changelog 3 2 + git\-graft 2 2 +. +.fi +. +.IP "" 0 +. +.P +Showing statistics on directories is also possible +. +.IP "" 4 +. +.nf + +$ git effort bin man + + file commits active days + + bin\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\. 406 232 + man\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\. 118 80 . .fi . diff --git a/man/git-effort.html b/man/git-effort.html index b72b5eb..f9d2a8f 100644 --- a/man/git-effort.html +++ b/man/git-effort.html @@ -76,7 +76,7 @@

SYNOPSIS

-

git-effort [--above <value>] [<options>] [<filename>]

+

git-effort [--above <value>] [<options>] [[--] <path>...]

DESCRIPTION

@@ -98,12 +98,15 @@

Note: git-effort does not accept commit ranges.

-

<filename>

+

[--] <path>...

-

Only display effort statistics for a specific filename.

+

Only count commits that touches the given paths.

EXAMPLES

+

Note: Output will first appear unsorted, then the screen is cleared and the sorted + list is output. The initial unsorted list is not shown in the examples for brevity.

+

Displays "effort" statistics:

$ git effort --above 5
@@ -126,16 +129,26 @@ $ git effort --after="one year ago" --above 5 --author="Leila Muhtasib"
   file                                          commits    active days
 
   git-extras                                    15         12
-  git-release                                   6          9
+  git-release                                   6          4
   git-effort                                    6          2
   git-ignore                                    4          4
-  git-changelog                                 3          5
-  git-graft                                     2          3
+  git-changelog                                 3          2
+  git-graft                                     2          2
+
+ +

Showing statistics on directories is also possible

+ +
$ git effort bin man
+
+  file                                          commits    active days
+
+  bin.......................................... 406         232
+  man.......................................... 118         80
 

AUTHOR

-

Written by Leila Muhtasib <muhtasib@gmail.com>

+

Written by Leila Muhtasib <muhtasib@gmail.com>

REPORTING BUGS

@@ -148,7 +161,7 @@ $ git effort --after="one year ago" --above 5 --author="Leila Muhtasib"
  1. -
  2. July 2015
  3. +
  4. August 2015
  5. git-effort(1)
diff --git a/man/git-effort.md b/man/git-effort.md index 764420d..da031be 100644 --- a/man/git-effort.md +++ b/man/git-effort.md @@ -3,7 +3,7 @@ git-effort(1) -- Show effort statistics on file(s) ## SYNOPSIS -`git-effort` [--above <value>] [<options>] [<filename>] +`git-effort` [--above <value>] [<options>] [[--] <path>...] ## DESCRIPTION @@ -25,12 +25,15 @@ git-effort(1) -- Show effort statistics on file(s) Note: `git-effort` does not accept commit ranges. - <filename> + [--] <path>... - Only display effort statistics for a specific filename. + Only count commits that touches the given paths. ## EXAMPLES + Note: Output will first appear unsorted, then the screen is cleared and the sorted + list is output. The initial unsorted list is not shown in the examples for brevity. + Displays "effort" statistics: $ git effort --above 5 @@ -53,11 +56,21 @@ git-effort(1) -- Show effort statistics on file(s) file commits active days git-extras 15 12 - git-release 6 9 + git-release 6 4 git-effort 6 2 git-ignore 4 4 - git-changelog 3 5 - git-graft 2 3 + git-changelog 3 2 + git-graft 2 2 + + Showing statistics on directories is also possible + + $ git effort bin man + + file commits active days + + bin.......................................... 406 232 + man.......................................... 118 80 + ## AUTHOR