aboutsummaryrefslogtreecommitdiff
path: root/t/t1200-tutorial.sh
diff options
context:
space:
mode:
authorStephen Boyd <bebarino@gmail.com>2009-11-04 22:33:53 -0800
committerJunio C Hamano <gitster@pobox.com>2009-11-06 22:44:34 -0800
commit7c5858a643724a9a4a67f1290c03d57f483ed261 (patch)
tree53026d647397b218c3c575c5b373941f5bbd54c7 /t/t1200-tutorial.sh
parent1a994dc3d258a1603752e0c472b072acc343a963 (diff)
downloadgit-7c5858a643724a9a4a67f1290c03d57f483ed261.tar.gz
git-7c5858a643724a9a4a67f1290c03d57f483ed261.tar.xz
t1200: Make documentation and test agree
There were some differences between t1200 and the gitcore-tutorial. Add missing tests for manually merging two branches, and use the same commands in both files. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1200-tutorial.sh')
-rwxr-xr-xt/t1200-tutorial.sh97
1 files changed, 88 insertions, 9 deletions
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
index c57c9d530..299e72417 100755
--- a/t/t1200-tutorial.sh
+++ b/t/t1200-tutorial.sh
@@ -47,8 +47,9 @@ test_expect_success 'tree' '
'
test_expect_success 'git diff-index -p HEAD' '
- echo "Initial commit" | \
- git commit-tree $(git write-tree) 2>&1 > .git/refs/heads/master &&
+ tree=$(git write-tree)
+ commit=$(echo "Initial commit" | git commit-tree $tree) &&
+ git update-ref HEAD $commit &&
git diff-index -p HEAD > diff.output &&
cmp diff.expect diff.output
'
@@ -131,16 +132,18 @@ Work, work, work
EOF
cat > show-branch.expect << EOF
-* [master] Merged "mybranch" changes.
+* [master] Merge work in mybranch
! [mybranch] Some work.
--
-- [master] Merged "mybranch" changes.
+- [master] Merge work in mybranch
*+ [mybranch] Some work.
+* [master^] Some fun.
EOF
test_expect_success 'git show-branch' '
- git commit -m "Merged \"mybranch\" changes." -i hello &&
- git show-branch --topo-order master mybranch > show-branch.output &&
+ git commit -m "Merge work in mybranch" -i hello &&
+ git show-branch --topo-order --more=1 master mybranch \
+ > show-branch.output &&
cmp show-branch.expect show-branch.output
'
@@ -160,10 +163,10 @@ test_expect_success 'git resolve' '
'
cat > show-branch2.expect << EOF
-! [master] Merged "mybranch" changes.
- * [mybranch] Merged "mybranch" changes.
+! [master] Merge work in mybranch
+ * [mybranch] Merge work in mybranch
--
--- [master] Merged "mybranch" changes.
+-- [master] Merge work in mybranch
EOF
test_expect_success 'git show-branch (part 2)' '
@@ -171,6 +174,82 @@ test_expect_success 'git show-branch (part 2)' '
cmp show-branch2.expect show-branch2.output
'
+cat > show-branch3.expect << EOF
+! [master] Merge work in mybranch
+ * [mybranch] Merge work in mybranch
+--
+-- [master] Merge work in mybranch
++* [master^2] Some work.
++* [master^] Some fun.
+EOF
+
+test_expect_success 'git show-branch (part 3)' '
+ git show-branch --topo-order --more=2 master mybranch \
+ > show-branch3.output &&
+ cmp show-branch3.expect show-branch3.output
+'
+
+test_expect_success 'rewind to "Some fun." and "Some work."' '
+ git checkout mybranch &&
+ git reset --hard master^2 &&
+ git checkout master &&
+ git reset --hard master^
+'
+
+cat > show-branch4.expect << EOF
+* [master] Some fun.
+ ! [mybranch] Some work.
+--
+ + [mybranch] Some work.
+* [master] Some fun.
+*+ [mybranch^] Initial commit
+EOF
+
+test_expect_success 'git show-branch (part 4)' '
+ git show-branch --topo-order > show-branch4.output &&
+ cmp show-branch4.expect show-branch4.output
+'
+
+test_expect_success 'manual merge' '
+ mb=$(git merge-base HEAD mybranch) &&
+ git name-rev --name-only --tags $mb > name-rev.output &&
+ test "my-first-tag" = $(cat name-rev.output) &&
+
+ git read-tree -m -u $mb HEAD mybranch
+'
+
+cat > ls-files.expect << EOF
+100644 7f8b141b65fdcee47321e399a2598a235a032422 0 example
+100644 557db03de997c86a4a028e1ebd3a1ceb225be238 1 hello
+100644 ba42a2a96e3027f3333e13ede4ccf4498c3ae942 2 hello
+100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello
+EOF
+
+test_expect_success 'git ls-files --stage' '
+ git ls-files --stage > ls-files.output &&
+ cmp ls-files.expect ls-files.output
+'
+
+cat > ls-files-unmerged.expect << EOF
+100644 557db03de997c86a4a028e1ebd3a1ceb225be238 1 hello
+100644 ba42a2a96e3027f3333e13ede4ccf4498c3ae942 2 hello
+100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello
+EOF
+
+test_expect_success 'git ls-files --unmerged' '
+ git ls-files --unmerged > ls-files-unmerged.output &&
+ cmp ls-files-unmerged.expect ls-files-unmerged.output
+'
+
+test_expect_success 'git-merge-index' '
+ test_must_fail git merge-index git-merge-one-file hello
+'
+
+test_expect_success 'git ls-files --stage (part 2)' '
+ git ls-files --stage > ls-files.output2 &&
+ cmp ls-files.expect ls-files.output2
+'
+
test_expect_success 'git repack' 'git repack'
test_expect_success 'git prune-packed' 'git prune-packed'
test_expect_success '-> only packed objects' '