+++ /dev/null
-#!/bin/sh
-
-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
-
+++ /dev/null
-#!/bin/sh
-
-branch_name=$1
-exists_local=$(git branch | grep -x " $branch_name" | wc -l)
-exists_remote=$(git branch | grep -x " origin/$branch_name" | wc -l)
-
-if [[ $exists_remote -eq 0 ]] ; then
- # Make sure we have the latest origin/stable to branch
- git fetch
- # 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
- if [[ $exists_local -eq 0 ]] ; then
- # Make sure we have the latest origin/$branch_name to branch
- git fetch
- # Do the checkout
- git checkout -b "$branch_name" "origin/$branch_name"
- else
- # Just checkout
- git checkout "$branch_name"
- fi
-fi
-
--- /dev/null
+#!/bin/sh
+
+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
+
--- /dev/null
+#!/bin/sh
+
+branch_name=$1
+exists_local=$(git branch | grep -x " $branch_name" | wc -l)
+exists_remote=$(git branch | grep -x " origin/$branch_name" | wc -l)
+
+if [[ $exists_remote -eq 0 ]] ; then
+ # Make sure we have the latest origin/stable to branch
+ git fetch
+ # 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
+ if [[ $exists_local -eq 0 ]] ; then
+ # Make sure we have the latest origin/$branch_name to branch
+ git fetch
+ # Do the checkout
+ git checkout -b "$branch_name" "origin/$branch_name"
+ else
+ # Just checkout
+ git checkout "$branch_name"
+ fi
+fi
+
--- /dev/null
+#!/bin/sh
+
+git pull --rebase
+
--- /dev/null
+#!/bin/sh
+
+branch_name=$(git-symbolic-ref HEAD)
+
+git push origin $branch_name
+if [[ $? -ne 0 ]] ; then
+ exit $?
+fi
+
+# ...tags...
+
--- /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
-
-git pull --rebase
-
+++ /dev/null
-#!/bin/sh
-
-branch_name=$(git-symbolic-ref HEAD)
-
-git push origin $branch_name
-if [[ $? -ne 0 ]] ; then
- exit $?
-fi
-
-# ...tags...
-
+++ /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
-
'
test_expect_success 'checkout a new branch clones stable' '
- checkout topic1 &&
+ gc-checkout topic1 &&
git branch | grep topic1 &&
git branch -r | grep origin/topic1 &&
git config --list | grep "branch.topic1.merge=refs/heads/topic1"
git commit -a -m "Made topic2 on server" &&
cd .. &&
- checkout topic2
+ gc-checkout topic2
git branch | grep topic2
git branch -r | grep origin/topic2
git config --list | grep "branch.topic2.merge=refs/heads/topic2"
'
test_expect_success 'checkout an existing local branch' '
- checkout topic1
+ gc-checkout topic1
'
test_done
'
test_expect_success 'push only does one branch' '
- checkout topic1 &&
+ gc-checkout topic1 &&
echo "$test_name" >a &&
git commit -a -m "move topic1" &&
git rev-parse HEAD >head.topic1 &&
- checkout topic2 &&
+ gc-checkout topic2 &&
echo "$test_name" >a &&
git commit -a -m "move topic2" &&
git rev-parse HEAD >head.topic2 &&
- push &&
+ gc-push &&
git rev-parse origin/topic2 >head.origin.topic2 &&
git rev-parse origin/topic1 >head.origin.topic1 &&
'
test_expect_success 'pull does a rebase' '
- checkout topic1 &&
+ gc-checkout topic1 &&
echo "$test_name" >a.topic1 &&
git add a.topic1 &&
git commit -m "move topic1" &&
cd .. &&
# Only one parent
- pull &&
+ gc-pull &&
git cat-file commit $(git rev-parse HEAD) | grep parent | wc -l | grep 1
'
#test_expect_success 'pull does a rebase but does not fuck up merges' '
# # Change "a" itself so we will eventually conflict
-# checkout topic2 &&
+# gc-checkout topic2 &&
# echo "$test_name on topic2" >a &&
# git commit -a -m "move topic2" &&
#
# git merge origin/stable
#
# # Now pull and see what happens
-# # pull
+# # gc-pull
#'
test_done
test_expect_success 'add picks up new files' '
echo "$test_name" >a.new &&
- add &&
+ gc-add &&
git commit -m "add"
'
test_expect_success 'add picks up changed files' '
echo "$test_name" >a.new &&
- add &&
+ gc-add &&
git commit -m "change"
'
test_expect_success 'add picks up removed files' '
rm a.new &&
- add &&
+ gc-add &&
git commit -m "remove"
'