-
Notifications
You must be signed in to change notification settings - Fork 37
/
new_contribs.sh
executable file
·44 lines (37 loc) · 1.37 KB
/
new_contribs.sh
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
37
38
39
40
41
42
43
44
#!/bin/sh
#
# Small hacky utility to get new contributors in a project-wise fashion.
# So we know when somebody is really new to Redox across all the sub-repos.
#
# I usually run it like:
# ./path/to-redox-website/new_contribs.sh 2017-02-01
#
# From the Redox main repo.
#
# Adapted from the Rust one.
# Create the temp files
touch names_old.txt
touch names_all.txt
#
# Gets the list of commiters for a give git repo. Only runs if the dir is a git repo.
# $1 holds the initial date from where we are gonna start counting.
#
get_new_commiters() {
if git rev-parse --git-dir > /dev/null 2>&1; then
INITIAL_COMMIT=`git log --reverse --pretty=format:%H|head -n1`
START_COMMIT=`git log --before="$1" --pretty=format:%H|head -n1`
ALL_NAMES=`git log $INITIAL_COMMIT.. --pretty=format:%an|sort|uniq`
OLD_NAMES=`git log $INITIAL_COMMIT..$START_COMMIT --pretty=format:%an|sort|uniq`
echo "$OLD_NAMES">>names_old.txt
echo "$ALL_NAMES">>names_all.txt
fi
}
export -f get_new_commiters
# Running the function recursively (defaulting to 1 level deep)
find . -maxdepth 1 -type d -exec bash -c "get_new_commiters $1" {} \;
# Subtracting the names from the initial commit to the start date - all names.
names=`diff names_old.txt names_all.txt`
names=`echo "$names" |grep \> | sed 's/^>//'|sort|uniq`
echo "$names"
# Clean files
rm names_old.txt names_all.txt