-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproposal-details
executable file
·85 lines (68 loc) · 1.61 KB
/
proposal-details
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
. legit-setup.sh
require_work_tree
proposal=
get_proposal()
{
proposal=`git show-ref -s $1`
if [ -z "$proposal" ]; then
echo "fatal: $1 could not be resolved to a commit"
usage
fi
git checkout --quiet tracking -- .tracking/proposals/$proposal
}
do_diff=true
do_reviews=true
do_proposal=true
while test $# != 0
do
case "$1" in
-p|--proposal)
shift
proposal_branch=$1
if [ -z "$proposal_branch" ]; then
echo "-p|--proposal requires a proposal"
usage
fi
get_proposal $proposal_branch
;;
--no-diff)
do_diff=false ;;
--no-reviews)
do_reviews=false ;;
--no-proposal)
do_proposal=false ;;
*)
usage
esac
shift
done
if [ -z "$proposal" ]; then
head=`git symbolic-ref -q HEAD`
if [[ $head != refs/heads/proposals/* ]]; then
echo "You have not provided a proposal, and are not currently in a proposal branch"
usage
fi
get_proposal $head
fi
if test true = "$do_proposal"
then
cat .tracking/proposals/$proposal/proposal
echo ""
fi
if test true = "$do_diff"
then
start=$(read_header start .tracking/proposals/$proposal/proposal)
git diff $start..$proposal
echo ""
fi
if test true = "$do_reviews"
then
for file in $(find .tracking/proposals/$proposal/* -printf %f\\n)
do
if [[ $file != "proposal" ]] && [ -n "$file" ]; then
cat .tracking/proposals/$proposal/$file
fi
done
fi
git rm --quiet -f -r .tracking/