]> git.droids-corp.org - git-central.git/commitdiff
Cleaning up scripts to only include useful stuff.
authorStephen Haberman <stephen@exigencecorp.com>
Tue, 11 Nov 2008 22:42:37 +0000 (16:42 -0600)
committerStephen Haberman <stephen@exigencecorp.com>
Tue, 11 Nov 2008 22:42:37 +0000 (16:42 -0600)
27 files changed:
scripts/README.markdown
scripts/checkout [new file with mode: 0644]
scripts/create-gitconfig [new file with mode: 0644]
scripts/create-stable [new file with mode: 0644]
scripts/functions [deleted file]
scripts/gc-add [deleted file]
scripts/gc-checkout [deleted file]
scripts/gc-pull [deleted file]
scripts/gc-push [deleted file]
scripts/gc-refollow [deleted file]
scripts/gc-remerge [deleted file]
scripts/gc-tattoo [deleted file]
scripts/make-gitconfig-branch [deleted file]
scripts/make-stable-branch [deleted file]
scripts/pull [new file with mode: 0644]
scripts/push [new file with mode: 0644]
scripts/refollow [new file with mode: 0644]
tests/t5000-checkout.sh [new file with mode: 0644]
tests/t5000-script-checkout.sh [deleted file]
tests/t5100-push.sh [new file with mode: 0644]
tests/t5100-script-push.sh [deleted file]
tests/t5200-pull.sh [new file with mode: 0644]
tests/t5200-script-pull.sh [deleted file]
tests/t5300-script-add.sh [deleted file]
tests/t5400-refollow.sh [new file with mode: 0644]
tests/t5400-script-refollow.sh [deleted file]
tests/t5500-script-tattoo.sh [deleted file]

index c00bec22cf838973af3a14de6c986df200809563..8630c70dc7cc8d69258db8346e8089f11f2c56aa 100644 (file)
@@ -1,66 +1,24 @@
 
-gc-add
-======
+checkout
+========
 
-`gc-add <path>...`
-
-* If no arguments, adds all new, adds all changed, removes all removed
-* If arguments, passes through to `git add`
-
-gc-checkout
-===========
-
-`gc-checkout <branch>`
+`checkout <branch>`
 
 * If `branch` already exists locally, check it out
 * If `branch` already exists remotely, check it out
 * If `branch` is new, create it locally and remotely
 
-gc-commit
-=========
-
-`gc-commit`
-
-* Passes through to `git commit`
-
-gc-diff
-=======
-
-`gc-diff`
-
-* Passes through to `git diff`
-
-gc-pull
-=======
+pull
+====
 
-`gc-pull`
+`pull`
 
 * Passes through to `git pull` but with `--rebase` flag
 
-gc-push
-=======
+push
+====
 
-`gc-push`
+`push`
 
 * Pushes only the current branch to `origin`
 
-gc-remerge
-==========
-
-* Work in progress, not done
-
-gc-rm
-=====
-
-`gc-rm`
-
-* Passes through to `git rm`
-
-gc-status
-=========
-
-`gc-status`
-
-* Passes through to `git status`
-
-
diff --git a/scripts/checkout b/scripts/checkout
new file mode 100644 (file)
index 0000000..5f50c26
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+branch_name=$1
+
+# See if it already exists
+git rev-parse --verify --quiet $branch_name >/dev/null 
+if [[ $? -eq 0 ]] ; then
+       # Just checkout what they asked
+       git checkout "$branch_name"
+else
+       # Make sure we have the latest origin/$branch_name to branch
+       git fetch
+       exists_remote=$(git branch -r | grep -x "  origin/$branch_name" | wc -l)
+       if [[ $exists_remote -eq 0 ]] ; then
+               # Specifying stable to get the last released code
+               git checkout -b "$branch_name" origin/stable
+               # Go ahead and put the branch out on the server
+               git push origin "$branch_name"
+               # Setup the merge property so that pulls come from the right place (instead of stable)
+               git config --replace-all "branch.$branch_name.merge" "refs/heads/$branch_name"
+       else
+               # Do the checkout
+               git checkout -b "$branch_name" "origin/$branch_name"
+       fi
+fi
+
diff --git a/scripts/create-gitconfig b/scripts/create-gitconfig
new file mode 100644 (file)
index 0000000..5556038
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Create an empty file object
+empty_file_hash=$(git hash-object -w --stdin <<FOO
+FOO)
+
+# Make a root directory tree with the config file in it
+config_tree_hash=$(git mktree <<FOO
+100644 blob $empty_file_hash   config
+FOO)
+
+# Commit the root directory tree
+commit_hash=$(git commit-tree $config_tree_hash <<FOO
+Initial commit on config branch.
+FOO)
+
+# Push the commit out to the gitconfig branch
+git update-ref refs/heads/gitconfig "$commit_hash" 0000000000000000000000000000000000000000
+
diff --git a/scripts/create-stable b/scripts/create-stable
new file mode 100644 (file)
index 0000000..89d39be
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Make a root directory tree with no files in it
+config_tree_hash=$(git mktree <<FOO
+FOO)
+
+# Commit the root directory tree
+commit_hash=$(git commit-tree $config_tree_hash <<FOO
+Initial commit on stable branch.
+FOO)
+
+echo "Made stable 0.0 commit $commit_hash"
+
+# Save the commit to the stable ref for later pushing to origin
+git update-ref refs/heads/stable "$commit_hash" 0000000000000000000000000000000000000000
+
diff --git a/scripts/functions b/scripts/functions
deleted file mode 100644 (file)
index b665bcb..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-function set_branch_name() {
-       branch_name=$(git symbolic-ref --quiet HEAD)
-       if [[ $? -ne 0 ]] ; then
-               branch_name=""
-       else
-               branch_name=${branch_name/refs\/heads\//}
-       fi
-}
-
diff --git a/scripts/gc-add b/scripts/gc-add
deleted file mode 100644 (file)
index 71a13b7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-if [[ $# -eq 0 ]] ; then
-       git ls-files -d | xargs -r git rm
-       git ls-files -m | xargs -r git add
-       git ls-files -o --exclude-standard | xargs -r git add
-else
-       git add $*
-fi
-
diff --git a/scripts/gc-checkout b/scripts/gc-checkout
deleted file mode 100644 (file)
index 5f50c26..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-branch_name=$1
-
-# See if it already exists
-git rev-parse --verify --quiet $branch_name >/dev/null 
-if [[ $? -eq 0 ]] ; then
-       # Just checkout what they asked
-       git checkout "$branch_name"
-else
-       # Make sure we have the latest origin/$branch_name to branch
-       git fetch
-       exists_remote=$(git branch -r | grep -x "  origin/$branch_name" | wc -l)
-       if [[ $exists_remote -eq 0 ]] ; then
-               # Specifying stable to get the last released code
-               git checkout -b "$branch_name" origin/stable
-               # Go ahead and put the branch out on the server
-               git push origin "$branch_name"
-               # Setup the merge property so that pulls come from the right place (instead of stable)
-               git config --replace-all "branch.$branch_name.merge" "refs/heads/$branch_name"
-       else
-               # Do the checkout
-               git checkout -b "$branch_name" "origin/$branch_name"
-       fi
-fi
-
diff --git a/scripts/gc-pull b/scripts/gc-pull
deleted file mode 100644 (file)
index c2313ba..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-branch_name=$(git symbolic-ref --quiet HEAD)
-if [[ $? -ne 0 ]] ; then
-       echo "not on a branch"
-       exit 1
-fi
-
-branch_name=${branch_name/refs\/heads\//}
-
-git fetch
-if [[ $? -ne 0 ]] ; then
-       exit $?
-fi
-
-GIT_EDITOR=: git rebase -p -i "origin/$branch_name"
-
diff --git a/scripts/gc-push b/scripts/gc-push
deleted file mode 100644 (file)
index 26ffa7b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-. $(dirname $0)/functions
-
-set_branch_name
-if [ "$branch_name" == "" ] ; then
-       echo "Not on a branch"
-       exit 1
-fi
-
-git push origin $branch_name
-if [[ $? -ne 0 ]] ; then
-    exit $?
-fi
-
-# ...tags...
-
diff --git a/scripts/gc-refollow b/scripts/gc-refollow
deleted file mode 100644 (file)
index 35a6369..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/sh
-
-#
-# Goes through the ensure-follows branches and makes sure
-# the non-excused branches have it merged.
-#
-
-die() {
-       echo >&2 "$@"
-       exit 1
-}
-
-attempt_merge() {
-       source_branch=$1
-       remote_branch=$2
-
-       if [ "$source_branch" == "$remote_branch" ] ; then
-               return
-       fi
-       if [[ $excused =~ " $remote_branch " ]] ; then
-               return
-       fi
-       git branch -r --contains "$source_branch" | grep --quiet "origin/$remote_branch"
-       if [ $? -eq 0 ] ; then
-               return
-       fi
-
-       echo -n "Merging $source_branch into $remote_branch..."
-
-       baserev=$(git merge-base "$source_branch" "origin/$remote_branch")
-       git read-tree -m --trivial $baserev "origin/$remote_branch" "$source_branch"
-       if [ $? -ne 0 ] ; then
-               echo "failed merge"
-               return
-       fi
-
-       new_tree=$(git write-tree)
-       new_commit=$(git commit-tree $new_tree -p "origin/$remote_branch" -p "$source_branch" <<FOO
-Merge $source_branch into $remote_branch
-FOO)
-       if [ "$new_commit" == "" ] ; then
-               echo "failed commit"
-               return
-       fi
-
-       git push origin "$new_commit:$remote_branch" >/dev/null 2>/dev/null
-       if [ $? -ne 0 ] ; then
-               echo "failed push"
-               return
-       fi
-
-       echo "succeeded"
-}
-
-gitconfig=$(git rev-parse origin/gitconfig)
-if [ $? -ne 0 ] ; then
-       echo "gitconfig branch not found"
-       exit 1
-fi
-
-# The source branches
-config_hash=$(git ls-tree $gitconfig | grep config | grep -oP '\w{40}')
-branches=$(git cat-file blob "$config_hash" | grep hooks.update-ensure-follows.branches)
-branches=("${branches#*=}")
-excused=$(git cat-file blob "$config_hash" | grep hooks.update-ensure-follows.excused)
-excused=" ${excused#*=} "
-
-# We're going to merge stuff into the index, so make sure it's okay
-git diff-index --cached --quiet HEAD -- || die "refusing to refollow--your index is not clean"
-
-# Get the latest remote refs
-git fetch
-
-# So we can put the index back after we screw with it
-original_head=$(git rev-parse HEAD)
-
-for source_branch in ${branches[@]} ; do
-       git branch -r | grep -v HEAD | while read line ; do
-               if [[ "$line" =~ origin/(.*) ]] ; then
-                       attempt_merge $source_branch ${BASH_REMATCH[1]}
-               fi
-       done
-done
-
-# Put the index back
-git read-tree "$original_head"
-
diff --git a/scripts/gc-remerge b/scripts/gc-remerge
deleted file mode 100644 (file)
index 99d868b..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-git rev-list --first-parent "origin/stable..HEAD" | while read commit ; do
-       number_of_parents=$(git rev-list -n 1 --parents $commit | sed 's/ /\n/g' | grep -v $commit | wc -l)
-       if [[ $number_of_parents > 1 ]] ; then
-               # For each parent
-               git rev-list --no-walk --parents $commit | sed 's/ /\n/g' | grep -v $commit | while read parent ; do
-                       echo "merge=$commit parent=$parent"
-                       # Does this parent have any children besides us?
-                       #
-                       # List the parents of all branch commits (after stable/parent), find
-                       # those that include our parent, get their sha1, remove our merge
-                       git rev-list --parents --branches ^stable "^$parent" | grep $parent | gawk '{print $1}' | grep -v $commit | while read child ; do
-                               echo "child $child"
-                               git rev-list "$child" "^$commit"
-                       done
-                       # Find any commits in the parent (and another branch) but not us--that means we need it
-                       # number_missing=$(git rev-list "$parent" --branches "^HEAD" | wc -l)
-                       # if [[ $number_missing > 0 ]] ; then
-                       #       git rev-list "$parent" --branches "^HEAD" | xargs git name-rev
-                       # fi
-               done
-       fi
-done
-
diff --git a/scripts/gc-tattoo b/scripts/gc-tattoo
deleted file mode 100644 (file)
index f1bd3a1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-. $(dirname $0)/functions
-
-git fetch
-
-set_branch_name
-
-echo "branch_name='$branch_name'"
-
-if [ "$branch_name" == "" ] ; then
-       echo "Not on a branch (for $branch_name)"
-       exit 1
-fi
-
-describe=$(git describe --tags --always HEAD)
-case "$describe" in
-       r/*)
-               describe=${describe##r\/}
-               echo "$branch_name-$describe"
-               ;;
-       *)
-               echo "No commit number tag found"
-               exit 1
-               ;;
-esac
-
diff --git a/scripts/make-gitconfig-branch b/scripts/make-gitconfig-branch
deleted file mode 100644 (file)
index 5556038..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# Create an empty file object
-empty_file_hash=$(git hash-object -w --stdin <<FOO
-FOO)
-
-# Make a root directory tree with the config file in it
-config_tree_hash=$(git mktree <<FOO
-100644 blob $empty_file_hash   config
-FOO)
-
-# Commit the root directory tree
-commit_hash=$(git commit-tree $config_tree_hash <<FOO
-Initial commit on config branch.
-FOO)
-
-# Push the commit out to the gitconfig branch
-git update-ref refs/heads/gitconfig "$commit_hash" 0000000000000000000000000000000000000000
-
diff --git a/scripts/make-stable-branch b/scripts/make-stable-branch
deleted file mode 100644 (file)
index 89d39be..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-# Make a root directory tree with no files in it
-config_tree_hash=$(git mktree <<FOO
-FOO)
-
-# Commit the root directory tree
-commit_hash=$(git commit-tree $config_tree_hash <<FOO
-Initial commit on stable branch.
-FOO)
-
-echo "Made stable 0.0 commit $commit_hash"
-
-# Save the commit to the stable ref for later pushing to origin
-git update-ref refs/heads/stable "$commit_hash" 0000000000000000000000000000000000000000
-
diff --git a/scripts/pull b/scripts/pull
new file mode 100644 (file)
index 0000000..c2313ba
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+branch_name=$(git symbolic-ref --quiet HEAD)
+if [[ $? -ne 0 ]] ; then
+       echo "not on a branch"
+       exit 1
+fi
+
+branch_name=${branch_name/refs\/heads\//}
+
+git fetch
+if [[ $? -ne 0 ]] ; then
+       exit $?
+fi
+
+GIT_EDITOR=: git rebase -p -i "origin/$branch_name"
+
diff --git a/scripts/push b/scripts/push
new file mode 100644 (file)
index 0000000..7583ce6
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+branch_name=$(git symbolic-ref --quiet HEAD)
+if [[ $? -ne 0 ]] ; then
+       echo "Not on a branch"
+       exit 1
+fi
+
+branch_name=${branch_name/refs\/heads\//}
+
+git push origin $branch_name
+if [[ $? -ne 0 ]] ; then
+       exit $?
+fi
+
+# ...tags...
+
diff --git a/scripts/refollow b/scripts/refollow
new file mode 100644 (file)
index 0000000..35a6369
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+#
+# Goes through the ensure-follows branches and makes sure
+# the non-excused branches have it merged.
+#
+
+die() {
+       echo >&2 "$@"
+       exit 1
+}
+
+attempt_merge() {
+       source_branch=$1
+       remote_branch=$2
+
+       if [ "$source_branch" == "$remote_branch" ] ; then
+               return
+       fi
+       if [[ $excused =~ " $remote_branch " ]] ; then
+               return
+       fi
+       git branch -r --contains "$source_branch" | grep --quiet "origin/$remote_branch"
+       if [ $? -eq 0 ] ; then
+               return
+       fi
+
+       echo -n "Merging $source_branch into $remote_branch..."
+
+       baserev=$(git merge-base "$source_branch" "origin/$remote_branch")
+       git read-tree -m --trivial $baserev "origin/$remote_branch" "$source_branch"
+       if [ $? -ne 0 ] ; then
+               echo "failed merge"
+               return
+       fi
+
+       new_tree=$(git write-tree)
+       new_commit=$(git commit-tree $new_tree -p "origin/$remote_branch" -p "$source_branch" <<FOO
+Merge $source_branch into $remote_branch
+FOO)
+       if [ "$new_commit" == "" ] ; then
+               echo "failed commit"
+               return
+       fi
+
+       git push origin "$new_commit:$remote_branch" >/dev/null 2>/dev/null
+       if [ $? -ne 0 ] ; then
+               echo "failed push"
+               return
+       fi
+
+       echo "succeeded"
+}
+
+gitconfig=$(git rev-parse origin/gitconfig)
+if [ $? -ne 0 ] ; then
+       echo "gitconfig branch not found"
+       exit 1
+fi
+
+# The source branches
+config_hash=$(git ls-tree $gitconfig | grep config | grep -oP '\w{40}')
+branches=$(git cat-file blob "$config_hash" | grep hooks.update-ensure-follows.branches)
+branches=("${branches#*=}")
+excused=$(git cat-file blob "$config_hash" | grep hooks.update-ensure-follows.excused)
+excused=" ${excused#*=} "
+
+# We're going to merge stuff into the index, so make sure it's okay
+git diff-index --cached --quiet HEAD -- || die "refusing to refollow--your index is not clean"
+
+# Get the latest remote refs
+git fetch
+
+# So we can put the index back after we screw with it
+original_head=$(git rev-parse HEAD)
+
+for source_branch in ${branches[@]} ; do
+       git branch -r | grep -v HEAD | while read line ; do
+               if [[ "$line" =~ origin/(.*) ]] ; then
+                       attempt_merge $source_branch ${BASH_REMATCH[1]}
+               fi
+       done
+done
+
+# Put the index back
+git read-tree "$original_head"
+
diff --git a/tests/t5000-checkout.sh b/tests/t5000-checkout.sh
new file mode 100644 (file)
index 0000000..c9ce960
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+test_description='script checkout'
+
+. ./test-lib.sh
+
+export PATH=$PATH:../../scripts
+
+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 checkout -b stable &&
+       git push origin stable
+'
+
+test_expect_success 'checkout a new branch clones stable' '
+       gc-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 &&
+       echo "$test_name on server" >a &&
+       git commit -a -m "Made topic2 on server" &&
+       cd .. &&
+
+       ! git branch | grep topic2 &&
+       gc-checkout topic2 &&
+       git branch | grep topic2 &&
+       git branch -r | grep origin/topic2 &&
+       git config --list | grep "branch.topic2.merge=refs/heads/topic2" &&
+
+       echo "$test_name on client" >a &&
+       git commit -a -m "Move topic2 on client" &&
+       git push origin topic2
+'
+
+test_expect_success 'checkout an existing local branch' '
+       gc-checkout topic1
+'
+
+test_expect_success 'checkout a revision does not create a new branch' '
+       echo "$test_name" >a &&
+       git commit -a -m "$test_name" &&
+
+       prior=$(git rev-parse HEAD^) &&
+       gc-checkout $prior &&
+       git branch | grep "no branch"
+'
+
+test_done
+
diff --git a/tests/t5000-script-checkout.sh b/tests/t5000-script-checkout.sh
deleted file mode 100644 (file)
index c9ce960..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-
-test_description='script checkout'
-
-. ./test-lib.sh
-
-export PATH=$PATH:../../scripts
-
-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 checkout -b stable &&
-       git push origin stable
-'
-
-test_expect_success 'checkout a new branch clones stable' '
-       gc-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 &&
-       echo "$test_name on server" >a &&
-       git commit -a -m "Made topic2 on server" &&
-       cd .. &&
-
-       ! git branch | grep topic2 &&
-       gc-checkout topic2 &&
-       git branch | grep topic2 &&
-       git branch -r | grep origin/topic2 &&
-       git config --list | grep "branch.topic2.merge=refs/heads/topic2" &&
-
-       echo "$test_name on client" >a &&
-       git commit -a -m "Move topic2 on client" &&
-       git push origin topic2
-'
-
-test_expect_success 'checkout an existing local branch' '
-       gc-checkout topic1
-'
-
-test_expect_success 'checkout a revision does not create a new branch' '
-       echo "$test_name" >a &&
-       git commit -a -m "$test_name" &&
-
-       prior=$(git rev-parse HEAD^) &&
-       gc-checkout $prior &&
-       git branch | grep "no branch"
-'
-
-test_done
-
diff --git a/tests/t5100-push.sh b/tests/t5100-push.sh
new file mode 100644 (file)
index 0000000..587e036
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+test_description='script create branch'
+
+. ./test-lib.sh
+
+export PATH=$PATH:../../scripts
+
+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 &&
+
+       git checkout -b stable &&
+       git push origin stable
+'
+
+test_expect_success 'push only does one branch' '
+       checkout topic1 &&
+       echo "$test_name" >a &&
+       git commit -a -m "move topic1" &&
+       git rev-parse HEAD >head.topic1 &&
+
+       checkout topic2 &&
+       echo "$test_name" >a &&
+       git commit -a -m "move topic2" &&
+       git rev-parse HEAD >head.topic2 &&
+
+       push &&
+       git rev-parse origin/topic2 >head.origin.topic2 &&
+       git rev-parse origin/topic1 >head.origin.topic1 &&
+
+       test_cmp head.topic2 head.origin.topic2 &&
+       ! test_cmp head.topic2 head.origin.topic1
+'
+
+test_done
+
diff --git a/tests/t5100-script-push.sh b/tests/t5100-script-push.sh
deleted file mode 100644 (file)
index 7ca75e8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh
-
-test_description='script create branch'
-
-. ./test-lib.sh
-
-export PATH=$PATH:../../scripts
-
-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 &&
-
-       git checkout -b stable &&
-       git push origin stable
-'
-
-test_expect_success 'push only does one branch' '
-       gc-checkout topic1 &&
-       echo "$test_name" >a &&
-       git commit -a -m "move topic1" &&
-       git rev-parse HEAD >head.topic1 &&
-
-       gc-checkout topic2 &&
-       echo "$test_name" >a &&
-       git commit -a -m "move topic2" &&
-       git rev-parse HEAD >head.topic2 &&
-
-       gc-push &&
-       git rev-parse origin/topic2 >head.origin.topic2 &&
-       git rev-parse origin/topic1 >head.origin.topic1 &&
-
-       test_cmp head.topic2 head.origin.topic2 &&
-       ! test_cmp head.topic2 head.origin.topic1
-'
-
-test_done
-
diff --git a/tests/t5200-pull.sh b/tests/t5200-pull.sh
new file mode 100644 (file)
index 0000000..6fdfb07
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+test_description='script pull'
+
+. ./test-lib.sh
+
+export PATH=$PATH:../../scripts
+
+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 checkout -b stable &&
+       git push origin stable
+'
+
+test_expect_success 'pull does a rebase' '
+       checkout topic1 &&
+       echo "$test_name" >a.topic1 &&
+       git add a.topic1 &&
+       git commit -m "move topic1" &&
+
+       # Move topic1 on the server
+       cd server &&
+       git checkout topic1 &&
+       echo "$test_name" >a &&
+       git commit -a -m "move topic1 on the server" &&
+       cd .. &&
+
+       # Only one parent
+       pull &&
+       test 1 = $(git cat-file commit $(git rev-parse HEAD) | grep parent | wc -l)
+'
+
+test_expect_success 'pull does a rebase but does not fuck up merges' '
+       checkout topic2 &&
+       echo "$test_name on topic2" >a.topic2 &&
+       git add a.topic2 &&
+       git commit -a -m "create topic2" &&
+       git push origin topic2 &&
+
+       # Move stable
+       git checkout stable &&
+       echo "$test_name on stable" >a &&
+       git commit -a -m "move stable that will not be replayed" &&
+       git push origin stable &&
+
+       # And merge stable into topic2
+       git checkout topic2 &&
+       git merge stable &&
+
+       # Move topic2 on the server
+       cd server &&
+       git checkout topic2 &&
+       echo "$test_name" >a.topic2.server &&
+       git add a.topic2.server &&
+       git commit -m "move topic2 on the server" &&
+       cd .. &&
+
+       # Merge stable locally too--should conflict
+       git checkout topic2 &&
+       pull &&
+       test 1 = $(git rev-list --all --pretty=oneline | grep "replayed" | wc -l)
+'
+
+test_done
+
diff --git a/tests/t5200-script-pull.sh b/tests/t5200-script-pull.sh
deleted file mode 100644 (file)
index 39e660d..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/sh
-
-test_description='script pull'
-
-. ./test-lib.sh
-
-export PATH=$PATH:../../scripts
-
-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 checkout -b stable &&
-       git push origin stable
-'
-
-test_expect_success 'pull does a rebase' '
-       gc-checkout topic1 &&
-       echo "$test_name" >a.topic1 &&
-       git add a.topic1 &&
-       git commit -m "move topic1" &&
-
-       # Move topic1 on the server
-       cd server &&
-       git checkout topic1 &&
-       echo "$test_name" >a &&
-       git commit -a -m "move topic1 on the server" &&
-       cd .. &&
-
-       # Only one parent
-       gc-pull &&
-       test 1 = $(git cat-file commit $(git rev-parse HEAD) | grep parent | wc -l)
-'
-
-test_expect_success 'pull does a rebase but does not fuck up merges' '
-       gc-checkout topic2 &&
-       echo "$test_name on topic2" >a.topic2 &&
-       git add a.topic2 &&
-       git commit -a -m "create topic2" &&
-       git push origin topic2 &&
-
-       # Move stable
-       git checkout stable &&
-       echo "$test_name on stable" >a &&
-       git commit -a -m "move stable that will not be replayed" &&
-       git push origin stable &&
-
-       # And merge stable into topic2
-       git checkout topic2 &&
-       git merge stable &&
-
-       # Move topic2 on the server
-       cd server &&
-       git checkout topic2 &&
-       echo "$test_name" >a.topic2.server &&
-       git add a.topic2.server &&
-       git commit -m "move topic2 on the server" &&
-       cd .. &&
-
-       # Merge stable locally too--should conflict
-       git checkout topic2 &&
-       gc-pull &&
-       test 1 = $(git rev-list --all --pretty=oneline | grep "replayed" | wc -l)
-'
-
-test_done
-
diff --git a/tests/t5300-script-add.sh b/tests/t5300-script-add.sh
deleted file mode 100644 (file)
index 76fdca2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-test_description='script add'
-
-. ./test-lib.sh
-
-export PATH=$PATH:../../scripts
-
-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 checkout -b stable &&
-       git push origin stable
-'
-
-test_expect_success 'add picks up new files' '
-       echo "$test_name" >a.new &&
-       gc-add &&
-       git commit -m "add"
-'
-
-test_expect_success 'add picks up changed files' '
-       echo "$test_name" >a.new &&
-       gc-add &&
-       git commit -m "change"
-'
-
-test_expect_success 'add picks up removed files' '
-       rm a.new &&
-       gc-add &&
-       git commit -m "remove"
-'
-
-test_done
-
diff --git a/tests/t5400-refollow.sh b/tests/t5400-refollow.sh
new file mode 100644 (file)
index 0000000..70e90d4
--- /dev/null
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+test_description='script refollow'
+
+. ./test-lib.sh
+
+export PATH=$PATH:../../scripts
+
+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 checkout -b stable &&
+       git push origin stable
+'
+
+test_expect_success 'setup gitconfig' '
+       make-gitconfig-branch &&
+       git checkout gitconfig &&
+       echo "hooks.update-ensure-follows.branches=stable" >>config &&
+       echo "hooks.update-ensure-follows.excused=master gitconfig" >>config &&
+       git commit -a -m "enable update-ensure-follows" &&
+       git push origin gitconfig
+'
+
+test_expect_success 'make topic1 then move stable' '
+       git checkout -b topic1 stable &&
+       echo "$test_name" >a.topic1 &&
+       git add a.topic1 &&
+       git commit -m "$test_name on topic1" &&
+       git push origin topic1 &&
+
+       git checkout stable &&
+       echo "$test_name" >a &&
+       git commit -a -m "$test_name on stable" &&
+       git push
+'
+
+test_expect_success 'refollow fails with dirty index' '
+       echo "$test_name" >a &&
+       git add a &&
+       ! refollow 2>refollow.err &&
+       cat refollow.err | grep "refusing to refollow--your index is not clean" &&
+       ! git reset a
+'
+
+test_expect_success 'refollow topic1 onto stable' '
+       echo "$test_name" >a &&
+       git commit -a -m "move stable" &&
+       git push origin stable &&
+       refollow >refollow.out &&
+       cat refollow.out | grep "Merging stable into topic1...succeeded"
+
+       git checkout topic1 &&
+       git pull origin topic1 &&
+       cat a | grep "$test_name"
+'
+
+test_expect_success 'refollow does not double tap' '
+       # Still on topic1
+       head=$(git rev-parse HEAD) &&
+       refollow &&
+       git pull origin topic1 &&
+       git rev-parse HEAD | grep $head
+'
+
+test_expect_success 'refollow respects excused' '
+       git checkout gitconfig &&
+       head=$(git rev-parse HEAD) &&
+
+       git checkout stable &&
+       echo "$test_name" >a &&
+       git commit -a -m "move stable" &&
+       git push origin stable &&
+
+       refollow &&
+
+       git checkout gitconfig &&
+       git pull origin gitconfig &&
+       git rev-parse HEAD | grep $head
+'
+
+test_expect_success 'refollow continues on conflict' '
+       git checkout -b topic2 stable &&
+       echo "$test_name" >a &&
+       git commit -a -m "create topic2" &&
+       git push origin topic2 &&
+
+       git checkout stable &&
+       echo "$test_name" >a &&
+       git commit -a -m "move stable" &&
+       git push origin stable &&
+
+       refollow > refollow.out &&
+       cat refollow.out | grep "Merging stable into topic1...succeeded"
+       cat refollow.out | grep "Merging stable into topic2...failed merge"
+'
+
+test_done
+
diff --git a/tests/t5400-script-refollow.sh b/tests/t5400-script-refollow.sh
deleted file mode 100644 (file)
index 911f177..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/bin/sh
-
-test_description='script refollow'
-
-. ./test-lib.sh
-
-export PATH=$PATH:../../scripts
-
-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 checkout -b stable &&
-       git push origin stable
-'
-
-test_expect_success 'setup gitconfig' '
-       make-gitconfig-branch &&
-       git checkout gitconfig &&
-       echo "hooks.update-ensure-follows.branches=stable" >>config &&
-       echo "hooks.update-ensure-follows.excused=master gitconfig" >>config &&
-       git commit -a -m "enable update-ensure-follows" &&
-       git push origin gitconfig
-'
-
-test_expect_success 'make topic1 then move stable' '
-       git checkout -b topic1 stable &&
-       echo "$test_name" >a.topic1 &&
-       git add a.topic1 &&
-       git commit -m "$test_name on topic1" &&
-       git push origin topic1 &&
-
-       git checkout stable &&
-       echo "$test_name" >a &&
-       git commit -a -m "$test_name on stable" &&
-       git push
-'
-
-test_expect_success 'refollow fails with dirty index' '
-       echo "$test_name" >a &&
-       git add a &&
-       ! gc-refollow 2>refollow.err &&
-       cat refollow.err | grep "refusing to refollow--your index is not clean" &&
-       ! git reset a
-'
-
-test_expect_success 'refollow topic1 onto stable' '
-       echo "$test_name" >a &&
-       git commit -a -m "move stable" &&
-       git push origin stable &&
-       gc-refollow >refollow.out &&
-       cat refollow.out | grep "Merging stable into topic1...succeeded"
-
-       git checkout topic1 &&
-       git pull origin topic1 &&
-       cat a | grep "$test_name"
-'
-
-test_expect_success 'refollow does not double tap' '
-       # Still on topic1
-       head=$(git rev-parse HEAD) &&
-       gc-refollow &&
-       git pull origin topic1 &&
-       git rev-parse HEAD | grep $head
-'
-
-test_expect_success 'refollow respects excused' '
-       git checkout gitconfig &&
-       head=$(git rev-parse HEAD) &&
-
-       git checkout stable &&
-       echo "$test_name" >a &&
-       git commit -a -m "move stable" &&
-       git push origin stable &&
-
-       gc-refollow &&
-
-       git checkout gitconfig &&
-       git pull origin gitconfig &&
-       git rev-parse HEAD | grep $head
-'
-
-test_expect_success 'refollow continues on conflict' '
-       git checkout -b topic2 stable &&
-       echo "$test_name" >a &&
-       git commit -a -m "create topic2" &&
-       git push origin topic2 &&
-
-       git checkout stable &&
-       echo "$test_name" >a &&
-       git commit -a -m "move stable" &&
-       git push origin stable &&
-
-       gc-refollow > refollow.out &&
-       cat refollow.out | grep "Merging stable into topic1...succeeded"
-       cat refollow.out | grep "Merging stable into topic2...failed merge"
-'
-
-test_done
-
diff --git a/tests/t5500-script-tattoo.sh b/tests/t5500-script-tattoo.sh
deleted file mode 100644 (file)
index 561b4bf..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/bin/sh
-
-test_description='script tattoo'
-
-. ./test-lib.sh
-
-export PATH=$PATH:../../scripts
-
-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 checkout -b stable &&
-       git push origin stable
-'
-
-# tattoo makes assumptions based on the update stable hook sanity checks
-install_update_hook 'update-stable'
-install_post_receive_hook 'post-receive-assign-commit-numbers'
-
-test_expect_success 'tattoo of unpublished commit fails' '
-       gc-tattoo | grep "No commit number tag found"
-'
-
-test_done
-
-test_expect_success 'tattoo 1' '
-       git checkout -b topic1 &&
-       echo "$test_name" >a.topic1 &&
-       git add a.topic1 &&
-       git commit -a -m "move topic1-1" &&
-       git push origin topic1 &&
-       gc-tattoo | grep topic1-1
-'
-
-test_expect_success 'tattoo 2' '
-       echo "$test_name" >a &&
-       git commit -a -m "make topic1-2" &&
-       git push origin topic1 &&
-       gc-tattoo | grep topic1-2
-'
-
-test_expect_success 'merge topic2 into topic1 as tattoo 3' '
-       git checkout -b topic2 stable &&
-       echo "$test_name" >a.topic2 &&
-       git add a.topic2 &&
-       git commit -m "make topic2-1" &&
-       git push origin topic2 &&
-       gc-tattoo | grep topic2-1 &&
-
-       git checkout topic1 &&
-       git merge topic2 &&
-       git push origin topic1 &&
-       gc-tattoo | grep topic1-3 &&
-
-       git checkout topic2 &&
-       gc-tattoo | grep topic2-1
-'
-
-test_expect_success 'fails if not pushed' '
-       git checkout topic1 &&
-       echo "$test_name" >a &&
-       git commit -a -m "make topic1-4" &&
-       head=$(git rev-parse HEAD) &&
-       gc-tattoo | grep "$head has not been pushed" &&
-       git push origin topic1 &&
-       gc-tattoo | grep topic1-4
-'
-
-test_expect_success 'stable fails if not pushed' '
-       git checkout stable &&
-       git merge --no-ff topic1 &&
-       head=$(git rev-parse HEAD) &&
-       gc-tattoo | grep "$head has not been pushed" &&
-       git push &&
-       gc-tattoo | grep "stable-$head"
-'
-
-test_expect_success 'stable without a tag' '
-       git checkout stable &&
-       head=$(git rev-parse HEAD) &&
-       gc-tattoo | grep "stable-$head"
-'
-
-test_expect_success 'stable with a tag' '
-       git tag -m "1.0" 1.0 &&
-       gc-tattoo | grep "1.0"
-'
-
-test_expect_success 'use origin stable not local' '
-       git checkout origin/stable &&
-       git branch -d stable &&
-       git checkout topic2 &&
-       gc-tattoo | grep "topic2-1"
-'
-
-test_done
-