See the individual scripts for documentation, but an overview:
-* [post-receive-assign-commitnumbers][1]: makes Subversion-like monotonically increasing commit numbers for every commit
+* [post-receive-commitnumbers][1]: makes Subversion-like monotonically increasing commit numbers for every commit
* [post-receive-email][2]: contrib email script with customizations for stuff like combined diffs
* [post-receive-gitconfig][3]: auto-updates the git config+hooks on the server when updated in the repo
* [post-receive-hudson][4]: auto-creates new jobs in Hudson when branches in git are created
* [update-lock-check][9]: enforces locked/preserved branches
* [update-stable][10]: enforces proper movement of stable
-[1]: master/server/post-receive-assign-commitnumbers
+[1]: master/server/post-receive-commitnumbers
[2]: master/server/post-receive-email
[3]: master/server/post-receive-gitconfig
[4]: master/server/post-receive-hudson
+++ /dev/null
-#!/bin/sh
-
-. $(dirname $0)/functions
-
-while read oldrev newrev refname ; do
- set_new_commits
- echo "$new_commits" | git rev-list --reverse --stdin | while read commit ; do
- if [[ $(grep "$commit" "$GIT_DIR/commitnumbers" 2>/dev/null) == "" ]] ; then
- with_lock "$GIT_DIR/commitnumbers.lock" 'echo "$commit $refname" >> "$GIT_DIR/commitnumbers"'
- number=$(grep --max-count=1 --line-number "$commit" "$GIT_DIR/commitnumbers" | grep -oP "^\d+(?=:)")
- git tag "r/$number" "$commit"
- fi
- done
-done
-
--- /dev/null
+#!/bin/sh
+
+. $(dirname $0)/functions
+
+while read oldrev newrev refname ; do
+ set_new_commits
+ echo "$new_commits" | git rev-list --reverse --stdin | while read commit ; do
+ if [[ $(grep "$commit" "$GIT_DIR/commitnumbers" 2>/dev/null) == "" ]] ; then
+ with_lock "$GIT_DIR/commitnumbers.lock" 'echo "$commit $refname" >> "$GIT_DIR/commitnumbers"'
+ number=$(grep --max-count=1 --line-number "$commit" "$GIT_DIR/commitnumbers" | grep -oP "^\d+(?=:)")
+ git tag "r/$number" "$commit"
+ fi
+ done
+done
+
+++ /dev/null
-#!/bin/sh
-
-while read oldrev newrev refname ; do
- if [ "$refname" == "refs/heads/gitconfig" ] ; then
- config_hash=$(git ls-tree $newrev | grep config | grep -oP '\w{40}')
- if [[ "$config_hash" != "" ]] ; then
- git cat-file blob "$config_hash" | while read line ; do
- key="${line%=*}"
- value="${line#*=}"
- git config "${key}" "${value}"
- done
- fi
-
- hooks_hash=$(git ls-tree $newrev | grep hooks | grep -oP '\w{40}')
- if [[ "$hooks_hash" != "" ]] ; then
- git ls-tree "$hooks_hash" | while read mode type file_hash file_name ; do
- echo "Installing $file_name"
- git cat-file blob "$file_hash" > "hooks/$file_name"
- done
- fi
- fi
-done
-
--- /dev/null
+#!/bin/sh
+
+while read oldrev newrev refname ; do
+ if [ "$refname" == "refs/heads/gitconfig" ] ; then
+ config_hash=$(git ls-tree $newrev | grep config | grep -oP '\w{40}')
+ if [[ "$config_hash" != "" ]] ; then
+ git cat-file blob "$config_hash" | while read line ; do
+ key="${line%=*}"
+ value="${line#*=}"
+ git config "${key}" "${value}"
+ done
+ fi
+
+ hooks_hash=$(git ls-tree $newrev | grep hooks | grep -oP '\w{40}')
+ if [[ "$hooks_hash" != "" ]] ; then
+ git ls-tree "$hooks_hash" | while read mode type file_hash file_name ; do
+ echo "Installing $file_name"
+ git cat-file blob "$file_hash" > "hooks/$file_name"
+ done
+ fi
+ fi
+done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update git config'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
- echo "setup" >a &&
- git add a &&
- git commit -m "setup" &&
- git clone ./. server &&
- rm -fr server/.git/hooks &&
- git remote add origin ./server &&
- git config --add branch.master.remote origin &&
- git config --add branch.master.merge refs/heads/master &&
- git fetch
-'
-
-install_post_receive_hook 'post-receive-git-config'
-
-test_expect_success 'pushing initial value works' '
- cd server &&
- ! git config --list | grep foo &&
- cd .. &&
-
- ../../scripts/make-gitconfig-branch &&
- git checkout gitconfig &&
- echo "foo.foo=bar" > config &&
- git commit -a -m "Set foo.foo=bar."
- git push origin gitconfig
-
- cd server &&
- git config --list | grep foo &&
- cd ..
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update git config'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo "setup" >a &&
+ git add a &&
+ git commit -m "setup" &&
+ git clone ./. server &&
+ rm -fr server/.git/hooks &&
+ git remote add origin ./server &&
+ git config branch.master.remote origin &&
+ git config branch.master.merge refs/heads/master &&
+ git fetch
+'
+
+install_post_receive_hook 'post-receive-gitconfig'
+
+test_expect_success 'pushing initial value works' '
+ cd server &&
+ ! git config --list | grep foo &&
+ cd .. &&
+
+ ../../scripts/create-gitconfig &&
+ git checkout gitconfig &&
+ echo "foo.foo=bar" > config &&
+ git commit -a -m "Set foo.foo=bar."
+ git push origin gitconfig
+
+ cd server &&
+ git config --list | grep foo &&
+ cd ..
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update git config'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
- echo "setup" >a &&
- git add a &&
- git commit -m "setup" &&
- git clone ./. server &&
- rm -fr server/.git/hooks &&
- git remote add origin ./server
-'
-
-install_post_receive_hook 'post-receive-git-config'
-
-test_expect_success 'adding hook' '
- ls server/.git/hooks | grep post-receive &&
- ../../scripts/make-gitconfig-branch &&
- git checkout gitconfig &&
-
- mkdir hooks &&
- cd hooks &&
- echo "#!/bin/sh" > post-receive &&
- echo "../../../../server/post-receive-git-config" >> post-receive &&
- echo "echo barbar" >> post-receive &&
- echo "#!/bin/sh" > update &&
- echo "echo foofoo" >> update &&
- git add post-receive &&
- git add update &&
- git commit -m "added post-receive and update" &&
- git push origin gitconfig &&
- cd .. &&
-
- cat server/.git/hooks/post-receive | grep barbar &&
- cat server/.git/hooks/update | grep foofoo
-'
-
-test_expect_success 'changing hook' '
- echo "#!/bin/sh" > hooks/update &&
- echo "echo lala" >> hooks/update &&
- git commit -a -m "changed update" &&
- git push origin gitconfig &&
-
- cat server/.git/hooks/post-receive | grep barbar &&
- ! cat server/.git/hooks/update | grep barbar &&
- cat server/.git/hooks/update | grep lala
-'
-
-test_expect_success 'removing hook does not work' '
- git rm hooks/update &&
- git commit -m "removed update" &&
- git push origin gitconfig &&
-
- ls server/.git/hooks | grep post-receive
- ls server/.git/hooks | grep update
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update git config'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo "setup" >a &&
+ git add a &&
+ git commit -m "setup" &&
+ git clone ./. server &&
+ rm -fr server/.git/hooks &&
+ git remote add origin ./server
+'
+
+install_post_receive_hook 'post-receive-gitconfig'
+
+test_expect_success 'adding hook' '
+ ls server/.git/hooks | grep post-receive &&
+ ../../scripts/create-gitconfig &&
+ git checkout gitconfig &&
+
+ mkdir hooks &&
+ cd hooks &&
+ echo "#!/bin/sh" > post-receive &&
+ echo "../../../../server/post-receive-gitconfig" >> post-receive &&
+ echo "echo barbar" >> post-receive &&
+ echo "#!/bin/sh" > update &&
+ echo "echo foofoo" >> update &&
+ git add post-receive &&
+ git add update &&
+ git commit -m "added post-receive and update" &&
+ git push origin gitconfig &&
+ cd .. &&
+
+ cat server/.git/hooks/post-receive | grep barbar &&
+ cat server/.git/hooks/update | grep foofoo
+'
+
+test_expect_success 'changing hook' '
+ echo "#!/bin/sh" > hooks/update &&
+ echo "echo lala" >> hooks/update &&
+ git commit -a -m "changed update" &&
+ git push origin gitconfig &&
+
+ cat server/.git/hooks/post-receive | grep barbar &&
+ ! cat server/.git/hooks/update | grep barbar &&
+ cat server/.git/hooks/update | grep lala
+'
+
+test_expect_success 'removing hook does not work' '
+ git rm hooks/update &&
+ git commit -m "removed update" &&
+ git push origin gitconfig &&
+
+ ls server/.git/hooks | grep post-receive
+ ls server/.git/hooks | grep update
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server post receive trac with commit numbers'
-
-. ./test-lib.sh
-
-export PYTHON=echo
-export TRAC_ENV=/foo/trac
-
-test_expect_success 'setup' '
- echo "setup" >a &&
- git add a &&
- git commit -m "setup" &&
- git clone ./. server &&
- rm -fr server/.git/hooks &&
- git remote add origin ./server
-'
-
-install_post_receive_hook 'post-receive-assign-commit-numbers' 'post-receive-trac'
-
-test_expect_success 'new branch' '
- git checkout -b topic1 master &&
- echo "$test_name" >a &&
- git commit -a -m "changed on topic1" &&
- new_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic1 2>push.err &&
- cat push.err | grep "/foo/trac topic1 $new_commit_hash r/1 $new_commit_hash"
-'
-
-test_expect_success 'new branch with already existing does not double tap' '
- git checkout -b topic2 topic1 &&
- existing_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic2 2>push.err &&
- ! cat push.err | grep "/foo/trac topic2"
-'
-
-test_expect_success 'update branch' '
- # Already on topic2
- echo "$test_name" >a &&
- git commit -a -m "changed on topic2" &&
- new_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic2 2>push.err &&
- cat push.err | grep "/foo/trac topic2 $new_commit_hash r/2 $new_commit_hash"
-'
-
-test_expect_success 'update branch to an already published commit does not double tap' '
- # Make topic1 catch up to topic2, which will be a fast forward that does need re-tapped
- git checkout topic2 &&
- topic2_hash=$(git rev-parse HEAD) &&
-
- git checkout topic1 &&
- git merge topic2 &&
- topic1_hash=$(git rev-parse HEAD) &&
-
- git push 2>push.err &&
-
- ! cat push.err | grep "/foo/trac topic2"
- ! cat push.err | grep "/foo/trac topic1"
-'
-
-test_expect_success 'update branch with abbreviation' '
- git checkout topic2
- git tag -m "release1" release1 &&
- git push --tags &&
-
- echo "$test_name" >a &&
- git commit -a -m "changed on topic2" &&
- new_commit_describe=$(git describe HEAD) &&
- new_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic2 2>push.err &&
- cat push.err | grep "/foo/trac topic2 $new_commit_describe r/3 $new_commit_hash"
-'
-
-test_expect_success 'update branch with abbreviation and two commits' '
- echo "$test_name 1" >a &&
- git commit -a -m "changed on topic2 1" &&
- first_commit_describe=$(git describe HEAD) &&
- first_commit_hash=$(git rev-parse HEAD) &&
-
- echo "$test_name 2" >a &&
- git commit -a -m "changed on topic2 2" &&
- second_commit_describe=$(git describe HEAD) &&
- second_commit_hash=$(git rev-parse HEAD) &&
-
- git push origin topic2 2>push.err &&
- cat push.err | grep "/foo/trac topic2 $first_commit_describe r/4 $first_commit_hash" &&
- cat push.err | grep "/foo/trac topic2 $second_commit_describe r/5 $second_commit_hash"
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server post receive trac with commit numbers'
+
+. ./test-lib.sh
+
+export PYTHON=echo
+export TRAC_ENV=/foo/trac
+
+test_expect_success 'setup' '
+ echo "setup" >a &&
+ git add a &&
+ git commit -m "setup" &&
+ git clone ./. server &&
+ rm -fr server/.git/hooks &&
+ git remote add origin ./server
+'
+
+install_post_receive_hook 'post-receive-commitnumbers' 'post-receive-trac'
+
+test_expect_success 'new branch' '
+ git checkout -b topic1 master &&
+ echo "$test_name" >a &&
+ git commit -a -m "changed on topic1" &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic1 2>push.err &&
+ cat push.err | grep "/foo/trac topic1 $new_commit_hash r/1 $new_commit_hash"
+'
+
+test_expect_success 'new branch with already existing does not double tap' '
+ git checkout -b topic2 topic1 &&
+ existing_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic2 2>push.err &&
+ ! cat push.err | grep "/foo/trac topic2"
+'
+
+test_expect_success 'update branch' '
+ # Already on topic2
+ echo "$test_name" >a &&
+ git commit -a -m "changed on topic2" &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic2 2>push.err &&
+ cat push.err | grep "/foo/trac topic2 $new_commit_hash r/2 $new_commit_hash"
+'
+
+test_expect_success 'update branch to an already published commit does not double tap' '
+ # Make topic1 catch up to topic2, which will be a fast forward that does need re-tapped
+ git checkout topic2 &&
+ topic2_hash=$(git rev-parse HEAD) &&
+
+ git checkout topic1 &&
+ git merge topic2 &&
+ topic1_hash=$(git rev-parse HEAD) &&
+
+ git push 2>push.err &&
+
+ ! cat push.err | grep "/foo/trac topic2"
+ ! cat push.err | grep "/foo/trac topic1"
+'
+
+test_expect_success 'update branch with abbreviation' '
+ git checkout topic2
+ git tag -m "release1" release1 &&
+ git push --tags &&
+
+ echo "$test_name" >a &&
+ git commit -a -m "changed on topic2" &&
+ new_commit_describe=$(git describe HEAD) &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic2 2>push.err &&
+ cat push.err | grep "/foo/trac topic2 $new_commit_describe r/3 $new_commit_hash"
+'
+
+test_expect_success 'update branch with abbreviation and two commits' '
+ echo "$test_name 1" >a &&
+ git commit -a -m "changed on topic2 1" &&
+ first_commit_describe=$(git describe HEAD) &&
+ first_commit_hash=$(git rev-parse HEAD) &&
+
+ echo "$test_name 2" >a &&
+ git commit -a -m "changed on topic2 2" &&
+ second_commit_describe=$(git describe HEAD) &&
+ second_commit_hash=$(git rev-parse HEAD) &&
+
+ git push origin topic2 2>push.err &&
+ cat push.err | grep "/foo/trac topic2 $first_commit_describe r/4 $first_commit_hash" &&
+ cat push.err | grep "/foo/trac topic2 $second_commit_describe r/5 $second_commit_hash"
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server assign commit numbers'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
- echo "setup" >a &&
- git add a &&
- git commit -m "setup" &&
- git clone ./. server &&
- rm -fr server/.git/hooks &&
- git remote add origin ./server &&
- git config --add branch.master.remote origin &&
- git config --add branch.master.merge refs/heads/master &&
- git fetch
-'
-
-install_post_receive_hook 'post-receive-assign-commit-numbers'
-
-test_expect_success 'assign one new commit' '
- git checkout master &&
- echo "$test_name" >a &&
- git commit -a -m "changed a" &&
- git push origin master &&
- git fetch &&
-
- test "$(git rev-parse HEAD)" = "$(git rev-parse r/1)" &&
- test "$(git describe --tags)" = "r/1" &&
- test "$(git rev-parse HEAD) refs/heads/master" = "$(cat server/.git/commitnumbers)"
-'
-
-test_expect_success 'assign two new commits' '
- echo "$test_name first" >a &&
- git commit -a -m "changed a first" &&
- echo "$test_name second" >a &&
- git commit -a -m "changed a second" &&
- git push origin master &&
- git fetch &&
-
- test "$(git rev-parse HEAD)" = "$(git rev-parse r/3)" &&
- test "$(git describe --tags)" = "r/3" &&
-
- test "$(git rev-parse HEAD^)" = "$(git rev-parse r/2)" &&
- test "$(git describe --tags HEAD^)" = "r/2"
-'
-
-test_expect_success 'pushing commits to a new branch does not reassign' '
- git checkout -b topica &&
- echo "$test_name" &&
- git push origin topica &&
- git fetch &&
-
- ! git rev-parse r/4
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server assign commit numbers'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo "setup" >a &&
+ git add a &&
+ git commit -m "setup" &&
+ git clone ./. server &&
+ rm -fr server/.git/hooks &&
+ git remote add origin ./server &&
+ git config branch.master.remote origin &&
+ git config branch.master.merge refs/heads/master &&
+ git fetch
+'
+
+install_post_receive_hook 'post-receive-commitnumbers'
+
+test_expect_success 'assign one new commit' '
+ git checkout master &&
+ echo "$test_name" >a &&
+ git commit -a -m "changed a" &&
+ git push origin master &&
+ git fetch &&
+
+ test "$(git rev-parse HEAD)" = "$(git rev-parse r/1)" &&
+ test "$(git describe --tags)" = "r/1" &&
+ test "$(git rev-parse HEAD) refs/heads/master" = "$(cat server/.git/commitnumbers)"
+'
+
+test_expect_success 'assign two new commits' '
+ echo "$test_name first" >a &&
+ git commit -a -m "changed a first" &&
+ echo "$test_name second" >a &&
+ git commit -a -m "changed a second" &&
+ git push origin master &&
+ git fetch &&
+
+ test "$(git rev-parse HEAD)" = "$(git rev-parse r/3)" &&
+ test "$(git describe --tags)" = "r/3" &&
+
+ test "$(git rev-parse HEAD^)" = "$(git rev-parse r/2)" &&
+ test "$(git describe --tags HEAD^)" = "r/2"
+'
+
+test_expect_success 'pushing commits to a new branch does not reassign' '
+ git checkout -b topica &&
+ echo "$test_name" &&
+ git push origin topica &&
+ git fetch &&
+
+ ! git rev-parse r/4
+'
+
+test_done
+