'add' picks up all changes.
authorStephen Haberman <stephen@exigencecorp.com>
Tue, 19 Aug 2008 20:41:37 +0000 (15:41 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Tue, 19 Aug 2008 20:41:37 +0000 (15:41 -0500)
scripts/add [new file with mode: 0644]
scripts/checkout
tests/t5100-script-push.sh
tests/t5200-script-pull.sh
tests/t5300-script-add.sh [new file with mode: 0644]

diff --git a/scripts/add b/scripts/add
new file mode 100644 (file)
index 0000000..9260eac
--- /dev/null
@@ -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
+
index 5914676..b8c5ee9 100644 (file)
@@ -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)
 
index 752960d..49e1027 100644 (file)
@@ -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 &&
index c782932..7ecbe47 100644 (file)
@@ -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 (file)
index 0000000..82ed134
--- /dev/null
@@ -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
+