From eec60f77ff4eb867ee5050088c3cd9189fb721fa Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Thu, 14 Aug 2008 17:14:03 -0500 Subject: [PATCH] create-branch script. --- scripts/create-branch | 16 +++++++++++++++ tests/t5000-script-create-branch.sh | 32 +++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 scripts/create-branch create mode 100644 tests/t5000-script-create-branch.sh diff --git a/scripts/create-branch b/scripts/create-branch new file mode 100644 index 0000000..a3743d2 --- /dev/null +++ b/scripts/create-branch @@ -0,0 +1,16 @@ +#!/bin/sh + +new_branch_name=$1 + +# Make sure we have the latest origin/stable to branch +git fetch + +# Specifying stable to get the last released code +git checkout -b $new_branch_name origin/stable + +# Go ahead and put the branch out on the server +git push origin $new_branch_name + +# Setup the merge property so that pulls come from the right place (instead of stable) +git config --replace-all "branch.$new_branch_name.merge" "refs/heads/$new_branch_name" + diff --git a/tests/t5000-script-create-branch.sh b/tests/t5000-script-create-branch.sh new file mode 100644 index 0000000..a5985d6 --- /dev/null +++ b/tests/t5000-script-create-branch.sh @@ -0,0 +1,32 @@ +#!/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 'create branch clones stable' ' + create-branch topic1 + git branch | grep topic1 + git branch -r | grep origin/topic1 + git config --list | grep "branch.topic1.merge=refs/heads/topic1" +' + +test_done + -- 2.39.5