From 4527656f7c168f254e820e9ae10ddcabd46c2940 Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Sat, 8 Aug 2015 01:29:02 +0200 Subject: [PATCH 1/5] effort: rename 'file' to 'path' to be more accurate --- bin/git-effort | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/bin/git-effort b/bin/git-effort index e4819b0..0d7056d 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 From 96329378b9dc2180edeffeadf3e57af6a70e5da4 Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Sat, 8 Aug 2015 04:12:47 +0200 Subject: [PATCH 2/5] effort docs: Adjust numbers in example The values shown can never appear, and makes no sense. --- man/git-effort.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/man/git-effort.md b/man/git-effort.md index 764420d..be41845 100644 --- a/man/git-effort.md +++ b/man/git-effort.md @@ -53,11 +53,12 @@ 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 + ## AUTHOR From d367affd5754951da5db8e8b010c77551181aa55 Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Sat, 8 Aug 2015 04:16:48 +0200 Subject: [PATCH 3/5] effort docs: filename -> path --- man/git-effort.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/man/git-effort.md b/man/git-effort.md index be41845..700dddc 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,9 +25,9 @@ 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 From d51f4fde37f50345ee374a9e6eaa61107924bfdc Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Sat, 8 Aug 2015 04:18:32 +0200 Subject: [PATCH 4/5] effort docs: add example with directories --- man/git-effort.1 | 32 +++++++++++++++++++++++++------- man/git-effort.html | 26 ++++++++++++++++++-------- man/git-effort.md | 9 +++++++++ 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/man/git-effort.1 b/man/git-effort.1 index 5813cad..19f066f 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,10 +40,10 @@ 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" Displays "effort" statistics: @@ -72,11 +72,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..92f0670 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,9 +98,9 @@

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

@@ -126,16 +126,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 +158,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 700dddc..b742702 100644 --- a/man/git-effort.md +++ b/man/git-effort.md @@ -59,6 +59,15 @@ git-effort(1) -- Show effort statistics on file(s) 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 From b1fba8f3fe2daff5a8be9d1d2e94c2a5c2708479 Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Sat, 8 Aug 2015 04:21:26 +0200 Subject: [PATCH 5/5] effort docs: add note about omitting unsorted results --- man/git-effort.1 | 3 +++ man/git-effort.html | 5 ++++- man/git-effort.md | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/man/git-effort.1 b/man/git-effort.1 index 19f066f..ce9afef 100644 --- a/man/git-effort.1 +++ b/man/git-effort.1 @@ -46,6 +46,9 @@ Note: \fBgit\-effort\fR does not accept commit ranges\. 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 diff --git a/man/git-effort.html b/man/git-effort.html index 92f0670..f9d2a8f 100644 --- a/man/git-effort.html +++ b/man/git-effort.html @@ -104,6 +104,9 @@

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
@@ -145,7 +148,7 @@ $ git effort --after="one year ago" --above 5 --author="Leila Muhtasib"
 
 

AUTHOR

-

Written by Leila Muhtasib <muhtasib@gmail.com>

+

Written by Leila Muhtasib <muhtasib@gmail.com>

REPORTING BUGS

diff --git a/man/git-effort.md b/man/git-effort.md index b742702..da031be 100644 --- a/man/git-effort.md +++ b/man/git-effort.md @@ -31,6 +31,9 @@ git-effort(1) -- Show effort statistics on file(s) ## 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