From cdc4d8a0cf3b9fa06bd0e59f7738e08bf9ddbb97 Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Thu, 6 Aug 2015 19:55:44 +0200 Subject: [PATCH 1/6] summary docs: use correct order of arguments If you were to follow the docs on git-summary(1), it would crash. --- man/git-summary.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/git-summary.md b/man/git-summary.md index 9948d3b..bffe1ec 100644 --- a/man/git-summary.md +++ b/man/git-summary.md @@ -3,7 +3,7 @@ git-summary(1) -- Show repository summary ## SYNOPSIS -`git-summary` [<commitish>] [--line] +`git-summary` [--line] [<commitish>] ## DESCRIPTION From ca4cb46dde2ce228da08dda4596b867ff939ebcb Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Thu, 6 Aug 2015 20:01:54 +0200 Subject: [PATCH 2/6] summary docs: explain relation to git-line-summary --- man/git-summary.1 | 6 +++--- man/git-summary.html | 12 +++++++----- man/git-summary.md | 4 +++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/man/git-summary.1 b/man/git-summary.1 index dbcff42..c56f1ed 100644 --- a/man/git-summary.1 +++ b/man/git-summary.1 @@ -1,13 +1,13 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GIT\-SUMMARY" "1" "June 2015" "" "" +.TH "GIT\-SUMMARY" "1" "August 2015" "" "Git Extras" . .SH "NAME" \fBgit\-summary\fR \- Show repository summary . .SH "SYNOPSIS" -\fBgit\-summary\fR [] [\-\-line] +\fBgit\-summary\fR [\-\-line] [] . .SH "DESCRIPTION" Shows a summary of the repository\. @@ -22,7 +22,7 @@ Summarize only the range of commits included in the \. \-\-line . .P -Summarize with lines other than commits +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\. . .SH "EXAMPLES" Outputs a repo summary: diff --git a/man/git-summary.html b/man/git-summary.html index aabb404..1f1629f 100644 --- a/man/git-summary.html +++ b/man/git-summary.html @@ -65,7 +65,7 @@
  1. git-summary(1)
  2. -
  3. +
  4. Git Extras
  5. git-summary(1)
@@ -76,7 +76,7 @@

SYNOPSIS

-

git-summary [<commitish>] [--line]

+

git-summary [--line] [<commitish>]

DESCRIPTION

@@ -90,7 +90,9 @@

--line

-

Summarize with lines other than commits

+

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.

EXAMPLES

@@ -225,7 +227,7 @@ authors :

AUTHOR

-

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

+

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

REPORTING BUGS

@@ -238,7 +240,7 @@ authors :
  1. -
  2. June 2015
  3. +
  4. August 2015
  5. git-summary(1)
diff --git a/man/git-summary.md b/man/git-summary.md index bffe1ec..6f1052e 100644 --- a/man/git-summary.md +++ b/man/git-summary.md @@ -17,7 +17,9 @@ Shows a summary of the repository. --line - Summarize with lines other than commits + 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. ## EXAMPLES From 7fbe00c31135077ef0214fc648ce060cff581e62 Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Thu, 6 Aug 2015 20:05:54 +0200 Subject: [PATCH 3/6] summary docs: Remove --line example Since using --line only makes git-summary call git-line-summary the example is redundant. It is also somewhat smelly to document other functions than it's own like that. --- man/git-summary.1 | 101 ------------------------------------------- man/git-summary.html | 95 +--------------------------------------- man/git-summary.md | 92 --------------------------------------- 3 files changed, 1 insertion(+), 287 deletions(-) diff --git a/man/git-summary.1 b/man/git-summary.1 index c56f1ed..088fc7b 100644 --- a/man/git-summary.1 +++ b/man/git-summary.1 @@ -75,107 +75,6 @@ $ git summary v42\.\. . .IP "" 0 . -.P -For \-\-line options, you can get result calculate by line rather than commit -. -.IP "" 4 -. -.nf - -$ git summary \-\-line - -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% -. -.fi -. -.IP "" 0 -. .SH "AUTHOR" Written by Tj Holowaychuk <\fItj@vision\-media\.ca\fR> . diff --git a/man/git-summary.html b/man/git-summary.html index 1f1629f..b2819c6 100644 --- a/man/git-summary.html +++ b/man/git-summary.html @@ -132,102 +132,9 @@ authors :
$ git summary v42..
 
-

For --line options, you can get result calculate by line rather than commit

- -
$ git summary --line
-
-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 Tj Holowaychuk <tj@vision-media.ca>

+

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

REPORTING BUGS

diff --git a/man/git-summary.md b/man/git-summary.md index 6f1052e..6723a38 100644 --- a/man/git-summary.md +++ b/man/git-summary.md @@ -57,98 +57,6 @@ Shows a summary of the repository. $ git summary v42.. - For --line options, you can get result calculate by line rather than commit - - $ git summary --line - - 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 Tj Holowaychuk <> From b9ca12498016e4ce3763d2beb4723f72e995ee1c Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Fri, 7 Aug 2015 03:16:06 +0200 Subject: [PATCH 4/6] line-summary: tighten regex --- bin/git-line-summary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/git-line-summary b/bin/git-line-summary index 64188c6..a48829b 100755 --- a/bin/git-line-summary +++ b/bin/git-line-summary @@ -9,7 +9,7 @@ function single_file { while read data do if [[ $(file $data) = *text* ]]; then # - git blame --line-porcelain $data 2>/dev/null | grep "author\ " | sed -n 's/^author //p'; + git blame --line-porcelain $data 2>/dev/null | grep "^author\ " | sed -n 's/^author //p'; fi done } From 40023f9f14789b1b7df316defa49c891066f7602 Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Fri, 7 Aug 2015 03:17:05 +0200 Subject: [PATCH 5/6] line-summary: add missing quotation marks --- bin/git-line-summary | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/git-line-summary b/bin/git-line-summary index a48829b..c1313d6 100755 --- a/bin/git-line-summary +++ b/bin/git-line-summary @@ -8,8 +8,8 @@ project=${PWD##*/} function single_file { while read data do - if [[ $(file $data) = *text* ]]; then # - git blame --line-porcelain $data 2>/dev/null | grep "^author\ " | sed -n 's/^author //p'; + if [[ $(file "$data") = *text* ]]; then + git blame --line-porcelain "$data" 2>/dev/null | grep "^author\ " | sed -n 's/^author //p'; fi done } @@ -53,7 +53,7 @@ function result { echo echo " project : $project" -echo " lines :" $(count) +echo " lines : $(count)" echo " authors :" result echo From ff4ad92a7a04dcbe6d6109340b6f0d035579913c Mon Sep 17 00:00:00 2001 From: Nicolai Skogheim Date: Fri, 7 Aug 2015 02:17:46 +0200 Subject: [PATCH 6/6] line-summary: 'function f{...' -> 'f() {...' We use this style more often --- bin/git-line-summary | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/git-line-summary b/bin/git-line-summary index c1313d6..74c0166 100755 --- a/bin/git-line-summary +++ b/bin/git-line-summary @@ -5,7 +5,7 @@ project=${PWD##*/} # # list the last modified author for each line # -function single_file { +single_file() { while read data do if [[ $(file "$data") = *text* ]]; then @@ -17,28 +17,28 @@ function single_file { # # list the author for all file # -function lines { +lines() { git ls-files | single_file } # # count the line count # -function count { +count() { lines | wc -l } # # sort by author modified lines # -function authors { +authors() { lines | sort | uniq -c | sort -rn } # # list as percentage for author modified lines # -function result { +result() { authors | awk ' { args[NR] = $0; sum += $0 } END {