Skip to content

Commit

Permalink
git-line-summary: should be the history
Browse files Browse the repository at this point in the history
Also remove some trailing lines after the output.
  • Loading branch information
spacewander committed Jul 23, 2019
1 parent f258733 commit d4de567
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 414 deletions.
5 changes: 0 additions & 5 deletions Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
- [`git ignore`](#git-ignore)
- [`git ignore-io`](#git-ignore-io)
- [`git info`](#git-info)
- [`git line-summary`](#git-line-summary)
- [`git local-commits`](#git-local-commits)
- [`git lock`](#git-lock)
- [`git locked`](#git-locked)
Expand Down Expand Up @@ -214,10 +213,6 @@ project : git-extras
1 Daniel Schildt 0.0%
```

## git line-summary

WARNING: git line-summary has been replaced by [`git summary --line`](#git-summary) and will be removed in a future release.

## 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.
Expand Down
2 changes: 1 addition & 1 deletion Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ in `c:\git`:
install.cmd "C:\git"
```

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

Expand Down
60 changes: 0 additions & 60 deletions bin/git-line-summary

This file was deleted.

56 changes: 46 additions & 10 deletions bin/git-summary
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ file_count() {
# list authors
#

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

#
# list the last modified author for each line
#
single_file() {
while read data
do
if [[ $(file "$data") = *text* ]]; then
git blame --line-porcelain "$data" 2>/dev/null | grep "^author\ " | LC_ALL=C sed -n 's/^author //p';
fi
done
}

#
# list the author for all file
#
lines() {
git ls-files | single_file
}

#
# get the number of the lines
#
line_count() {
lines | wc -l
}

result() {
lines | sort | uniq -c | sort -rn | awk '
{ args[NR] = $0; sum += $0 }
END {
for (i = 1; i <= NR; ++i) {
printf " %s, %2.1f%%\n", args[i], 100 * args[i] / sum
}
}
' | column -t -s,
}

# summary

echo
echo " project : $project"

if test "$1" = "--line"; then
shift
git line-summary "$@"
echo
echo " lines : $(line_count)"
echo " authors :"
lines | sort | uniq -c | sort -rn | format_authors
else

echo
echo " project : $project"
echo " repo age :" $(repository_age)
echo " active :" $(active_days) days
echo " commits :" $(commit_count)
if test "$commit" = ""; then
echo " files :" $(file_count)
fi
echo " authors : "
authors
echo

git shortlog -n -s $commit | format_authors
fi
2 changes: 1 addition & 1 deletion check_integrity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ test $# == 0 && usage

for name in "$@"; do
name=${name#git-}
[[ "$name" == "rscp" || "$name" == "line-summary" ]] && continue
[[ "$name" == "rscp" ]] && continue
check "$name"
done

Expand Down
7 changes: 2 additions & 5 deletions man/git-extras.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-EXTRAS" "1" "June 2019" "" "Git Extras"
.TH "GIT\-EXTRAS" "1" "July 2019" "" "Git Extras"
.
.SH "NAME"
\fBgit\-extras\fR \- Awesome GIT utilities
Expand Down Expand Up @@ -120,9 +120,6 @@ Self update\.
\fBgit\-info(1)\fR Returns information on current repository
.
.IP "\(bu" 4
\fBgit\-line\-summary(1)\fR Show repository summary by line
.
.IP "\(bu" 4
\fBgit\-local\-commits(1)\fR List local commits
.
.IP "\(bu" 4
Expand Down Expand Up @@ -171,7 +168,7 @@ Self update\.
\fBgit\-rename\-branch(1)\fR rename local branch and push to remote
.
.IP "\(bu" 4
\fBgit\-rename\-remote(1)\fR rename a remote
\fBgit\-rename\-remote(1)\fR Rename a remote
.
.IP "\(bu" 4
\fBgit\-rename\-tag(1)\fR Rename a tag
Expand Down
7 changes: 3 additions & 4 deletions man/git-extras.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/git-extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ git-extras(1) -- Awesome GIT utilities
- **git-ignore-io(1)** Get sample gitignore file
- **git-ignore(1)** Add .gitignore patterns
- **git-info(1)** Returns information on current repository
- **git-line-summary(1)** Show repository summary by line
- **git-local-commits(1)** List local commits
- **git-lock(1)** Lock a file excluded from version control
- **git-locked(1)** ls files that have been locked
Expand Down
Loading

0 comments on commit d4de567

Please sign in to comment.