7 function set_hooks_commit_msg()
9 f=".git/hooks/commit-msg";
10 u="http://review.gluster.com/tools/hooks/commit-msg";
16 curl -o $f $u || wget -O $f $u;
18 chmod +x .git/hooks/commit-msg;
28 [ -z "$(echo $num | sed -e 's/[0-9]//g')" ]
32 function rebase_changes()
36 GIT_EDITOR=$0 git rebase -i origin/$branch;
40 function editor_mode()
42 if [ $(basename "$1") = "git-rebase-todo" ]; then
43 sed -i 's/^pick /reword /g' "$1";
47 if [ $(basename "$1") = "COMMIT_EDITMSG" ]; then
48 if grep -qi '^BUG: ' $1; then
52 echo Commit: "\"$(head -n 1 $1)\""
53 echo -n "Enter Bug ID: "
55 if [ -z "$bug" ]; then
58 if ! is_num "$bug"; then
59 echo "Invalid Bug ID ($bug)!!!";
63 sed -i "s/^\(Change-Id: .*\)$/\1\nBUG: $bug/g" $1;
69 $0 - editor_mode called on unrecognized file $1 with content:
76 function assert_diverge()
78 git diff origin/$branch..HEAD | grep -q .;
95 bug=$(git show --format='%b' | grep -i '^BUG: ' | awk '{print $2}');
97 if [ "$DRY_RUN" = 1 ]; then
98 drier='echo -e Please use the following command to send your commits to review:\n\n'
103 if [ -z "$bug" ]; then
104 $drier git push origin HEAD:refs/for/$branch/rfc;
106 $drier git push origin HEAD:refs/for/$branch/bug-$bug;