Skip to content

Commit d4de567

Browse files
committed
git-line-summary: should be the history
Also remove some trailing lines after the output.
1 parent f258733 commit d4de567

14 files changed

+61
-414
lines changed

Commands.md

-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
- [`git ignore`](#git-ignore)
3131
- [`git ignore-io`](#git-ignore-io)
3232
- [`git info`](#git-info)
33-
- [`git line-summary`](#git-line-summary)
3433
- [`git local-commits`](#git-local-commits)
3534
- [`git lock`](#git-lock)
3635
- [`git locked`](#git-locked)
@@ -214,10 +213,6 @@ project : git-extras
214213
1 Daniel Schildt 0.0%
215214
```
216215

217-
## git line-summary
218-
219-
WARNING: git line-summary has been replaced by [`git summary --line`](#git-summary) and will be removed in a future release.
220-
221216
## git effort
222217

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

Installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ in `c:\git`:
8383
install.cmd "C:\git"
8484
```
8585

86-
Last, to use `git line-summary`, `git summary` and `git ignore-io`, you need to copy
86+
Last, to use `git summary` and `git ignore-io`, you need to copy
8787
`column.exe` from a [msys2][1] installation from `folder-your-msys2-installed/usr/bin`
8888
to `folder-your-git-installed/usr/bin` or wait for git 2.7.1, which will include column.exe.
8989

bin/git-line-summary

-60
This file was deleted.

bin/git-summary

+46-10
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ file_count() {
4646
# list authors
4747
#
4848

49-
authors() {
49+
format_authors() {
5050
# a rare unicode character is used as separator to avoid conflicting with
5151
# author name. However, Linux column utility will escape tab if separator
5252
# specified, so we do unesaping after it.
53-
git shortlog -n -s $commit | LC_ALL=C awk '
53+
LC_ALL=C awk '
5454
{ args[NR] = $0; sum += $0 }
5555
END {
5656
for (i = 1; i <= NR; ++i) {
@@ -68,24 +68,60 @@ repository_age() {
6868
git log --reverse --pretty=oneline --format="%ar" | head -n 1 | LC_ALL=C sed 's/ago//'
6969
}
7070

71+
#
72+
# list the last modified author for each line
73+
#
74+
single_file() {
75+
while read data
76+
do
77+
if [[ $(file "$data") = *text* ]]; then
78+
git blame --line-porcelain "$data" 2>/dev/null | grep "^author\ " | LC_ALL=C sed -n 's/^author //p';
79+
fi
80+
done
81+
}
82+
83+
#
84+
# list the author for all file
85+
#
86+
lines() {
87+
git ls-files | single_file
88+
}
89+
90+
#
91+
# get the number of the lines
92+
#
93+
line_count() {
94+
lines | wc -l
95+
}
96+
97+
result() {
98+
lines | sort | uniq -c | sort -rn | awk '
99+
{ args[NR] = $0; sum += $0 }
100+
END {
101+
for (i = 1; i <= NR; ++i) {
102+
printf " %s, %2.1f%%\n", args[i], 100 * args[i] / sum
103+
}
104+
}
105+
' | column -t -s,
106+
}
107+
71108
# summary
72109

110+
echo
111+
echo " project : $project"
112+
73113
if test "$1" = "--line"; then
74-
shift
75-
git line-summary "$@"
76-
echo
114+
echo " lines : $(line_count)"
115+
echo " authors :"
116+
lines | sort | uniq -c | sort -rn | format_authors
77117
else
78118

79-
echo
80-
echo " project : $project"
81119
echo " repo age :" $(repository_age)
82120
echo " active :" $(active_days) days
83121
echo " commits :" $(commit_count)
84122
if test "$commit" = ""; then
85123
echo " files :" $(file_count)
86124
fi
87125
echo " authors : "
88-
authors
89-
echo
90-
126+
git shortlog -n -s $commit | format_authors
91127
fi

check_integrity.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ test $# == 0 && usage
8282

8383
for name in "$@"; do
8484
name=${name#git-}
85-
[[ "$name" == "rscp" || "$name" == "line-summary" ]] && continue
85+
[[ "$name" == "rscp" ]] && continue
8686
check "$name"
8787
done
8888

man/git-extras.1

+2-5
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\-EXTRAS" "1" "June 2019" "" "Git Extras"
4+
.TH "GIT\-EXTRAS" "1" "July 2019" "" "Git Extras"
55
.
66
.SH "NAME"
77
\fBgit\-extras\fR \- Awesome GIT utilities
@@ -120,9 +120,6 @@ Self update\.
120120
\fBgit\-info(1)\fR Returns information on current repository
121121
.
122122
.IP "\(bu" 4
123-
\fBgit\-line\-summary(1)\fR Show repository summary by line
124-
.
125-
.IP "\(bu" 4
126123
\fBgit\-local\-commits(1)\fR List local commits
127124
.
128125
.IP "\(bu" 4
@@ -171,7 +168,7 @@ Self update\.
171168
\fBgit\-rename\-branch(1)\fR rename local branch and push to remote
172169
.
173170
.IP "\(bu" 4
174-
\fBgit\-rename\-remote(1)\fR rename a remote
171+
\fBgit\-rename\-remote(1)\fR Rename a remote
175172
.
176173
.IP "\(bu" 4
177174
\fBgit\-rename\-tag(1)\fR Rename a tag

man/git-extras.html

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/git-extras.md

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ git-extras(1) -- Awesome GIT utilities
5151
- **git-ignore-io(1)** Get sample gitignore file
5252
- **git-ignore(1)** Add .gitignore patterns
5353
- **git-info(1)** Returns information on current repository
54-
- **git-line-summary(1)** Show repository summary by line
5554
- **git-local-commits(1)** List local commits
5655
- **git-lock(1)** Lock a file excluded from version control
5756
- **git-locked(1)** ls files that have been locked

0 commit comments

Comments
 (0)