compare_results-v2.sh 632 B

123456789101112131415161718192021
  1. #!/bin/env bash
  2. project="$1"
  3. issuesFile="$2"
  4. resultsFile="$3"
  5. handMatched="$4"
  6. bugToIntroDir="$5"
  7. bugs=$(grep "^$project " "$handMatched"| cut -f2)
  8. for bug in $bugs ; do
  9. fix=$(jq -r ".[\"-$bug\"].hash" "$issuesFile")
  10. blamed=$(jq "unique | .[] | select(.[0] == \"$fix\")[1]" "$resultsFile" | tr -d '"')
  11. groundTruth=$(grep -E "^$project $bug" "$handMatched" | cut -f 5 | tr , ' ')
  12. match=0
  13. for commit in $blamed ; do
  14. if grep -q "$commit" <(echo $groundTruth) ; then ((match++)) ; fi
  15. done
  16. szz=$(echo "$blamed" | wc -w)
  17. form=$(echo "$groundTruth" | wc -w)
  18. echo "$bug,$szz,$match,$form"
  19. done