mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
git-summary: support filtering --line with path
This commit is contained in:
parent
d28ad34bcb
commit
ffad35c8db
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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] [<committish>]
|
||||
\fBgit\-summary\fR [\-\-line] [\-\-dedup\-by\-email] [<committish or path>]
|
||||
.
|
||||
.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 <committish>\.
|
||||
.
|
||||
.P
|
||||
<path>
|
||||
.
|
||||
.P
|
||||
Summarize only the range of files included in the <path>\.
|
||||
.
|
||||
.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 <committish> is ignored when \-\-line is specified\.
|
||||
Summarize with lines other than commits\. When \fB\-\-line\fR is specified, the last argument is treated as <path>\.
|
||||
.
|
||||
.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>
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
|
||||
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
||||
|
||||
<p><code>git-summary</code> [--line] [--dedup-by-email] [<committish>]</p>
|
||||
<p><code>git-summary</code> [--line] [--dedup-by-email] [<committish or path>]</p>
|
||||
|
||||
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
||||
|
||||
|
|
@ -88,6 +88,10 @@
|
|||
|
||||
<p> Summarize only the range of commits included in the <committish>.</p>
|
||||
|
||||
<p> <path></p>
|
||||
|
||||
<p> Summarize only the range of files included in the <path>.</p>
|
||||
|
||||
<p> --dedup-by-email</p>
|
||||
|
||||
<p> Remove duplicate authors who belong to the same email address.
|
||||
|
|
@ -108,7 +112,7 @@ $ git summary --dedup-by-email
|
|||
<p> --line</p>
|
||||
|
||||
<p> Summarize with lines other than commits.
|
||||
Any <committish> is ignored when --line is specified.</p>
|
||||
When <code>--line</code> is specified, the last argument is treated as <path>.</p>
|
||||
|
||||
<h2 id="EXAMPLES">EXAMPLES</h2>
|
||||
|
||||
|
|
@ -158,11 +162,19 @@ authors :
|
|||
...
|
||||
</code></pre>
|
||||
|
||||
<p> The committish is ignored when --line is specified.</p>
|
||||
<p> Filter with the path:</p>
|
||||
|
||||
<pre><code>$ git summary --line bin/
|
||||
|
||||
project : git-extras
|
||||
lines : 4420
|
||||
authors :
|
||||
...
|
||||
</code></pre>
|
||||
|
||||
<h2 id="AUTHOR">AUTHOR</h2>
|
||||
|
||||
<p>Written by Tj Holowaychuk <<a href="mailto:tj@vision-media.ca" data-bare-link="true">tj@vision-media.ca</a>></p>
|
||||
<p>Written by Tj Holowaychuk <<a href="mailto:tj@vision-media.ca" data-bare-link="true">tj@vision-media.ca</a>></p>
|
||||
|
||||
<h2 id="REPORTING-BUGS">REPORTING BUGS</h2>
|
||||
|
||||
|
|
@ -175,7 +187,7 @@ authors :
|
|||
|
||||
<ol class='man-decor man-foot man foot'>
|
||||
<li class='tl'></li>
|
||||
<li class='tc'>August 2020</li>
|
||||
<li class='tc'>July 2021</li>
|
||||
<li class='tr'>git-summary(1)</li>
|
||||
</ol>
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue