mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
Repo status overview (#1017)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
This commit is contained in:
parent
e29dcbb023
commit
04eb5c04e6
|
|
@ -221,6 +221,13 @@ project : git-extras
|
|||
|
||||
The `--line` option can also take a path, which will print a filtered summary for that folder or file.
|
||||
|
||||
The option `--oneline` tries to put as much summary information of the repo into a single output line
|
||||
|
||||
```bash
|
||||
$ git summary --oneline
|
||||
git-extras / age: 5 days / last active: 5 days ago / active on 799 days / commits: 1692 / uncommitted: 4
|
||||
```
|
||||
|
||||
## git effort
|
||||
|
||||
Displays "effort" statistics, currently just the number of commits per file, showing highlighting where the most activity is. The "active days" column is the total number of days which contributed modifications to this file.
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ function guardedExecution () {
|
|||
|
||||
# atomic git command execution with log
|
||||
function atomicExecution () {
|
||||
echo 1>&2 "${bldred}->${reset} executing ${inverse}git $gitcommand${reset}" && git "$@"
|
||||
[ "${quiet?}" != "true" ] && echo 1>&2 "${bldred}->${reset} executing ${inverse}git $gitcommand${reset}"
|
||||
git "$@"
|
||||
}
|
||||
|
||||
# check if the passed command is known as a core git command
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ cd "$(git root)" || { echo "Can't cd to top level directory";exit 1; }
|
|||
SUMMARY_BY_LINE=
|
||||
DEDUP_BY_EMAIL=
|
||||
MERGES_ARG=
|
||||
SUMMARY_ONELINE=
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--line)
|
||||
|
|
@ -17,6 +18,9 @@ for arg in "$@"; do
|
|||
--no-merges)
|
||||
MERGES_ARG="--no-merges"
|
||||
;;
|
||||
--oneline)
|
||||
SUMMARY_ONELINE=1
|
||||
;;
|
||||
-*)
|
||||
>&2 echo "unknown argument $arg found"
|
||||
exit 1
|
||||
|
|
@ -145,7 +149,7 @@ format_authors() {
|
|||
# fetch repository age from oldest commit
|
||||
#
|
||||
repository_age() {
|
||||
git log --reverse --pretty=oneline --format="%ar" -n 1 | LC_ALL=C sed 's/ago//'
|
||||
git log --reverse --pretty=oneline --format="%ar" | head -n 1 | LC_ALL=C sed 's/ago//'
|
||||
}
|
||||
|
||||
#
|
||||
|
|
@ -186,14 +190,19 @@ uncommitted_changes_count() {
|
|||
}
|
||||
|
||||
# summary
|
||||
echo
|
||||
echo " project : $project"
|
||||
|
||||
if [ -n "$SUMMARY_BY_LINE" ]; then
|
||||
if [ -n "$SUMMARY_BY_LINE" ] && [ -n "$SUMMARY_ONELINE" ]; then
|
||||
echo "$project / lines: $(line_count "${paths[@]}")"
|
||||
elif [ -n "$SUMMARY_BY_LINE" ]; then
|
||||
echo
|
||||
echo " project : $project"
|
||||
echo " lines : $(line_count "${paths[@]}")"
|
||||
echo " authors :"
|
||||
lines "${paths[@]}" | sort | uniq -c | sort -rn | format_authors
|
||||
elif [ -n "$SUMMARY_ONELINE" ]; then
|
||||
echo "$project / age: $(repository_age) / last active: $(last_active) / active on $(active_days $commit) days / commits: $(commit_count $commit) / uncommitted: $(uncommitted_changes_count)"
|
||||
else
|
||||
echo
|
||||
echo " project : $project"
|
||||
echo " repo age : $(repository_age)"
|
||||
echo " last active : $(last_active)"
|
||||
# shellcheck disable=SC2086
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "GIT\-SUMMARY" "1" "December 2022" "" "Git Extras"
|
||||
.TH "GIT\-SUMMARY" "1" "January 2023" "" "Git Extras"
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBgit\-summary\fR \- Show repository summary
|
||||
|
|
@ -65,6 +65,12 @@ Summarize with lines other than commits\. When \fB\-\-line\fR is specified, the
|
|||
.P
|
||||
This option can not be used together with \fB\-\-dedup\-by\-email\fR or \fB\-\-no\-merges\fR\.
|
||||
.
|
||||
.P
|
||||
\-\-oneline
|
||||
.
|
||||
.P
|
||||
Summarizes the repository within one line\. Some information like the authors cannot be displayed in this mode\.
|
||||
.
|
||||
.SH "EXAMPLES"
|
||||
Outputs a repo summary:
|
||||
.
|
||||
|
|
@ -154,6 +160,20 @@ authors :
|
|||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
Oneline summary
|
||||
.
|
||||
.IP "" 4
|
||||
.
|
||||
.nf
|
||||
|
||||
$ git summary \-\-oneline
|
||||
git\-extras / age: 5 days / last active: 5 days ago / active on 799 days / commits: 1692 / uncommitted: 4
|
||||
.
|
||||
.fi
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.SH "AUTHOR"
|
||||
Written by Tj Holowaychuk <\fItj@vision\-media\.ca\fR>
|
||||
.
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@ $ git summary --dedup-by-email
|
|||
|
||||
<p> This option can not be used together with <code>--dedup-by-email</code> or <code>--no-merges</code>.</p>
|
||||
|
||||
<p> --oneline</p>
|
||||
|
||||
<p> Summarizes the repository within one line. Some information like the authors cannot be displayed in this mode.</p>
|
||||
|
||||
<h2 id="EXAMPLES">EXAMPLES</h2>
|
||||
|
||||
<p> Outputs a repo summary:</p>
|
||||
|
|
@ -179,9 +183,15 @@ authors :
|
|||
...
|
||||
</code></pre>
|
||||
|
||||
<p> Oneline summary</p>
|
||||
|
||||
<pre><code>$ git summary --oneline
|
||||
git-extras / age: 5 days / last active: 5 days ago / active on 799 days / commits: 1692 / uncommitted: 4
|
||||
</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>
|
||||
|
||||
|
|
@ -194,7 +204,7 @@ authors :
|
|||
|
||||
<ol class='man-decor man-foot man foot'>
|
||||
<li class='tl'></li>
|
||||
<li class='tc'>December 2022</li>
|
||||
<li class='tc'>January 2023</li>
|
||||
<li class='tr'>git-summary(1)</li>
|
||||
</ol>
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ Shows a summary of the repository or a path within it.
|
|||
|
||||
This option can not be used together with `--dedup-by-email` or `--no-merges`.
|
||||
|
||||
--oneline
|
||||
|
||||
Summarizes the repository within one line. Some information like the authors cannot be displayed in this mode.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
Outputs a repo summary:
|
||||
|
|
@ -101,6 +105,11 @@ Shows a summary of the repository or a path within it.
|
|||
authors :
|
||||
...
|
||||
|
||||
Oneline summary
|
||||
|
||||
$ git summary --oneline
|
||||
git-extras / age: 5 days / last active: 5 days ago / active on 799 days / commits: 1692 / uncommitted: 4
|
||||
|
||||
## AUTHOR
|
||||
|
||||
Written by Tj Holowaychuk <<tj@vision-media.ca>>
|
||||
|
|
|
|||
Loading…
Reference in a new issue