From b8b8121e028f50fa81185502d773625ed38d27df Mon Sep 17 00:00:00 2001 From: Esa Jokinen Date: Sun, 7 Apr 2024 20:04:07 +0300 Subject: [PATCH] git-find-commits-by-file-hash.sh minor improvements --- bin/git-find-commits-by-file-hash.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/git-find-commits-by-file-hash.sh b/bin/git-find-commits-by-file-hash.sh index 467d1e6..a368c4a 100755 --- a/bin/git-find-commits-by-file-hash.sh +++ b/bin/git-find-commits-by-file-hash.sh @@ -68,7 +68,7 @@ cd "$(git rev-parse --show-toplevel)" \ # Search for the hash & show stats of matching commits -matches=$( \ +matches=$( git log --oneline --no-abbrev-commit --follow -- "$2" \ | awk '{print $1}' \ | while read -r commit; do @@ -81,7 +81,7 @@ matches=$( \ | grep -E "[0-9a-f]*:\ $1" ) -if [[ "$matches" = [0-9a-f]* ]]; then +if [[ "$matches" =~ [0-9a-f]+ ]]; then echo "$matches" \ | awk -F: '{print $1}' \ | xargs git show --stat