From: Stephen Haberman Date: Thu, 14 Aug 2008 22:50:34 +0000 (-0500) Subject: Push/pull scripts. X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=56552998777b7a1b33265756674441019d68967e;p=git-central.git Push/pull scripts. --- diff --git a/scripts/pull b/scripts/pull new file mode 100644 index 0000000..325eb2d --- /dev/null +++ b/scripts/pull @@ -0,0 +1,4 @@ +#!/bin/sh + +git pull --rebase + diff --git a/scripts/push b/scripts/push new file mode 100644 index 0000000..32952b1 --- /dev/null +++ b/scripts/push @@ -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 index 0000000..752960d --- /dev/null +++ b/tests/t5100-script-push.sh @@ -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 +