]> git.droids-corp.org - git-central.git/commitdiff
Push/pull scripts.
authorStephen Haberman <stephen@exigencecorp.com>
Thu, 14 Aug 2008 22:50:34 +0000 (17:50 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Thu, 14 Aug 2008 22:50:34 +0000 (17:50 -0500)
scripts/pull [new file with mode: 0644]
scripts/push [new file with mode: 0644]
tests/t5100-script-push.sh [new file with mode: 0644]

diff --git a/scripts/pull b/scripts/pull
new file mode 100644 (file)
index 0000000..325eb2d
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+git pull --rebase
+
diff --git a/scripts/push b/scripts/push
new file mode 100644 (file)
index 0000000..32952b1
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+branch_name=$(git-symbolic-ref HEAD)
+
+git push origin $branch_name
+if [[ $? -ne 0 ]] ; then
+    exit $?
+fi
+
+# ...tags...
+
diff --git a/tests/t5100-script-push.sh b/tests/t5100-script-push.sh
new file mode 100644 (file)
index 0000000..752960d
--- /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 --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' '
+       create-branch topic1 &&
+       echo "$test_name" >a &&
+       git commit -a -m "move topic1" &&
+       git rev-parse HEAD >head.topic1 &&
+
+       create-branch 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
+