diff --git a/AUTHORS b/AUTHORS index 6e760ad..d1ac7f3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -11,6 +11,7 @@ Patches and Suggestions - Kenneth Reitz - Aggelos Orfanakos +- Jonathan "Duke" Leto - Domenico Rotiroti - Jason Young - Nick Campbell diff --git a/Readme.md b/Readme.md index 448eb15..07b1cbf 100644 --- a/Readme.md +++ b/Readme.md @@ -67,6 +67,10 @@ Outputs a repo summary: 1 isaacs 1 Matt Colyer +This command can also take a commitish, and will print a summary for the range +of commits included in the commitish: + + $ git summary v42.. ## git-repl diff --git a/bin/git-summary b/bin/git-summary index 9996b26..d1333c2 100755 --- a/bin/git-summary +++ b/bin/git-summary @@ -1,14 +1,18 @@ #!/bin/sh +COMMITISH="" +test $# -ne 0 && COMMITISH=$@ project=${PWD##*/} -commit_count=`git log --oneline | wc -l | tr -d ' '` +commit_count=`git log --oneline $COMMITISH | wc -l | tr -d ' '` file_count=`git ls-files | wc -l | tr -d ' '` -authors=`git shortlog -n -s` +authors=`git shortlog -n -s $COMMITISH` echo echo " project: $project" echo " commits: $commit_count" -echo " files : $file_count" +if test "$COMMITISH" = ""; then + echo " files : $file_count" +fi echo " authors: " echo "$authors" -echo \ No newline at end of file +echo