forked from opf/openproject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconflictsStats.sh
More file actions
21 lines (20 loc) · 813 Bytes
/
Copy pathconflictsStats.sh
File metadata and controls
21 lines (20 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
mergeIds=$(git log --pretty=format:'%h' --merges)
mergeCount=$(echo "$mergeIds" | wc -l)
conflictCount=0
totalFileCount=0
for mergeId in $mergeIds; do
log=$(git log $mergeId -n 1)
if [[ $log == *" Conflicts:"* ]]; then
echo "$log"
echo "Conflict: Yes"
fileCount=$(echo "$log" | wc -w)
fileCount=$((fileCount - 8))
echo "Conflicts in $fileCount files"
conflictCount=$((conflictCount + 1))
totalFileCount=$((totalFileCount + fileCount))
fi
done
percentage=$(bc -l <<< "$conflictCount * 100 / $mergeCount")
echo "$percentage % of all non-forward merges had conflicts ($conflictCount / $mergeCount)."
filesPerConflict=$(bc -l <<< "$totalFileCount / $conflictCount")
echo "On average, $filesPerConflict conflicting files per conflicting merge ($totalFileCount / $conflictCount)."