From d4de567ca7d77fe888420888c678609bf4a1f5b8 Mon Sep 17 00:00:00 2001 From: spacewander Date: Tue, 23 Jul 2019 22:01:59 +0800 Subject: [PATCH] git-line-summary: should be the history Also remove some trailing lines after the output. --- Commands.md | 5 - Installation.md | 2 +- bin/git-line-summary | 60 ------------ bin/git-summary | 56 +++++++++-- check_integrity.sh | 2 +- man/git-extras.1 | 7 +- man/git-extras.html | 7 +- man/git-extras.md | 1 - man/git-line-summary.html | 200 -------------------------------------- man/git-line-summary.md | 116 ---------------------- man/git-summary.1 | 4 +- man/git-summary.html | 9 +- man/git-summary.md | 5 +- man/index.txt | 1 - 14 files changed, 61 insertions(+), 414 deletions(-) delete mode 100755 bin/git-line-summary delete mode 100644 man/git-line-summary.html delete mode 100644 man/git-line-summary.md diff --git a/Commands.md b/Commands.md index fc9671fd1..26876b460 100644 --- a/Commands.md +++ b/Commands.md @@ -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) @@ -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. diff --git a/Installation.md b/Installation.md index d05b89e40..037bbd715 100644 --- a/Installation.md +++ b/Installation.md @@ -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. diff --git a/bin/git-line-summary b/bin/git-line-summary deleted file mode 100755 index 940bd7326..000000000 --- a/bin/git-line-summary +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash - -project=${PWD##*/} - -# -# 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 -} - -# -# count the line count -# -count() { - lines | wc -l -} - -# -# sort by author modified lines -# -authors() { - lines | sort | uniq -c | sort -rn -} - -# -# list as percentage for author modified lines -# -result() { - authors | 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" -echo " lines : $(count)" -echo " authors :" -result -echo - diff --git a/bin/git-summary b/bin/git-summary index 5388866fb..fca942f9c 100755 --- a/bin/git-summary +++ b/bin/git-summary @@ -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) { @@ -68,16 +68,54 @@ 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) @@ -85,7 +123,5 @@ else echo " files :" $(file_count) fi echo " authors : " - authors - echo - + git shortlog -n -s $commit | format_authors fi diff --git a/check_integrity.sh b/check_integrity.sh index 4d61a30d7..3a687515f 100755 --- a/check_integrity.sh +++ b/check_integrity.sh @@ -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 diff --git a/man/git-extras.1 b/man/git-extras.1 index af071d6dd..76fd6d905 100644 --- a/man/git-extras.1 +++ b/man/git-extras.1 @@ -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 @@ -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 @@ -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 diff --git a/man/git-extras.html b/man/git-extras.html index 8266e9770..bfeddf27f 100644 --- a/man/git-extras.html +++ b/man/git-extras.html @@ -124,7 +124,6 @@

COMMANDS

  • 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
  • @@ -141,7 +140,7 @@

    COMMANDS

  • git-refactor(1) Create refactor branch
  • git-release(1) Commit, tag and push changes to the repository
  • git-rename-branch(1) rename local branch and push to remote
  • -
  • git-rename-remote(1) rename a remote
  • +
  • git-rename-remote(1) Rename a remote
  • git-rename-tag(1) Rename a tag
  • git-repl(1) git read-eval-print-loop
  • git-reset-file(1) Reset one file
  • @@ -165,7 +164,7 @@

    COMMANDS

    AUTHOR

    -

    Written by Tj Holowaychuk <tj@vision-media.ca>

    +

    Written by Tj Holowaychuk <tj@vision-media.ca>

    REPORTING BUGS

    @@ -178,7 +177,7 @@

    SEE ALSO

    1. -
    2. June 2019
    3. +
    4. July 2019
    5. git-extras(1)
    diff --git a/man/git-extras.md b/man/git-extras.md index 5dadc90ff..ab09ec63b 100644 --- a/man/git-extras.md +++ b/man/git-extras.md @@ -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 diff --git a/man/git-line-summary.html b/man/git-line-summary.html deleted file mode 100644 index 349a86010..000000000 --- a/man/git-line-summary.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - git-line-summary(1) - Show repository summary by line - - - - -
    - - - -
      -
    1. git-line-summary(1)
    2. -
    3. Git Extras
    4. -
    5. git-line-summary(1)
    6. -
    - -

    NAME

    -

    - git-line-summary - Show repository summary by line -

    - -

    SYNOPSIS

    - -

    git-line-summary

    - -

    DESCRIPTION

    - -

    Show a summary by line of the repository, rather than by commit like git-summary.

    - -

    EXAMPLES

    - -

    Outputs a repo summary by line.

    - -
    $ git line-summary
    -
    -project  : git-extras
    -lines    : 16004
    -authors  :
    -7757 hemanth.hm                48.5%
    -1019 spacewander               6.4%
    - 916 CJ                        5.7%
    - 768 Jonhnny Weslley           4.8%
    - 711 Mark Eissler              4.4%
    - 678 timfeirg                  4.2%
    - 474 Ivan Malopinsky           3.0%
    - 387 nickl-                    2.4%
    - 368 Tj Holowaychuk            2.3%
    - 337 Paul Schreiber            2.1%
    - 269 Jesús Espino              1.7%
    - 266 wooorm                    1.7%
    - 236 Chris Hall                1.5%
    - 217 TJ Holowaychuk            1.4%
    - 205 Leila Muhtasib            1.3%
    - 178 Hemanth.HM                1.1%
    - 107 Niklas Fiekas             0.7%
    -  80 Andy                      0.5%
    -  74 soffolk                   0.5%
    -  68 Julio Napurí              0.4%
    -  67 Philipp Klose             0.4%
    -  66 Sasha Khamkov             0.4%
    -  66 Nate Jones                0.4%
    -  65 Kenneth Reitz             0.4%
    -  64 Rico Sta. Cruz            0.4%
    -  49 Bruno Sutic               0.3%
    -  36 chernjie                  0.2%
    -  35 Titus Wormer              0.2%
    -  35 Michael Komitee           0.2%
    -  33 David Hartmann            0.2%
    -  28 Kevin Woo                 0.2%
    -  27 Todd Wolfson              0.2%
    -  22 David Baumgold            0.1%
    -  22 Carl Casbolt              0.1%
    -  18 Ciro Nunes                0.1%
    -  18 Andrew Starr-Bochicchio   0.1%
    -  16 Valérian Galliat          0.1%
    -  16 Riceball LEE              0.1%
    -  16 Damian Krzeminski         0.1%
    -  12 nulltask                  0.1%
    -  12 Richard Littauer          0.1%
    -  11 Jesse Sipprell            0.1%
    -  10 meza                      0.1%
    -  10 dead-horse                0.1%
    -   9 Kylie McClain             0.1%
    -   9 Camille Reynders          0.1%
    -   8 Jon Ander Peñalba         0.0%
    -   8 Guillaume Seren           0.0%
    -   8 Adam Parkin               0.0%
    -   7 Newell Zhu                0.0%
    -   7 Florian H                 0.0%
    -   7 Andre Cerqueira           0.0%
    -   6 zeroDivisible             0.0%
    -   6 Rasmus Wriedt Larsen      0.0%
    -   6 Konstantin Schukraft      0.0%
    -   5 Dan Jackson               0.0%
    -   4 jykntr                    0.0%
    -   3 phigoro                   0.0%
    -   3 eszabpt                   0.0%
    -   3 Raphael Fleischlin        0.0%
    -   3 Curtis McEnroe            0.0%
    -   3 Balazs Nadasdi            0.0%
    -   3 Alex McHale               0.0%
    -   2 Not Committed Yet         0.0%
    -   2 Joshua Appelman           0.0%
    -   2 Evan Grim                 0.0%
    -   2 Dave James Miller         0.0%
    -   2 Alexander Krasnukhin      0.0%
    -   2 Aggelos Orfanakos         0.0%
    -   1 Wil Moore III             0.0%
    -   1 TweeKane                  0.0%
    -   1 Tony                      0.0%
    -   1 Ryan Bohn                 0.0%
    -   1 Rob Kennedy               0.0%
    -   1 Phally                    0.0%
    -   1 Moritz Grauel             0.0%
    -   1 Jonathan "Duke" Leto      0.0%
    -   1 Jianjin Fan               0.0%
    -   1 Jean Jordaan              0.0%
    -   1 Jan Krueger               0.0%
    -   1 Hogan Long                0.0%
    -   1 Dung Quang                0.0%
    -   1 Brandon Zylstra           0.0%
    -   1 Aurélien Scoubeau         0.0%
    -
    - -

    AUTHOR

    - -

    Written by Newell Zhu <zlx.star@gmail.com>

    - -

    REPORTING BUGS

    - -

    <https://github.com/tj/git-extras/issues>

    - -

    SEE ALSO

    - -

    <https://github.com/tj/git-extras>

    - - -
      -
    1. -
    2. October 2017
    3. -
    4. git-line-summary(1)
    5. -
    - -
    - - diff --git a/man/git-line-summary.md b/man/git-line-summary.md deleted file mode 100644 index 02d33ddd9..000000000 --- a/man/git-line-summary.md +++ /dev/null @@ -1,116 +0,0 @@ -git-line-summary(1) -- Show repository summary by line -================================ - -## SYNOPSIS - -`git-line-summary` - -## DESCRIPTION - -Show a summary by line of the repository, rather than by commit like git-summary. - -## EXAMPLES - - Outputs a repo summary by line. - - $ git line-summary - - project : git-extras - lines : 16004 - authors : - 7757 hemanth.hm 48.5% - 1019 spacewander 6.4% - 916 CJ 5.7% - 768 Jonhnny Weslley 4.8% - 711 Mark Eissler 4.4% - 678 timfeirg 4.2% - 474 Ivan Malopinsky 3.0% - 387 nickl- 2.4% - 368 Tj Holowaychuk 2.3% - 337 Paul Schreiber 2.1% - 269 Jesús Espino 1.7% - 266 wooorm 1.7% - 236 Chris Hall 1.5% - 217 TJ Holowaychuk 1.4% - 205 Leila Muhtasib 1.3% - 178 Hemanth.HM 1.1% - 107 Niklas Fiekas 0.7% - 80 Andy 0.5% - 74 soffolk 0.5% - 68 Julio Napurí 0.4% - 67 Philipp Klose 0.4% - 66 Sasha Khamkov 0.4% - 66 Nate Jones 0.4% - 65 Kenneth Reitz 0.4% - 64 Rico Sta. Cruz 0.4% - 49 Bruno Sutic 0.3% - 36 chernjie 0.2% - 35 Titus Wormer 0.2% - 35 Michael Komitee 0.2% - 33 David Hartmann 0.2% - 28 Kevin Woo 0.2% - 27 Todd Wolfson 0.2% - 22 David Baumgold 0.1% - 22 Carl Casbolt 0.1% - 18 Ciro Nunes 0.1% - 18 Andrew Starr-Bochicchio 0.1% - 16 Valérian Galliat 0.1% - 16 Riceball LEE 0.1% - 16 Damian Krzeminski 0.1% - 12 nulltask 0.1% - 12 Richard Littauer 0.1% - 11 Jesse Sipprell 0.1% - 10 meza 0.1% - 10 dead-horse 0.1% - 9 Kylie McClain 0.1% - 9 Camille Reynders 0.1% - 8 Jon Ander Peñalba 0.0% - 8 Guillaume Seren 0.0% - 8 Adam Parkin 0.0% - 7 Newell Zhu 0.0% - 7 Florian H 0.0% - 7 Andre Cerqueira 0.0% - 6 zeroDivisible 0.0% - 6 Rasmus Wriedt Larsen 0.0% - 6 Konstantin Schukraft 0.0% - 5 Dan Jackson 0.0% - 4 jykntr 0.0% - 3 phigoro 0.0% - 3 eszabpt 0.0% - 3 Raphael Fleischlin 0.0% - 3 Curtis McEnroe 0.0% - 3 Balazs Nadasdi 0.0% - 3 Alex McHale 0.0% - 2 Not Committed Yet 0.0% - 2 Joshua Appelman 0.0% - 2 Evan Grim 0.0% - 2 Dave James Miller 0.0% - 2 Alexander Krasnukhin 0.0% - 2 Aggelos Orfanakos 0.0% - 1 Wil Moore III 0.0% - 1 TweeKane 0.0% - 1 Tony 0.0% - 1 Ryan Bohn 0.0% - 1 Rob Kennedy 0.0% - 1 Phally 0.0% - 1 Moritz Grauel 0.0% - 1 Jonathan "Duke" Leto 0.0% - 1 Jianjin Fan 0.0% - 1 Jean Jordaan 0.0% - 1 Jan Krueger 0.0% - 1 Hogan Long 0.0% - 1 Dung Quang 0.0% - 1 Brandon Zylstra 0.0% - 1 Aurélien Scoubeau 0.0% - -## AUTHOR - -Written by Newell Zhu <> - -## REPORTING BUGS - -<> - -## SEE ALSO - -<> diff --git a/man/git-summary.1 b/man/git-summary.1 index be96f1603..83ec205d5 100644 --- a/man/git-summary.1 +++ b/man/git-summary.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GIT\-SUMMARY" "1" "October 2017" "" "Git Extras" +.TH "GIT\-SUMMARY" "1" "July 2019" "" "Git Extras" . .SH "NAME" \fBgit\-summary\fR \- Show repository summary @@ -22,7 +22,7 @@ Summarize only the range of commits included in the \. \-\-line . .P -Summarize with lines other than commits\. This actually just results in a call to \fBgit\-line\-summary\fR(1)\. Any is ignored when \-\-line is specified\. See \fBgit\-line\-summary\fR(1) for more info\. +Summarize with lines other than commits\. Any is ignored when \-\-line is specified\. . .SH "EXAMPLES" Outputs a repo summary: diff --git a/man/git-summary.html b/man/git-summary.html index e9f31a65e..686ac78f2 100644 --- a/man/git-summary.html +++ b/man/git-summary.html @@ -90,9 +90,8 @@

    OPTIONS

    --line

    -

    Summarize with lines other than commits. This actually just results in a call - to git-line-summary(1). Any <commitish> is ignored when --line is specified. - See git-line-summary(1) for more info.

    +

    Summarize with lines other than commits. + Any <commitish> is ignored when --line is specified.

    EXAMPLES

    @@ -134,7 +133,7 @@

    EXAMPLES

    AUTHOR

    -

    Written by Tj Holowaychuk <tj@vision-media.ca>

    +

    Written by Tj Holowaychuk <tj@vision-media.ca>

    REPORTING BUGS

    @@ -147,7 +146,7 @@

    SEE ALSO

    1. -
    2. October 2017
    3. +
    4. July 2019
    5. git-summary(1)
    diff --git a/man/git-summary.md b/man/git-summary.md index 6723a3804..9c580699d 100644 --- a/man/git-summary.md +++ b/man/git-summary.md @@ -17,9 +17,8 @@ Shows a summary of the repository. --line - Summarize with lines other than commits. This actually just results in a call - to `git-line-summary`(1). Any <commitish> is ignored when --line is specified. - See `git-line-summary`(1) for more info. + Summarize with lines other than commits. + Any <commitish> is ignored when --line is specified. ## EXAMPLES diff --git a/man/index.txt b/man/index.txt index 27a4f399d..e90c14c02 100644 --- a/man/index.txt +++ b/man/index.txt @@ -30,7 +30,6 @@ git-guilt(1) git-guilt git-ignore-io(1) git-ignore-io git-ignore(1) git-ignore git-info(1) git-info -git-line-summary(1) git-line-summary git-local-commits(1) git-local-commits git-lock(1) git-lock git-locked(1) git-locked