Permalink
Browse files

Get tests passing again.

* Lots of /bin/sh -> bin/bash changes
* Change "server" directory in tests to be a bare repository
* Remove "lockfile" usage for a plain, always-available "mkdir"

Partially contributed and otherwise prompted by Aaron Boxer.
  • Loading branch information...
1 parent 850118b commit 4aca6f6a15deb23b6c7e58aff25769afbcddc8cd @stephenh committed Apr 14, 2011
Showing with 223 additions and 222 deletions.
  1. +1 −1 scripts/checkout
  2. +1 −1 scripts/create-gitconfig
  3. +1 −1 scripts/pull
  4. +1 −1 scripts/push
  5. +1 −1 scripts/refollow
  6. +13 −12 server/functions
  7. +1 −1 server/post-receive-commitnumbers
  8. +1 −1 server/post-receive-email
  9. +1 −1 server/post-receive-gitconfig
  10. +1 −1 server/post-receive-hudson
  11. +1 −1 server/post-receive-trac
  12. 0 server/post-receive-trac.py
  13. +1 −1 server/post-receive.sample
  14. +1 −1 server/update-allow-tags-branches
  15. +1 −1 server/update-ensure-follows
  16. +1 −1 server/update-ensure-ticket-reference
  17. +1 −1 server/update-lock-check
  18. +1 −1 server/update-stable
  19. +1 −1 server/update.sample
  20. +1 −1 tests/Makefile
  21. +1 −1 tests/t1000-commit-msg-trac.sh
  22. +1 −1 tests/t1001-commit-msg-trac-merges.sh
  23. +4 −4 tests/t2000-update-ensure-ticket-reference.sh
  24. +1 −1 tests/t2001-update-ensure-ticket-reference-merges.sh
  25. +5 −5 tests/t2002-update-ensure-ticket-reference-branches.sh
  26. +5 −5 tests/t2100-update-stable.sh
  27. +9 −9 tests/t2200-post-receive-email.sh
  28. +0 −2 tests/t2201-8.txt
  29. +15 −15 tests/t2201-post-receive-email-tags.sh
  30. +13 −13 tests/t2202-post-receive-email-branches.sh
  31. +1 −1 tests/t2203-1.txt
  32. +1 −1 tests/t2203-2.txt
  33. +13 −13 tests/t2203-post-receive-email-stable.sh
  34. +1 −1 tests/t2204-1.txt
  35. +10 −10 tests/t2204-post-receive-email-conflicts.sh
  36. +12 −15 tests/t2700-ensure-follows.sh
  37. +8 −12 tests/t2800-post-receive-gitconfig.sh
  38. +16 −16 tests/t2801-post-receive-gitconfig-hooks.sh
  39. +12 −11 tests/t2900-update-lock-check.sh
  40. +4 −4 tests/t3000-post-receive-trac.sh
  41. +4 −4 tests/t3001-post-receive-trac-with-commitnumbers.sh
  42. +5 −5 tests/t3100-update-allow-tags-branches.sh
  43. +5 −5 tests/t3200-post-receive-commitnumbers.sh
  44. +12 −10 tests/t5000-checkout.sh
  45. +1 −1 tests/t5100-push.sh
  46. +14 −9 tests/t5200-pull.sh
  47. +5 −5 tests/t5400-refollow.sh
  48. +1 −1 tests/t9000-notes.sh
  49. +13 −12 tests/test-lib.sh
View
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Makes checkout "just work" in terms of checking out the branch whether or not
# it exists locally or remotely.
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Creates a separate DAG in your repo for git config files.
#
View
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Makes pull "just work" by correctly rebasing of local commits on top of new
# incoming commits.
View
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Makes push "just work" by only pushing the current branch to origin.
#
View
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Goes through the ensure-follows branches and makes sure
View
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Sets: new_commits
# Assumes: $oldrev $newrev $refname
@@ -85,7 +85,7 @@
# "remotes/" will be ignored as well.
#
##################################################
-function set_new_commits() {
+set_new_commits() {
nl=$'\n'
# Get all the current branches, not'd as we want only new ones
@@ -114,7 +114,7 @@ function set_new_commits() {
# 0000->1234 (create)
# 1234->2345 (update)
# 2345->0000 (delete)
-function set_change_type() {
+set_change_type() {
if [ "$oldrev" == "0000000000000000000000000000000000000000" ] ; then
change_type="create"
else
@@ -129,7 +129,7 @@ function set_change_type() {
# Sets: $newrev_type $oldrev_type $rev $rev_type
# Assumes: $newrev $oldrev
# --- Get the revision types
-function set_rev_types() {
+set_rev_types() {
newrev_type=$(git cat-file -t "$newrev" 2> /dev/null)
oldrev_type=$(git cat-file -t "$oldrev" 2> /dev/null)
if [ "$newrev" == "0000000000000000000000000000000000000000" ] ; then
@@ -145,7 +145,7 @@ function set_rev_types() {
# Assumes: $rev
#
# The email subject will contain the best description of the ref that we can build from the parameters
-function set_describe() {
+set_describe() {
rev_to_describe="$rev"
if [ "$1" != "" ] ; then
rev_to_describe="$1"
@@ -161,7 +161,7 @@ function set_describe() {
# Assumes: $rev
#
# The email subject will contain the best description of the ref that we can build from the parameters
-function set_describe_tags() {
+set_describe_tags() {
rev_to_describe="$rev"
if [ "$1" != "" ] ; then
rev_to_describe="$1"
@@ -179,34 +179,35 @@ function set_describe_tags() {
#
# with_lock "foo.lock" "echo a" # Works
# with_lock "foo.lock" "echo b1 ; echo b2" # Work
-# function several() {
+# several() {
# echo several1 ; echo several2
# }
# with_lock "foo.lock" several # Works
#
-function with_lock() {
+with_lock() {
lockfile="$1"
block="$2"
with_lock_has_lock=1
trap with_lock_unlock_if_held INT TERM EXIT
- lockfile -1 -r 300 "$lockfile"
+ # used to use lockfile to try multiple times but it's not always available
+ mkdir "$lockfile"
with_lock_has_lock=$?
if [ $with_lock_has_lock -ne 0 ] ; then
exit $?
fi
eval "$block"
- rm -f "$lockfile"
+ rmdir "$lockfile"
with_lock_has_lock=1
}
-function with_lock_unlock_if_held() {
+with_lock_unlock_if_held() {
if [[ "$with_lock_has_lock" -eq 0 ]] ; then
rm -f "$lockfile"
fi
}
-function display_error_message() {
+display_error_message() {
echo "----------------------------------------------------" >&2
echo "" >&2
echo "" >&2
View
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Creates commitnumbers as lightweight tags named "r/X" where X increases
# monotonically.
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright (c) 2007 Andy Parkins
# Copyright (c) 2008 Stephen Haberman
View
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright (c) 2008 Stephen Haberman
#
View
2 server/post-receive-hudson 100644 → 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright (c) 2008 Stephen Haberman
#
View
2 server/post-receive-trac 100644 → 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
. $(dirname $0)/functions
View
0 server/post-receive-trac.py 100644 → 100755
No changes.
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
nl=$'\n'
input=""
View
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# An example hook script to blocks unannotated tags from entering.
# Called by git-receive-pack with arguments: refname sha1-old sha1-new
View
2 server/update-ensure-follows 100644 → 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# When updating a branch, ensure it has the latest changes
# from other branches, e.g. stable.
View
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
. $(dirname $0)/functions
View
2 server/update-lock-check 100644 → 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
#
# Checks $GIT_DIR/locked and $GIT_DIR/preserved for branches that cannot be
View
2 server/update-stable 100644 → 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# This enforces stable moving in approved ways.
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
/srv/git/gc/server/update-one $1 $2 $3 &&
/srv/git/gc/server/update-two $1 $2 $3
View
@@ -10,7 +10,7 @@ T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
all: $(T) clean
$(T):
- @echo "*** $@ ***"; GIT_CONFIG=.git/config /bin/sh $@ $(GIT_TEST_OPTS)
+ @echo "*** $@ ***"; GIT_CONFIG=.git/config /bin/bash $@ $(GIT_TEST_OPTS)
clean:
rm -fr 'trash directory'
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='client commit-msg trac ticket enforcer'
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='client commit-msg trac ticket enforcer for merges'
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update trac ticket enforcer'
@@ -8,9 +8,9 @@ test_expect_success 'setup' '
echo This is a test. >a &&
git add a &&
git commit -m "a" &&
- git clone ./. server &&
- rm -fr server/.git/hooks &&
- git remote add origin ./server &&
+ git clone --bare -l ./ server.git &&
+ rm -fr server.git/hooks &&
+ git remote add origin ./server.git &&
git config --add branch.master.remote origin &&
git config --add branch.master.merge refs/heads/master
'
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update trac ticket enforcer via shim'
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update trac ticket enforcer via shim'
@@ -8,9 +8,9 @@ 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 clone -l . --bare server.git &&
+ rm -fr server.git/hooks &&
+ git remote add origin ./server.git &&
git config --add branch.master.remote origin &&
git config --add branch.master.merge refs/heads/master
'
@@ -75,7 +75,7 @@ test_expect_success 'accept branch that has been excused' '
! git push origin topic5
- cd server
+ cd server.git
git config hooks.update-ensure-ticket-reference.excused topic5
cd ..
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update stable enforcer'
@@ -8,9 +8,9 @@ test_expect_success 'setup' '
echo setup >a &&
git add a &&
git commit -m "a" &&
- git clone ./. server &&
- git remote add origin ./server &&
- rm -fr server/.git/hooks
+ git clone -l . --bare server.git &&
+ git remote add origin ./server.git &&
+ rm -fr server.git/hooks
'
# setup the update hook
@@ -47,7 +47,7 @@ test_expect_success 'reject fast-forward to candidate branch' '
git checkout stable &&
git merge topic1 >merge.out &&
- cat merge.out | grep "Fast forward" &&
+ cat merge.out | grep "Fast-forward" &&
! git push 2>push.err &&
cat push.err | grep "Moving stable must entail a single commit" &&
git reset --hard ORIG_HEAD
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server post-receive email notification'
@@ -10,14 +10,14 @@ 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 clone -l . --bare server.git &&
+ rm -fr server.git/hooks &&
+ git remote add origin ./server.git &&
git config branch.master.remote origin &&
git config branch.master.merge refs/heads/master &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
- echo cbas >./server/.git/description
+ GIT_DIR=./server.git git config hooks.post-receive-email.mailinglist commits@list.com &&
+ GIT_DIR=./server.git git config hooks.post-receive-email.debug true &&
+ echo cbas >./server.git/description
'
install_post_receive_hook 'post-receive-email'
@@ -34,7 +34,7 @@ test_expect_success 'simple commit' '
new_commit_abbrev=$(git rev-parse --short HEAD) &&
interpolate ../t2200-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_date new_commit_abbrev &&
- test_cmp 1.txt server/.git/refs.heads.master.out
+ test_cmp 1.txt server.git/refs.heads.master.out
'
test_expect_success 'simple commit with commitnumber' '
@@ -51,7 +51,7 @@ test_expect_success 'simple commit with commitnumber' '
new_commit_abbrev=$(git rev-parse --short HEAD) &&
interpolate ../t2200-2.txt 2.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_date new_commit_abbrev &&
- test_cmp 2.txt server/.git/refs.heads.master.out
+ test_cmp 2.txt server.git/refs.heads.master.out
'
test_done
View
@@ -11,8 +11,6 @@ The annotated tag, 2.0 has been deleted
-----------------------------------------------------------------------
tag 2.0
-Tagger: C O Mitter <committer@example.com>
-Date: $old_tag_date
2.0
$new_commit_hash force update annotated tag
Oops, something went wrong.

0 comments on commit 4aca6f6

Please sign in to comment.