Last active
February 21, 2021 19:23
-
-
Save d/30c7988ae62ca7a7ee18900647225ae1 to your computer and use it in GitHub Desktop.
when did this function become dead?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e -u -o pipefail | |
pretty_log() { | |
git --no-pager log --color --abbrev=16 --abbrev-commit --topo-order -n8 -S "${func_name}" -- '*.cpp' '*.h' '*.inl' | |
} | |
count_occurrences() { | |
git --no-pager log --abbrev=16 --pretty=tformat:%h -n8 -S "${func_name}" -- '*.cpp' '*.h' '*.inl' | parallel -qj1 --load 125% -X git grep -cwF "${func_name}" {} -- '*.cpp' '*.h' '*.inl' | |
} | |
_main() { | |
local cmd func_name | |
cmd=$1 | |
func_name=$2 | |
case "${cmd}" in | |
both) | |
echo "${func_name}" | |
printf '%s\n' log count | parallel -q --load 125% "$0" {} "${func_name}" | |
;; | |
log) | |
pretty_log | |
;; | |
count) | |
count_occurrences | |
;; | |
esac | |
} | |
_main "$@" |
Author
d
commented
Feb 21, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment