Skip to content

Commit

Permalink
git-find-commits-by-file-hash.sh minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
oh2fih committed Apr 7, 2024
1 parent 40a47bc commit b8b8121
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/git-find-commits-by-file-hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b8b8121

Please sign in to comment.