-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmerge-proposal
executable file
·53 lines (42 loc) · 1.28 KB
/
merge-proposal
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
#!/bin/sh
. legit-setup.sh
# Has this repo been legitimised?
if ! git show-ref --quiet refs/heads/tracking; then
die "fatal: no tracking branch exists"
fi
# Check we're not in a locked branch, or the tracking branch
orig_head=`git symbolic-ref -q --short HEAD`
if [ "$orig_head" = "tracking" ]; then
die "fatal: you are in the tracking branch. Please checkout the
the branch you wish to review."
fi
if test -a .git/MERGE_HEAD
then
merge=$(cat .git/MERGE_HEAD)
git commit -m "Merged"
git checkout -b proposals/merge
git propose --is-merge $merge -m "Merge"
git checkout $orig_head
git reset --hard HEAD~1
exit 0
fi
# The commit at the head of the proposal is used as it's ID
name=`git rev-parse --verify HEAD`
# Let's do this
git checkout --quiet tracking
# Hash collisions shouldn't happen...
if [ ! -d .tracking/proposals/$name ]; then
die_neatly "fatal: this proposal doesn't exist"
fi
voteThreshold=$(git config --file config general.voteThreshold)
if ! test -z $voteThreshold && test $(read_header status .tracking/proposals/$name/proposal) != "Accepted"
then
die_neatly "fatal: this proposal cannot be merged"
fi
if merge $name keep
then
echo "Automatic Merge Successful"
else
echo "Automatic Merge Failed"
fi
git checkout --quiet $orig_head