Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added --full flag to "git-count" #1105

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Added short flags -a and -f to git-count and also updated zsh and fis…
…h completion files.
havocesp authored Nov 9, 2023
commit 54150fb8584f95ccd84b3d0f31b54ab4a9354144
6 changes: 3 additions & 3 deletions bin/git-count
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions etc/git-extras-completion.zsh
Original file line number Diff line number Diff line change
@@ -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() {
3 changes: 2 additions & 1 deletion etc/git-extras.fish
Original file line number Diff line number Diff line change
@@ -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