diff --git a/bin/git-count b/bin/git-count index 5b2861cb4..c0aea1c83 100755 --- a/bin/git-count +++ b/bin/git-count @@ -1,8 +1,9 @@ #!/usr/bin/env bash -if test "$1" = "--all"; then +if test "$1" = "--all" || test "$1" = "-a"; then git shortlog -n -s | awk '{print substr($0,index($0,$2)) " (" $1 ")"}' - echo +elif test "$1" = "--full" || test "$1" = "-f"; then + git rev-list --all --tags --branches --full-history --no-max-parents --no-min-parents --count +else + echo total "$(git rev-list --count HEAD)" fi - -echo total "$(git rev-list --count HEAD)" diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index 6d4b3bdda..11325fc42 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -64,7 +64,7 @@ _git_contrib(){ } _git_count(){ - __gitcomp "--all" + __gitcomp "--all --full -a -f" } __git_cp(){ diff --git a/etc/git-extras-completion.zsh b/etc/git-extras-completion.zsh index 33c8c195b..42e76edec 100644 --- a/etc/git-extras-completion.zsh +++ b/etc/git-extras-completion.zsh @@ -139,10 +139,10 @@ _git-contrib() { ':author:__gitex_author_names' } - _git-count() { _arguments \ - '--all[detailed commit count]' + '(-a --all)'{-a,--all}'[detailed commit count]' \ + '(-f --full)'{-f,--full}'[output a full commits count including all, branches, tags, ...]' } _git-create-branch() { diff --git a/etc/git-extras.fish b/etc/git-extras.fish index 0a0b49d2e..76e0a371a 100644 --- a/etc/git-extras.fish +++ b/etc/git-extras.fish @@ -129,7 +129,8 @@ end complete -c git -f -n '__fish_git_using_command coauthor; and __fish_git_arg_number 2' -a '(__fish_git_extra_coauthor_name)' complete -c git -f -n '__fish_git_using_command coauthor; and __fish_git_arg_number 3' -a '(__fish_git_extra_coauthor_email)' # count -complete -c git -f -n '__fish_git_using_command count' -l all -d 'detailed commit count' +complete -c git -f -n '__fish_git_using_command count' -s a -l all -d 'detailed commit count' +complete -c git -f -n '__fish_git_using_command count' -s f -l full -d 'output a full commits count including all, branches, tags, ...' # create-branch complete -c git -x -n '__fish_git_using_command create-branch' -s r -l remote -a '(__fish_git_unique_remote_branches)' -d 'setup remote tracking branch' # delete-branch diff --git a/man/git-count.1 b/man/git-count.1 index 7deace3e2..41be67922 100644 --- a/man/git-count.1 +++ b/man/git-count.1 @@ -7,13 +7,14 @@ \fBgit\-count\fR \- Show commit count . .SH "SYNOPSIS" -\fBgit\-count\fR [\-\-all] +\fBgit\-count\fR [\-a\|\-\-all] [\-f\|\-\-full] . .SH "DESCRIPTION" Show commit count\. . .SH "OPTIONS" \-\-all +\-\-full . .P Show commit count details\. @@ -65,6 +66,14 @@ $ git count \-\-all . .fi . +.nf + +$ git count \-\-full + + 1904 +. +.fi +. .IP "" 0 . .SH "AUTHOR" diff --git a/man/git-count.html b/man/git-count.html index 6afd1e1e0..c26371a04 100644 --- a/man/git-count.html +++ b/man/git-count.html @@ -76,7 +76,7 @@

NAME

SYNOPSIS

-

git-count [--all]

+

git-count [-a|--all] [-f|--full]

DESCRIPTION

@@ -85,6 +85,7 @@

DESCRIPTION

OPTIONS

--all

+

--full

Show commit count details.

@@ -123,6 +124,11 @@

EXAMPLES

total 1844 +
$ git count --full
+
+  1904
+
+

AUTHOR

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

diff --git a/man/git-count.md b/man/git-count.md index cd15df570..37862667c 100644 --- a/man/git-count.md +++ b/man/git-count.md @@ -3,7 +3,7 @@ git-count(1) -- Show commit count ## SYNOPSIS -`git-count` [--all] +`git-count` [-a|--all] [-f|--full] ## DESCRIPTION @@ -12,6 +12,7 @@ git-count(1) -- Show commit count ## OPTIONS --all + --full Show commit count details. @@ -23,6 +24,12 @@ git-count(1) -- Show commit count $ git count total 1844 + + Output full commits total: + + $ git count --full + + 1904 Output verbose commit count details: