Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 4aca6f6a15deb23b6c7e58aff25769afbcddc8cd 1 parent 850118b
@stephenh authored
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
2  scripts/checkout
@@ -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.
View
2  scripts/create-gitconfig
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Creates a separate DAG in your repo for git config files.
#
View
2  scripts/pull
@@ -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
2  scripts/push
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Makes push "just work" by only pushing the current branch to origin.
#
View
2  scripts/refollow
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Goes through the ensure-follows branches and makes sure
View
25 server/functions
@@ -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
2  server/post-receive-commitnumbers 100644 → 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Creates commitnumbers as lightweight tags named "r/X" where X increases
# monotonically.
View
2  server/post-receive-email
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright (c) 2007 Andy Parkins
# Copyright (c) 2008 Stephen Haberman
View
2  server/post-receive-gitconfig 100644 → 100755
@@ -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
File mode changed
View
2  server/post-receive.sample
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
nl=$'\n'
input=""
View
2  server/update-allow-tags-branches 100644 → 100755
@@ -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
2  server/update-ensure-ticket-reference 100644 → 100755
@@ -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.
View
2  server/update.sample
@@ -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
2  tests/Makefile
@@ -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'
View
2  tests/t1000-commit-msg-trac.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='client commit-msg trac ticket enforcer'
View
2  tests/t1001-commit-msg-trac-merges.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='client commit-msg trac ticket enforcer for merges'
View
8 tests/t2000-update-ensure-ticket-reference.sh
@@ -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
'
View
2  tests/t2001-update-ensure-ticket-reference-merges.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update trac ticket enforcer via shim'
View
10 tests/t2002-update-ensure-ticket-reference-branches.sh
@@ -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 ..
View
10 tests/t2100-update-stable.sh
@@ -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
View
18 tests/t2200-post-receive-email.sh
@@ -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
2  tests/t2201-8.txt
@@ -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
View
30 tests/t2201-post-receive-email-tags.sh
@@ -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'
@@ -30,7 +30,7 @@ test_expect_success 'create annotated tag' '
eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/1.0) &&
interpolate ../t2201-1.txt 1.txt new_commit_hash tag_hash tag_date &&
- test_cmp 1.txt server/.git/refs.tags.1.0.out
+ test_cmp 1.txt server.git/refs.tags.1.0.out
'
test_expect_success 'commit on annotated tagged branch' '
@@ -52,7 +52,7 @@ test_expect_success 'commit on annotated tagged branch' '
git push &&
new_commit_abbrev=$(git rev-list -n 1 --pretty=format:%h HEAD | grep -v commit) &&
interpolate ../t2201-2.txt 2.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev prior_commit_hash prior_commit_date old_commit_abbrev prior_commit_abbrev new_commit_abbrev &&
- test_cmp 2.txt server/.git/refs.heads.master.out
+ test_cmp 2.txt server.git/refs.heads.master.out
'
test_expect_success 're-annotated tag branch' '
@@ -63,7 +63,7 @@ test_expect_success 're-annotated tag branch' '
eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
interpolate ../t2201-3.txt 3.txt new_commit_hash tag_hash tag_date &&
- test_cmp 3.txt server/.git/refs.tags.2.0.out
+ test_cmp 3.txt server.git/refs.tags.2.0.out
'
test_expect_success 'force update annotated tag' '
@@ -80,7 +80,7 @@ test_expect_success 'force update annotated tag' '
eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
interpolate ../t2201-7.txt 7.txt old_tag_hash new_commit_hash new_tag_hash tag_date &&
- test_cmp 7.txt server/.git/refs.tags.2.0.out
+ test_cmp 7.txt server.git/refs.tags.2.0.out
'
test_expect_success 'delete annotated tag' '
@@ -94,7 +94,7 @@ test_expect_success 'delete annotated tag' '
new_commit_hash=$(git rev-parse HEAD) &&
interpolate ../t2201-8.txt 8.txt old_tag_hash old_tag_date new_commit_describe new_commit_hash &&
- test_cmp 8.txt server/.git/refs.tags.2.0.out
+ test_cmp 8.txt server.git/refs.tags.2.0.out
'
test_expect_success 'create lightweight tag' '
@@ -109,7 +109,7 @@ test_expect_success 'create lightweight tag' '
new_commit_date=$(git rev-list --no-walk --pretty=format:%ad HEAD | tail -n 1) &&
interpolate ../t2201-4.txt 4.txt new_commit_hash new_commit_describe new_commit_date &&
- test_cmp 4.txt server/.git/refs.tags.2.1.out
+ test_cmp 4.txt server.git/refs.tags.2.1.out
'
test_expect_success 'force update lightweight tag' '
@@ -125,7 +125,7 @@ test_expect_success 'force update lightweight tag' '
new_commit_date=$(git rev-list --no-walk --pretty=format:%ad HEAD | tail -n 1) &&
interpolate ../t2201-5.txt 5.txt new_commit_hash new_commit_describe new_commit_date old_commit_hash &&
- test_cmp 5.txt server/.git/refs.tags.2.1.out
+ test_cmp 5.txt server.git/refs.tags.2.1.out
'
test_expect_success 'delete lightweight tag' '
@@ -135,7 +135,7 @@ test_expect_success 'delete lightweight tag' '
git push origin :refs/tags/2.1 &&
interpolate ../t2201-6.txt 6.txt old_commit_hash old_commit_describe &&
- test_cmp 6.txt server/.git/refs.tags.2.1.out
+ test_cmp 6.txt server.git/refs.tags.2.1.out
'
test_done
View
26 tests/t2202-post-receive-email-branches.sh
@@ -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'
@@ -38,7 +38,7 @@ test_expect_success 'create branch' '
git push origin topic &&
interpolate ../t2202-1.txt 1.txt new_commit_hash new_commit_abbrev new_commit_date prior_commit_hash prior_commit_date &&
- test_cmp 1.txt server/.git/refs.heads.topic.out
+ test_cmp 1.txt server.git/refs.heads.topic.out
'
test_expect_success 'create branch with existing commits does not replay them' '
@@ -50,7 +50,7 @@ test_expect_success 'create branch with existing commits does not replay them' '
git push origin topic2 &&
interpolate ../t2202-3.txt 3.txt existing_commit_hash existing_commit_abbrev existing_commit_date &&
- test_cmp 3.txt server/.git/refs.heads.topic2.out
+ test_cmp 3.txt server.git/refs.heads.topic2.out
'
test_expect_success 'update branch with existing commits does not replay them' '
@@ -69,7 +69,7 @@ test_expect_success 'update branch with existing commits does not replay them' '
git push &&
interpolate ../t2202-4.txt 4.txt old_commit_hash old_commit_abbrev existing_commit_hash existing_commit_abbrev &&
- test_cmp 4.txt server/.git/refs.heads.topic.out
+ test_cmp 4.txt server.git/refs.heads.topic.out
'
test_expect_success 'rewind branch' '
@@ -82,7 +82,7 @@ test_expect_success 'rewind branch' '
new_commit_hash=$(git rev-parse HEAD) &&
interpolate ../t2202-5.txt 5.txt old_commit_hash new_commit_hash old_commit_abbrev &&
- test_cmp 5.txt server/.git/refs.heads.topic.out
+ test_cmp 5.txt server.git/refs.heads.topic.out
'
test_expect_success 'rewind and continue branch' '
@@ -99,7 +99,7 @@ test_expect_success 'rewind and continue branch' '
git push --force &&
interpolate ../t2202-6.txt 6.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev old_commit_abbrev &&
- test_cmp 6.txt server/.git/refs.heads.topic.out
+ test_cmp 6.txt server.git/refs.heads.topic.out
'
test_expect_success 'delete branch' '
@@ -107,7 +107,7 @@ test_expect_success 'delete branch' '
git push origin :refs/heads/topic &&
interpolate ../t2202-2.txt 2.txt old_commit_hash &&
- test_cmp 2.txt server/.git/refs.heads.topic.out
+ test_cmp 2.txt server.git/refs.heads.topic.out
'
test_done
View
2  tests/t2203-1.txt
@@ -17,7 +17,7 @@ revisions in full, below.
- Log -----------------------------------------------------------------
commit $new_commit_hash
-Merge: $old_commit_hash $second_stable_hash
+Merge: $old_commit_abbrev $second_stable_abbrev
Author: A U Thor <author@example.com>
Date: $new_commit_date
View
2  tests/t2203-2.txt
@@ -17,7 +17,7 @@ revisions in full, below.
- Log -----------------------------------------------------------------
commit $new_commit_hash
-Merge: $old_commit_hash $second_stable_hash
+Merge: $old_commit_abbrev $second_stable_abbrev
Author: A U Thor <author@example.com>
Date: $new_commit_date
View
26 tests/t2203-post-receive-email-stable.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server post-receive email notification and how it behaves in our stable-based envrionment'
@@ -12,14 +12,14 @@ test_expect_success 'setup' '
echo "setup" >c &&
git add a b c &&
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 &&
git checkout -b stable &&
git push origin stable
@@ -48,7 +48,7 @@ test_expect_success 'merge in stable' '
echo "$test_name 2" >b &&
echo "$test_name 2" >c &&
git commit -a -m "move stable 2" &&
- second_stable_hash=$(git rev-parse HEAD) &&
+ second_stable_abbrev=$(git rev-parse --short HEAD) &&
git push origin stable &&
# Merge stable
@@ -60,8 +60,8 @@ test_expect_success 'merge in stable' '
new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
new_commit_abbrev=$(git rev-parse --short HEAD) &&
- interpolate ../t2203-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date first_stable_hash second_stable_hash &&
- test_cmp 1.txt server/.git/refs.heads.topic1.out
+ interpolate ../t2203-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date first_stable_hash second_stable_abbrev &&
+ test_cmp 1.txt server.git/refs.heads.topic1.out
'
test_expect_success 'merge in stable with conflict' '
@@ -84,7 +84,7 @@ test_expect_success 'merge in stable with conflict' '
echo "$test_name 2" >b &&
echo "$test_name 2" >c &&
git commit -a -m "move stable 2" &&
- second_stable_hash=$(git rev-parse HEAD) &&
+ second_stable_abbrev=$(git rev-parse --short HEAD) &&
git push origin stable &&
# Merge stable
@@ -99,8 +99,8 @@ test_expect_success 'merge in stable with conflict' '
new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
new_commit_abbrev=$(git rev-parse --short HEAD) &&
- interpolate ../t2203-2.txt 2.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date first_stable_hash second_stable_hash &&
- test_cmp 2.txt server/.git/refs.heads.topic1.out
+ interpolate ../t2203-2.txt 2.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date first_stable_hash second_stable_abbrev &&
+ test_cmp 2.txt server.git/refs.heads.topic1.out
'
test_done
View
2  tests/t2204-1.txt
@@ -17,7 +17,7 @@ revisions in full, below.
- Log -----------------------------------------------------------------
commit $new_commit_hash
-Merge: $old_commit_hash $stable_hash
+Merge: $old_commit_abbrev $stable_abbrev
Author: A U Thor <author@example.com>
Date: $new_commit_date
View
20 tests/t2204-post-receive-email-conflicts.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server post-receive email notification and how it behaves in our stable-based envrionment'
@@ -12,14 +12,14 @@ test_expect_success 'setup' '
echo "setup" >c &&
git add a b c &&
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 &&
git checkout -b stable &&
git push origin stable
@@ -53,7 +53,7 @@ test_expect_success 'conflict diff' '
git commit -a -m "lines changed on stable" &&
git push origin stable &&
- stable_hash=$(git rev-parse HEAD) &&
+ stable_abbrev=$(git rev-parse --short HEAD) &&
git checkout topic1 &&
! git merge stable &&
@@ -70,8 +70,8 @@ test_expect_success 'conflict diff' '
new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
new_commit_abbrev=$(git rev-parse --short HEAD) &&
- interpolate ../t2204-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date stable_hash &&
- test_cmp 1.txt server/.git/refs.heads.topic1.out
+ interpolate ../t2204-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date stable_abbrev &&
+ test_cmp 1.txt server.git/refs.heads.topic1.out
'
test_done
View
27 tests/t2700-ensure-follows.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update ensure follows'
@@ -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 fetch
'
@@ -22,9 +22,7 @@ test_expect_success 'pushing stable works' '
'
test_expect_success 'branch with unmoved stable is okay' '
- cd server &&
- git config hooks.update-ensure-follows.branches stable &&
- cd .. &&
+ GIT_DIR=server.git git config hooks.update-ensure-follows.branches stable &&
git checkout -b topic1 &&
echo "$test_name" >a.topic1 &&
@@ -56,9 +54,12 @@ test_expect_success 'branch with moved stable is told to update first' '
git push origin stable &&
# Someone fixes stable first
- cd server &&
+ git clone server.git person2 &&
+ cd person2 &&
git checkout -f topic1 &&
- git merge stable &&
+ git remote add server ../server.git &&
+ git merge origin/stable &&
+ git push server topic1 &&
cd .. &&
git checkout topic1 &&
@@ -73,9 +74,7 @@ test_expect_success 'branch with moved stable is told to update first' '
'
test_expect_success 'branch with moved stable as second branch requires merge' '
- cd server &&
- git config hooks.update-ensure-follows.branches "foo stable" &&
- cd .. &&
+ GIT_DIR=server.git git config hooks.update-ensure-follows.branches "foo stable" &&
git checkout stable &&
echo "$test_name" >a &&
@@ -128,9 +127,7 @@ test_expect_success 'excused branch with moved stable is okay' '
git commit -a -m "Change on topic2 again" &&
! git push origin topic2 &&
- cd server &&
- git config hooks.update-ensure-follows.excused topic2 &&
- cd .. &&
+ GIT_DIR=server.git git config hooks.update-ensure-follows.excused topic2 &&
git push origin topic2
'
View
20 tests/t2800-post-receive-gitconfig.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update git config'
@@ -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 branch.master.remote origin &&
git config branch.master.merge refs/heads/master &&
git fetch
@@ -19,9 +19,7 @@ test_expect_success 'setup' '
install_post_receive_hook 'post-receive-gitconfig'
test_expect_success 'pushing initial value works' '
- cd server &&
- ! git config --list | grep foo &&
- cd .. &&
+ ! GIT_DIR=server.git git config --list | grep foo &&
../../scripts/create-gitconfig &&
git checkout gitconfig &&
@@ -29,13 +27,11 @@ test_expect_success 'pushing initial value works' '
git commit -a -m "Set foo.foo=bar."
git push origin gitconfig
- cd server &&
- git config --list | grep foo &&
- cd ..
+ GIT_DIR=server.git git config --list | grep foo
'
test_expect_success 'pushing locked works' '
- ! test -f server/.git/locked &&
+ ! test -f server.git/locked &&
git checkout gitconfig &&
echo "foo" > locked &&
@@ -43,7 +39,7 @@ test_expect_success 'pushing locked works' '
git commit -m "Add locked"
git push origin gitconfig
- test -f server/.git/locked
+ test -f server.git/locked
'
test_done
View
32 tests/t2801-post-receive-gitconfig-hooks.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update git config'
@@ -8,24 +8,24 @@ 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
'
install_post_receive_hook 'post-receive-gitconfig'
test_expect_success 'adding hook' '
- ls server/.git/hooks | grep post-receive &&
+ 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 "#!/bin/bash" > post-receive &&
+ echo "../../../server/post-receive-gitconfig" >> post-receive &&
echo "echo barbar" >> post-receive &&
- echo "#!/bin/sh" > update &&
+ echo "#!/bin/bash" > update &&
echo "echo foofoo" >> update &&
git add post-receive &&
git add update &&
@@ -33,19 +33,19 @@ test_expect_success 'adding hook' '
git push origin gitconfig &&
cd .. &&
- cat server/.git/hooks/post-receive | grep barbar &&
- cat server/.git/hooks/update | grep foofoo
+ 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 "#!/bin/bash" > 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
+ 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' '
@@ -53,8 +53,8 @@ test_expect_success 'removing hook does not work' '
git commit -m "removed update" &&
git push origin gitconfig &&
- ls server/.git/hooks | grep post-receive
- ls server/.git/hooks | grep update
+ ls server.git/hooks | grep post-receive
+ ls server.git/hooks | grep update
'
test_done
View
23 tests/t2900-update-lock-check.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update lock check'
@@ -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 branch.master.remote origin &&
git config branch.master.merge refs/heads/master &&
git fetch
@@ -19,7 +19,7 @@ test_expect_success 'setup' '
install_update_hook 'update-lock-check'
test_expect_success 'locked branch is rejected' '
- echo master >> server/.git/locked &&
+ echo master >> server.git/locked &&
echo "$test_name" >a &&
git commit -a -m "changed" &&
@@ -28,8 +28,8 @@ test_expect_success 'locked branch is rejected' '
'
test_expect_success 'locked branch is rejected with multiple branches set' '
- echo foo >> server/.git/locked &&
- echo bar >> server/.git/locked &&
+ echo foo >> server.git/locked &&
+ echo bar >> server.git/locked &&
echo "$test_name" >a &&
git commit -a -m "changed" &&
@@ -38,11 +38,12 @@ test_expect_success 'locked branch is rejected with multiple branches set' '
'
test_expect_success 'preserved branch cannot be deleted' '
- echo > server/.git/locked &&
- echo master > server/.git/preserved &&
+ echo > server.git/locked &&
+ git push origin master:master2 &&
+ echo master2 > server.git/preserved &&
- ! git push origin :master 2>push.err &&
- cat push.err | grep "Branch master cannot be deleted"
+ ! git push origin :master2 2>push.err &&
+ cat push.err | grep "Branch master2 cannot be deleted"
'
test_done
View
8 tests/t3000-post-receive-trac.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update lock check'
@@ -11,9 +11,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
'
install_post_receive_hook 'post-receive-trac'
View
8 tests/t3001-post-receive-trac-with-commitnumbers.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server post receive trac with commit numbers'
@@ -11,9 +11,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
'
install_post_receive_hook 'post-receive-commitnumbers' 'post-receive-trac'
View
10 tests/t3100-update-allow-tags-branches.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server update allow tags and branches'
@@ -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
'
install_update_hook 'update-allow-tags-branches'
@@ -35,7 +35,7 @@ test_expect_success 'push works if done at the same time' '
'
test_expect_success 'moving branch back and deleting tag works' '
- GIT_DIR=./server/.git git config hooks.update-allow-tags-branches.deletetag true
+ GIT_DIR=./server.git git config hooks.update-allow-tags-branches.deletetag true
git reset --hard HEAD^ &&
git push --force origin master:master :r2
'
View
10 tests/t3200-post-receive-commitnumbers.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='server assign commit numbers'
@@ -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 branch.master.remote origin &&
git config branch.master.merge refs/heads/master &&
git fetch
@@ -27,7 +27,7 @@ test_expect_success 'assign one new commit' '
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 "$(git rev-parse HEAD) refs/heads/master" = "$(cat server.git/commitnumbers)"
'
test_expect_success 'assign two new commits' '
View
22 tests/t5000-checkout.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='script checkout'
@@ -10,29 +10,31 @@ 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 checkout -b stable &&
git push origin stable
'
test_expect_success 'checkout a new branch clones stable' '
- gc-checkout topic1 &&
+ checkout topic1 &&
git branch | grep topic1 &&
git branch -r | grep origin/topic1 &&
git config --list | grep "branch.topic1.merge=refs/heads/topic1"
'
test_expect_success 'checkout an existing remote branch' '
- cd server &&
- git checkout -b topic2 stable &&
+ git clone server.git person2 &&
+ cd person2 &&
+ git checkout -b topic2 origin/stable &&
echo "$test_name on server" >a &&
git commit -a -m "Made topic2 on server" &&
+ git push origin topic2
cd .. &&
! git branch | grep topic2 &&
- gc-checkout topic2 &&
+ checkout topic2 &&
git branch | grep topic2 &&
git branch -r | grep origin/topic2 &&
git config --list | grep "branch.topic2.merge=refs/heads/topic2" &&
@@ -43,7 +45,7 @@ test_expect_success 'checkout an existing remote branch' '
'
test_expect_success 'checkout an existing local branch' '
- gc-checkout topic1
+ checkout topic1
'
test_expect_success 'checkout a revision does not create a new branch' '
@@ -51,7 +53,7 @@ test_expect_success 'checkout a revision does not create a new branch' '
git commit -a -m "$test_name" &&
prior=$(git rev-parse HEAD^) &&
- gc-checkout $prior &&
+ checkout $prior &&
git branch | grep "no branch"
'
View
2  tests/t5100-push.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='script create branch'
View
23 tests/t5200-pull.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='script pull'
@@ -10,9 +10,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 checkout -b stable &&
git push origin stable
'
@@ -24,10 +24,12 @@ test_expect_success 'pull does a rebase' '
git commit -m "move topic1" &&
# Move topic1 on the server
- cd server &&
+ git clone server.git person2 &&
+ cd person2 &&
git checkout topic1 &&
echo "$test_name" >a &&
git commit -a -m "move topic1 on the server" &&
+ git push origin &&
cd .. &&
# Only one parent
@@ -53,11 +55,13 @@ test_expect_success 'pull does a rebase but does not fuck up merges' '
git merge stable &&
# Move topic2 on the server
- cd server &&
- git checkout topic2 &&
+ cd person2 &&
+ git fetch &&
+ git checkout -b topic2 origin/topic2 &&
echo "$test_name" >a.topic2.server &&
git add a.topic2.server &&
git commit -m "move topic2 on the server" &&
+ git push origin &&
cd .. &&
# Merge stable locally too--should conflict
@@ -71,10 +75,11 @@ test_expect_success 'pull moves when we have no local changes' '
git checkout topic2 &&
# Move topic2 on the server
- cd server &&
- git checkout topic2 &&
+ cd person2 &&
+ git pull &&
echo "$test_name" > a.topic2.server &&
git commit -a -m "move topic2 on the server" &&
+ git push origin &&
cd .. &&
pull &&
View
10 tests/t5400-refollow.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='script refollow'
@@ -10,15 +10,15 @@ 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 checkout -b stable &&
git push origin stable
'
test_expect_success 'setup gitconfig' '
- make-gitconfig-branch &&
+ create-gitconfig &&
git checkout gitconfig &&
echo "hooks.update-ensure-follows.branches=stable" >>config &&
echo "hooks.update-ensure-follows.excused=master gitconfig" >>config &&
View
2  tests/t9000-notes.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
test_description='sanity check of commands listed in GitNotes'
View
25 tests/test-lib.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright (c) 2005 Junio C Hamano
#
@@ -334,6 +334,7 @@ test_must_fail () {
# - not all diff versions understand "-u"
test_cmp() {
+ echo "t=${GIT_TEST_CMP}"
$GIT_TEST_CMP "$@"
}
@@ -468,19 +469,19 @@ install_post_checkout_hook () {
}
install_server_hook () {
- mkdir -p "server/.git/hooks"
- cp "../../server/$1" "server/.git/hooks/$2"
- chmod +x "server/.git/hooks/$2"
+ mkdir -p "server.git/hooks"
+ cp "../../server.git/$1" "server.git/hooks/$2"
+ chmod +x "server.git/hooks/$2"
}
install_update_hook () {
- mkdir -p "server/.git/hooks"
- hook="server/.git/hooks/update"
+ mkdir -p "server.git/hooks"
+ hook="server.git/hooks/update"
- echo "#!/bin/sh" >$hook
+ echo "#!/bin/bash" >$hook
for ((i=1;i<=$#;i+=1)); do
eval script_name="$"$i
- echo "../../../../server/$script_name \$1 \$2 \$3 &&" >>$hook
+ echo "../../../server/$script_name \$1 \$2 \$3 &&" >>$hook
done
echo "echo >/dev/null" >>$hook
@@ -488,11 +489,11 @@ install_update_hook () {
}
install_post_receive_hook () {
- mkdir -p "server/.git/hooks"
- hook="server/.git/hooks/post-receive"
+ mkdir -p "server.git/hooks"
+ hook="server.git/hooks/post-receive"
cat >$hook <<-'EOF'
- #!/bin/sh
+ #!/bin/bash
nl=$'\n'
input=""
while read newref oldref refname ; do
@@ -502,7 +503,7 @@ install_post_receive_hook () {
for ((i=1;i<=$#;i+=1)); do
eval script_name="$"$i
- echo "echo -n \"\$input\" | ../../../../server/$script_name" >>$hook
+ echo "echo -n \"\$input\" | ../../../server/$script_name" >>$hook
done
chmod +x $hook
Please sign in to comment.
Something went wrong with that request. Please try again.