forked from stdlib-js/stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit_sizes
More file actions
executable file
·36 lines (32 loc) · 992 Bytes
/
commit_sizes
File metadata and controls
executable file
·36 lines (32 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
#
# Computes a commit size.
#
# Notes:
#
# * This is not an exact implementation of the measure described by Riehle, et al. Notably, here, the size may include empty lines, which are explicitly omitted in their measure.
#
# References:
#
# * Riehle, Dirk, Carsten Kolassa, and Michel A. Salim. 2012. "Developer Belief vs. Reality: The Case of the Commit Size Distribution." *Software Engineering 2012, GI-Edition Lecture Notes in Informatics* abs/1408.4644: 59–70. <http://arxiv.org/abs/1408.4644>.
# Determine root directory:
root="$(git rev-parse --show-toplevel)"
# Define the path to a utility to generate commit short stats:
shortstats="${root}/tools/git/scripts/shortstats"
# * `shortstats`
# - Get summary statistics for each commit.
# * `awk '{}'`
# - Compute commit size.
"${shortstats}" | awk '
{
lower_bound = max($9,$10)
upper_bound = $9 + $10
print (lower_bound + upper_bound) / 2
}
function max(a, b) {
if (a > b) {
return a
}
return b
}
'