Skip to content

Commit 04eb5c0

Browse files
guenhterguenthgr
andauthored
Repo status overview (#1017)
Co-authored-by: guenthgr <[email protected]>
1 parent e29dcbb commit 04eb5c0

File tree

6 files changed

+65
-9
lines changed

6 files changed

+65
-9
lines changed

Commands.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,13 @@ project : git-extras
221221

222222
The `--line` option can also take a path, which will print a filtered summary for that folder or file.
223223

224+
The option `--oneline` tries to put as much summary information of the repo into a single output line
225+
226+
```bash
227+
$ git summary --oneline
228+
git-extras / age: 5 days / last active: 5 days ago / active on 799 days / commits: 1692 / uncommitted: 4
229+
```
230+
224231
## git effort
225232

226233
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.

bin/git-bulk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ function guardedExecution () {
7070

7171
# atomic git command execution with log
7272
function atomicExecution () {
73-
echo 1>&2 "${bldred}->${reset} executing ${inverse}git $gitcommand${reset}" && git "$@"
73+
[ "${quiet?}" != "true" ] && echo 1>&2 "${bldred}->${reset} executing ${inverse}git $gitcommand${reset}"
74+
git "$@"
7475
}
7576

7677
# check if the passed command is known as a core git command

bin/git-summary

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ cd "$(git root)" || { echo "Can't cd to top level directory";exit 1; }
66
SUMMARY_BY_LINE=
77
DEDUP_BY_EMAIL=
88
MERGES_ARG=
9+
SUMMARY_ONELINE=
910
for arg in "$@"; do
1011
case "$arg" in
1112
--line)
@@ -17,6 +18,9 @@ for arg in "$@"; do
1718
--no-merges)
1819
MERGES_ARG="--no-merges"
1920
;;
21+
--oneline)
22+
SUMMARY_ONELINE=1
23+
;;
2024
-*)
2125
>&2 echo "unknown argument $arg found"
2226
exit 1
@@ -145,7 +149,7 @@ format_authors() {
145149
# fetch repository age from oldest commit
146150
#
147151
repository_age() {
148-
git log --reverse --pretty=oneline --format="%ar" -n 1 | LC_ALL=C sed 's/ago//'
152+
git log --reverse --pretty=oneline --format="%ar" | head -n 1 | LC_ALL=C sed 's/ago//'
149153
}
150154

151155
#
@@ -186,14 +190,19 @@ uncommitted_changes_count() {
186190
}
187191

188192
# summary
189-
echo
190-
echo " project : $project"
191-
192-
if [ -n "$SUMMARY_BY_LINE" ]; then
193+
if [ -n "$SUMMARY_BY_LINE" ] && [ -n "$SUMMARY_ONELINE" ]; then
194+
echo "$project / lines: $(line_count "${paths[@]}")"
195+
elif [ -n "$SUMMARY_BY_LINE" ]; then
196+
echo
197+
echo " project : $project"
193198
echo " lines : $(line_count "${paths[@]}")"
194199
echo " authors :"
195200
lines "${paths[@]}" | sort | uniq -c | sort -rn | format_authors
201+
elif [ -n "$SUMMARY_ONELINE" ]; then
202+
echo "$project / age: $(repository_age) / last active: $(last_active) / active on $(active_days $commit) days / commits: $(commit_count $commit) / uncommitted: $(uncommitted_changes_count)"
196203
else
204+
echo
205+
echo " project : $project"
197206
echo " repo age : $(repository_age)"
198207
echo " last active : $(last_active)"
199208
# shellcheck disable=SC2086

man/git-summary.1

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "GIT\-SUMMARY" "1" "December 2022" "" "Git Extras"
4+
.TH "GIT\-SUMMARY" "1" "January 2023" "" "Git Extras"
55
.
66
.SH "NAME"
77
\fBgit\-summary\fR \- Show repository summary
@@ -65,6 +65,12 @@ Summarize with lines other than commits\. When \fB\-\-line\fR is specified, the
6565
.P
6666
This option can not be used together with \fB\-\-dedup\-by\-email\fR or \fB\-\-no\-merges\fR\.
6767
.
68+
.P
69+
\-\-oneline
70+
.
71+
.P
72+
Summarizes the repository within one line\. Some information like the authors cannot be displayed in this mode\.
73+
.
6874
.SH "EXAMPLES"
6975
Outputs a repo summary:
7076
.
@@ -154,6 +160,20 @@ authors :
154160
.
155161
.IP "" 0
156162
.
163+
.P
164+
Oneline summary
165+
.
166+
.IP "" 4
167+
.
168+
.nf
169+
170+
$ git summary \-\-oneline
171+
git\-extras / age: 5 days / last active: 5 days ago / active on 799 days / commits: 1692 / uncommitted: 4
172+
.
173+
.fi
174+
.
175+
.IP "" 0
176+
.
157177
.SH "AUTHOR"
158178
Written by Tj Holowaychuk <\fItj@vision\-media\.ca\fR>
159179
.

man/git-summary.html

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/git-summary.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Shows a summary of the repository or a path within it.
4545

4646
This option can not be used together with `--dedup-by-email` or `--no-merges`.
4747

48+
--oneline
49+
50+
Summarizes the repository within one line. Some information like the authors cannot be displayed in this mode.
51+
4852
## EXAMPLES
4953

5054
Outputs a repo summary:
@@ -101,6 +105,11 @@ Shows a summary of the repository or a path within it.
101105
authors :
102106
...
103107

108+
Oneline summary
109+
110+
$ git summary --oneline
111+
git-extras / age: 5 days / last active: 5 days ago / active on 799 days / commits: 1692 / uncommitted: 4
112+
104113
## AUTHOR
105114

106115
Written by Tj Holowaychuk &lt;<[email protected]>&gt;

0 commit comments

Comments
 (0)