From 1f81fc1569f585a1fc94c42759c9c73cc11eb350 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Tue, 19 Aug 2008 15:41:37 -0500 Subject: [PATCH] 'add' picks up all changes. --- scripts/add | 6 ++++++ scripts/checkout | 1 - tests/t5100-script-push.sh | 4 ++-- tests/t5200-script-pull.sh | 10 +++------- tests/t5300-script-add.sh | 39 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 scripts/add create mode 100644 tests/t5300-script-add.sh diff --git a/scripts/add b/scripts/add new file mode 100644 index 0000000..9260eac --- /dev/null +++ b/scripts/add @@ -0,0 +1,6 @@ +#!/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 + diff --git a/scripts/checkout b/scripts/checkout index 5914676..b8c5ee9 100644 --- a/scripts/checkout +++ b/scripts/checkout @@ -1,7 +1,6 @@ #!/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) diff --git a/tests/t5100-script-push.sh b/tests/t5100-script-push.sh index 752960d..49e1027 100644 --- a/tests/t5100-script-push.sh +++ b/tests/t5100-script-push.sh @@ -22,12 +22,12 @@ test_expect_success 'setup' ' ' test_expect_success 'push only does one branch' ' - create-branch topic1 && + checkout topic1 && echo "$test_name" >a && git commit -a -m "move topic1" && git rev-parse HEAD >head.topic1 && - create-branch topic2 && + checkout topic2 && echo "$test_name" >a && git commit -a -m "move topic2" && git rev-parse HEAD >head.topic2 && diff --git a/tests/t5200-script-pull.sh b/tests/t5200-script-pull.sh index c782932..7ecbe47 100644 --- a/tests/t5200-script-pull.sh +++ b/tests/t5200-script-pull.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='script create branch' +test_description='script pull' . ./test-lib.sh @@ -13,16 +13,12 @@ test_expect_success '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 'pull does a rebase' ' - create-branch topic1 && + checkout topic1 && echo "$test_name" >a.topic1 && git add a.topic1 && git commit -m "move topic1" && @@ -41,7 +37,7 @@ test_expect_success 'pull does a rebase' ' #test_expect_success 'pull does a rebase but does not fuck up merges' ' # # Change "a" itself so we will eventually conflict -# create-branch topic2 && +# checkout topic2 && # echo "$test_name on topic2" >a && # git commit -a -m "move topic2" && # diff --git a/tests/t5300-script-add.sh b/tests/t5300-script-add.sh new file mode 100644 index 0000000..82ed134 --- /dev/null +++ b/tests/t5300-script-add.sh @@ -0,0 +1,39 @@ +#!/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 && + add && + git commit -m "add" +' + +test_expect_success 'add picks up changed files' ' + echo "$test_name" >a.new && + add && + git commit -m "change" +' + +test_expect_success 'add picks up removed files' ' + rm a.new && + add && + git commit -m "remove" +' + +test_done + -- 2.20.1