From a2cab5679eaf116bf35c52ad9377273dde13e088 Mon Sep 17 00:00:00 2001 From: Daniel Umpierrez <10012416+havocesp@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:46:42 +0000 Subject: [PATCH 01/10] Update git-count Add --full flag to return all possible local repo commits count. --- bin/git-count | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/git-count b/bin/git-count index 5b2861cb4..b2331ef90 100755 --- a/bin/git-count +++ b/bin/git-count @@ -3,6 +3,11 @@ if test "$1" = "--all"; then git shortlog -n -s | awk '{print substr($0,index($0,$2)) " (" $1 ")"}' echo +elif test "$1" = "--full";then + git rev-list --all --no-max-parents --no-min-parents --count + echo +else + echo total "$(git rev-list --count HEAD)" fi -echo total "$(git rev-list --count HEAD)" + From 0c20c4015402dd4245e9fa7697cfadc0672ad5de Mon Sep 17 00:00:00 2001 From: Daniel Umpierrez <10012416+havocesp@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:49:01 +0000 Subject: [PATCH 02/10] Update git-count Removed echo after git command execution. --- bin/git-count | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bin/git-count b/bin/git-count index b2331ef90..5abc7a514 100755 --- a/bin/git-count +++ b/bin/git-count @@ -2,12 +2,8 @@ if test "$1" = "--all"; then git shortlog -n -s | awk '{print substr($0,index($0,$2)) " (" $1 ")"}' - echo elif test "$1" = "--full";then git rev-list --all --no-max-parents --no-min-parents --count - echo else - echo total "$(git rev-list --count HEAD)" + echo total "$(git rev-list --count HEAD)" fi - - From a3c3d1bb45f2343ae5025fda13ad64220a6c3b62 Mon Sep 17 00:00:00 2001 From: Havocesp <= 10012416+havocesp@users.noreply.github.com> Date: Tue, 7 Nov 2023 18:12:38 +0000 Subject: [PATCH 03/10] Upadte bash completion with --full flag for git count. --- etc/bash_completion.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index 6d4b3bdda..1246ef58c 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -64,7 +64,7 @@ _git_contrib(){ } _git_count(){ - __gitcomp "--all" + __gitcomp "--all --full" } __git_cp(){ From 54150fb8584f95ccd84b3d0f31b54ab4a9354144 Mon Sep 17 00:00:00 2001 From: Daniel Umpierrez <10012416+havocesp@users.noreply.github.com> Date: Thu, 9 Nov 2023 03:25:27 +0000 Subject: [PATCH 04/10] Added short flags -a and -f to git-count and also updated zsh and fish completion files. --- bin/git-count | 6 +++--- etc/git-extras-completion.zsh | 4 ++-- etc/git-extras.fish | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/git-count b/bin/git-count index 5abc7a514..bc97a47a6 100755 --- a/bin/git-count +++ b/bin/git-count @@ -1,9 +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 ")"}' -elif test "$1" = "--full";then - git rev-list --all --no-max-parents --no-min-parents --count +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 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 From 4752c50c3e11896b69bc48525fa40a645dc02ceb Mon Sep 17 00:00:00 2001 From: Daniel Umpierrez <10012416+havocesp@users.noreply.github.com> Date: Thu, 9 Nov 2023 03:38:24 +0000 Subject: [PATCH 05/10] Minor updates to git-count. Added short flags "-a" for "--all" and "-f" for "--full" to git-count. Updated zsh and fish completion files with new flags added. From 9e68dd9fa026d6e7b697f0dba5bbaaac02d5afea Mon Sep 17 00:00:00 2001 From: Daniel Umpierrez <10012416+havocesp@users.noreply.github.com> Date: Thu, 9 Nov 2023 03:42:49 +0000 Subject: [PATCH 06/10] Update bash_completion.sh --- etc/bash_completion.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index 1246ef58c..11325fc42 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -64,7 +64,7 @@ _git_contrib(){ } _git_count(){ - __gitcomp "--all --full" + __gitcomp "--all --full -a -f" } __git_cp(){ From 6f5356b7e037f768017a87aa20c2d418535af7be Mon Sep 17 00:00:00 2001 From: Daniel Umpierrez <10012416+havocesp@users.noreply.github.com> Date: Thu, 9 Nov 2023 04:19:26 +0000 Subject: [PATCH 07/10] Update git-count.md Added --full flag as possible argument and a short example. --- man/git-count.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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: From 12ae847e5d28c1a8d46fce8c1e0653545a5f70f3 Mon Sep 17 00:00:00 2001 From: Daniel Umpierrez <10012416+havocesp@users.noreply.github.com> Date: Thu, 9 Nov 2023 04:22:11 +0000 Subject: [PATCH 08/10] Update git-count.html Added --full flag and a short example at git-count.html file. --- man/git-count.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 @@
git-count
[--all]
git-count
[-a|--all] [-f|--full]
--all
+--full
Show commit count details.
@@ -123,6 +124,11 @@$ git count --full
+
+ 1904
+
+
Written by Tj Holowaychuk <tj@vision-media.ca>
From 53ed45317c1f5a805c24178f57879dcc4d523ce3 Mon Sep 17 00:00:00 2001 From: Daniel Umpierrez <10012416+havocesp@users.noreply.github.com> Date: Thu, 9 Nov 2023 04:24:59 +0000 Subject: [PATCH 09/10] Update git-count.1 Added --full flag and a short example at git-count.1 man page file. --- man/git-count.1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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" From bc384beb48360faf6d2d3acc0021ae254c6b806a Mon Sep 17 00:00:00 2001 From: Daniel Umpierrez <10012416+havocesp@users.noreply.github.com> Date: Sun, 10 Dec 2023 05:00:33 +0000 Subject: [PATCH 10/10] Update bin/git-count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 罗泽轩