Skip to content

Commit

Permalink
Group commits per author kamranahmedse#63
Browse files Browse the repository at this point in the history
  • Loading branch information
oussamabadr committed Sep 14, 2022
1 parent ce40800 commit b9fb276
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions git-standup
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ function colored() {
GIT_PRETTY_DATE="%ad"
fi

GIT_PRETTY_FORMAT="%Cred%h%Creset - %s %Cgreen($GIT_PRETTY_DATE) %C(bold blue)<%an>%Creset"
if [[ $GIT_LOG = "shortlog" ]]; then
GIT_PRETTY_FORMAT="%Cred%h%Creset - %s %Cgreen($GIT_PRETTY_DATE) %Creset"
else
GIT_PRETTY_FORMAT="%Cred%h%Creset - %s %Cgreen($GIT_PRETTY_DATE) %C(bold blue)<%an>%Creset"
fi

COLOR=always

if [[ ${option_g:=} ]]; then
Expand All @@ -71,7 +76,12 @@ function uncolored() {
GIT_PRETTY_DATE="%ad"
fi

GIT_PRETTY_FORMAT="%h - %s ($GIT_PRETTY_DATE) <%an>"
if [[ $GIT_LOG = "shortlog" ]]; then
GIT_PRETTY_FORMAT="%h - %s ($GIT_PRETTY_DATE)"
else
GIT_PRETTY_FORMAT="%h - %s ($GIT_PRETTY_DATE) <%an>"
fi

COLOR=never

if [[ $option_g ]]; then
Expand Down Expand Up @@ -124,9 +134,9 @@ function runStandup() {
fi
}

while getopts "hgfsd:u:a:w:m:D:A:B:LrcRFb:" opt; do
while getopts "hgfsd:u:a:w:m:D:A:B:LrcRFGb:" opt; do
case $opt in
h | d | u | a | w | m | g | D | f | s | L | r | A | B | c | R | F | b)
h | d | u | a | w | m | g | D | f | s | L | r | A | B | c | R | F | G | b)
declare "option_$opt=${OPTARG:-0}"
;;
\?)
Expand All @@ -150,6 +160,21 @@ if [[ ${option_h:=} ]]; then
exit 0
fi

AUTHOR=$(git config user.name)
GIT_LOG="log"

if [[ ${option_a:=} ]]; then
# In case the parameter
if [[ $option_a = 'all' ]]; then
AUTHOR=".*"
if [[ ${option_G:=} ]]; then
GIT_LOG="shortlog"
fi
else
AUTHOR="$option_a"
fi
fi

# Use colors, but only if connected to a terminal, and that terminal supports them.
if [[ -t 1 ]] && [[ -n "$TERM" ]] && command -v tput &> /dev/null && tput colors &> /dev/null; then
ncolors=$(tput colors)
Expand Down Expand Up @@ -263,25 +288,14 @@ for DIR in ${PROJECT_DIRS}; do
if [[ ! -d ".git" || -f ".git" ]]; then
cd "${BASE_DIR}" || exit
continue
fi

AUTHOR=$(git config user.name)

if [[ ${option_a:=} ]]; then
# In case the parameter
if [[ $option_a = 'all' ]]; then
AUTHOR=".*"
else
AUTHOR="$option_a"
fi
fi
fi

GIT_BRANCH_FILTER="--all"
if [[ ${option_b:=} ]]; then
GIT_BRANCH_FILTER="--first-parent $option_b"
fi

GIT_LOG_COMMAND="git --no-pager log \
GIT_LOG_COMMAND="git --no-pager ${GIT_LOG} \
${GIT_BRANCH_FILTER}
--no-merges
--since=\"$SINCE\"
Expand Down

0 comments on commit b9fb276

Please sign in to comment.