diff --git a/bin/git-summary b/bin/git-summary
index 003019d..4acb19e 100755
--- a/bin/git-summary
+++ b/bin/git-summary
@@ -156,14 +156,18 @@ single_file() {
# list the author for all file
#
lines() {
- git ls-files | single_file
+ if [ -n "$1" ]; then
+ git ls-files -- $1 | single_file
+ else
+ git ls-files | single_file
+ fi
}
#
# get the number of the lines
#
line_count() {
- lines | wc -l
+ lines $1 | wc -l
}
# summary
@@ -172,9 +176,9 @@ echo
echo " project : $project"
if [ -n "$SUMMARY_BY_LINE" ]; then
- echo " lines : $(line_count)"
+ echo " lines : $(line_count $commit)"
echo " authors :"
- lines | sort | uniq -c | sort -rn | format_authors
+ lines $commit | sort | uniq -c | sort -rn | format_authors
else
# shellcheck disable=SC2046
diff --git a/man/git-summary.1 b/man/git-summary.1
index 9be6b61..83e0ed5 100644
--- a/man/git-summary.1
+++ b/man/git-summary.1
@@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "GIT\-SUMMARY" "1" "August 2020" "" "Git Extras"
+.TH "GIT\-SUMMARY" "1" "July 2021" "" "Git Extras"
.
.SH "NAME"
\fBgit\-summary\fR \- Show repository summary
.
.SH "SYNOPSIS"
-\fBgit\-summary\fR [\-\-line] [\-\-dedup\-by\-email] []
+\fBgit\-summary\fR [\-\-line] [\-\-dedup\-by\-email] []
.
.SH "DESCRIPTION"
Shows a summary of the repository\.
@@ -19,6 +19,12 @@ Shows a summary of the repository\.
Summarize only the range of commits included in the \.
.
.P
+
+.
+.P
+Summarize only the range of files included in the \.
+.
+.P
\-\-dedup\-by\-email
.
.P
@@ -48,7 +54,7 @@ This option can not be used together with \fB\-\-line\fR\.
\-\-line
.
.P
-Summarize with lines other than commits\. Any is ignored when \-\-line is specified\.
+Summarize with lines other than commits\. When \fB\-\-line\fR is specified, the last argument is treated as \.
.
.SH "EXAMPLES"
Outputs a repo summary:
@@ -120,7 +126,22 @@ authors :
.IP "" 0
.
.P
-The committish is ignored when \-\-line is specified\.
+Filter with the path:
+.
+.IP "" 4
+.
+.nf
+
+$ git summary \-\-line bin/
+
+project : git\-extras
+lines : 4420
+authors :
+ \.\.\.
+.
+.fi
+.
+.IP "" 0
.
.SH "AUTHOR"
Written by Tj Holowaychuk <\fItj@vision\-media\.ca\fR>
diff --git a/man/git-summary.html b/man/git-summary.html
index dbfcd1b..41bfe90 100644
--- a/man/git-summary.html
+++ b/man/git-summary.html
@@ -76,7 +76,7 @@
SYNOPSIS
-git-summary [--line] [--dedup-by-email] [<committish>]
+git-summary [--line] [--dedup-by-email] [<committish or path>]
DESCRIPTION
@@ -88,6 +88,10 @@
Summarize only the range of commits included in the <committish>.
+ <path>
+
+ Summarize only the range of files included in the <path>.
+
--dedup-by-email
Remove duplicate authors who belong to the same email address.
@@ -108,7 +112,7 @@ $ git summary --dedup-by-email
--line
Summarize with lines other than commits.
- Any <committish> is ignored when --line is specified.
+ When --line is specified, the last argument is treated as <path>.
EXAMPLES
@@ -158,11 +162,19 @@ authors :
...
- The committish is ignored when --line is specified.
+ Filter with the path:
+
+$ git summary --line bin/
+
+project : git-extras
+lines : 4420
+authors :
+ ...
+
AUTHOR
-Written by Tj Holowaychuk <tj@vision-media.ca>
+Written by Tj Holowaychuk <tj@vision-media.ca>
REPORTING BUGS
@@ -175,7 +187,7 @@ authors :
diff --git a/man/git-summary.md b/man/git-summary.md
index a134aab..e81366d 100644
--- a/man/git-summary.md
+++ b/man/git-summary.md
@@ -3,7 +3,7 @@ git-summary(1) -- Show repository summary
## SYNOPSIS
-`git-summary` [--line] [--dedup-by-email] [<committish>]
+`git-summary` [--line] [--dedup-by-email] [<committish or path>]
## DESCRIPTION
@@ -15,6 +15,10 @@ Shows a summary of the repository.
Summarize only the range of commits included in the <committish>.
+ <path>
+
+ Summarize only the range of files included in the <path>.
+
--dedup-by-email
Remove duplicate authors who belong to the same email address.
@@ -34,7 +38,7 @@ Shows a summary of the repository.
--line
Summarize with lines other than commits.
- Any <committish> is ignored when --line is specified.
+ When `--line` is specified, the last argument is treated as <path>.
## EXAMPLES
@@ -81,7 +85,14 @@ Shows a summary of the repository.
authors :
...
- The committish is ignored when --line is specified.
+ Filter with the path:
+
+ $ git summary --line bin/
+
+ project : git-extras
+ lines : 4420
+ authors :
+ ...
## AUTHOR