-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`
-
-
--- /dev/null
+#!/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
+
--- /dev/null
+#!/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
+
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-}
-
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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"
-
+++ /dev/null
-#!/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...
-
+++ /dev/null
-#!/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"
-
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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"
+
--- /dev/null
+#!/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...
+
--- /dev/null
+#!/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"
+
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
-