From 1a96108ba9cdf56240a9b5eee3ecea80dc179909 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 31 Dec 2025 04:03:45 +0900 Subject: [PATCH] home/git/author-lines.sh: skip binary files --- home/programs/git/scripts/git-author-lines.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/home/programs/git/scripts/git-author-lines.sh b/home/programs/git/scripts/git-author-lines.sh index d888379..93c03e1 100644 --- a/home/programs/git/scripts/git-author-lines.sh +++ b/home/programs/git/scripts/git-author-lines.sh @@ -11,8 +11,10 @@ fi git ls-tree -r "${REF}" \ | while read -r _filemode _objtype _githash filepath; do - git blame --line-porcelain "${filepath}" -done \ + if git grep -Il . -- "$filepath" >/dev/null; then + git --no-pager blame --line-porcelain "${filepath}" + fi + done \ | grep --binary-files=without-match '^author ' \ | sed -e 's/author //' \ | awk '{ a[$0]+=1 } END{ for (i in a) { print a[i],i } }' \