Skip to content

New parameter --since go apply on git log command #8

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion git-heatmap
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ while [[ $# -gt 0 ]]; do
shift
shift
;;
-s|--since)
SINCE="$2"
shift
shift
;;
-h)
cat <<EOF
Heatmap of oft-edited files.
Expand All @@ -51,6 +56,7 @@ Options:
-c <char>, --char <char> Use <char> to draw the bars. [default: █]
-f <cmd>, --filter <cmd> Filter output through <cmd> before creating the
the histogram.
-s <date>, --since <date> Filter git log since <date>. [default: always]
-h Show this message.
EOF
exit
Expand All @@ -67,10 +73,11 @@ REVIEW_BASE=${REVIEW_BASE:-master}
CHAR=${CHAR:-█}
WIDTH=${WIDTH:-60}
FILTER=${FILTER:-cat -}
SINCE=${SINCE:-0001-01-01}

files() {
# https://stackoverflow.com/questions/7577052/
git log --name-status --pretty=format: -- "${ARGV[@]+"${ARGV[@]}"}" | \
git log --since="$SINCE" --name-status --pretty=format: -- "${ARGV[@]+"${ARGV[@]}"}" | \
cut -f 2-
}

Expand Down