9ns: don't pass user pointers for 'spec'
[akaros.git] / scripts / git / git-gerrit-track-review
1 #!/bin/bash
2 # Barret Rhoden (brho@cs.berkeley.edu)
3 # Copyright 2016 Google Inc
4 #
5 # Tracks a gerrit branch and runs checkpatch on the commits from the
6 # merge point of master to the tip of the branch.
7
8 PATCHDIR="${PATCHDIR:-../patches}"
9
10 usage()
11 {
12         echo "$0 <gerrit-number> <local-branch-name>"
13         exit -1
14 }
15
16 if [ $# -lt 2 ]
17 then
18         usage
19 fi
20
21 if [ ! -f ./scripts/checkpatch.pl ]
22 then
23         echo "Run from the root of the Akaros repo"
24         exit -1
25 fi
26
27 git gerrit-track $1 $2
28
29 if [ $? -ne 0 ]
30 then
31         exit -1
32 fi
33
34 FROM=`git merge-base master $2`
35
36 if [ $? -ne 0 ]
37 then
38         echo "From failed; $FROM"
39         exit -1
40 fi
41
42 ls $PATCHDIR/*.patch 2>/dev/null
43
44 if [ $? -eq 0 ]
45 then
46         echo "$PATCHDIR has patches, remove and try again"
47         exit -1
48 fi
49
50 git format-patch -k -M -N -o $PATCHDIR $FROM..$2
51
52 ./scripts/checkpatch.pl $PATCHDIR/*