|
|
|
Stephen Boyd
|
Many parts of the tests in t1200 are run outside the test harness,
circumventing the usefulness of -v and spewing messages to stdout when -v isn't used. Fix these problems by modernizing the test a bit. An extra test_done has existed since commit 6a74642 (git-commit --amend: two fixes., 2006-04-20) leading to the last 6 tests never being run. Remove it and teach the resolve merge test about fast-forward merges. Finally, we remove the TODO notes, because fetch, push, and clone have their own tests since t1200 was introduced and we're not going to add them here 4 years later. Signed-off-by: Stephen Boyd <[hidden email]> --- I saw some output when running this test and thought it could be modernized a bit. t/t1200-tutorial.sh | 131 +++++++++++++++++++++++++++++---------------------- 1 files changed, 74 insertions(+), 57 deletions(-) diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh index 67e637b..16c5b6d 100755 --- a/t/t1200-tutorial.sh +++ b/t/t1200-tutorial.sh @@ -7,14 +7,18 @@ test_description='A simple turial in the form of a test case' . ./test-lib.sh -echo "Hello World" > hello -echo "Silly example" > example +test_expect_success 'blob' ' + echo "Hello World" > hello && + echo "Silly example" > example && -git update-index --add hello example + git update-index --add hello example && -test_expect_success 'blob' "test blob = \"$(git cat-file -t 557db03)\"" + test blob = "$(git cat-file -t 557db03)" +' -test_expect_success 'blob 557db03' "test \"Hello World\" = \"$(git cat-file blob 557db03)\"" +test_expect_success 'blob 557db03' ' + test "Hello World" = "$(git cat-file blob 557db03)" +' echo "It's a new day for git" >>hello cat > diff.expect << EOF @@ -26,25 +30,33 @@ index 557db03..263414f 100644 Hello World +It's a new day for git EOF -git diff-files -p > diff.output -test_expect_success 'git diff-files -p' 'cmp diff.expect diff.output' -git diff > diff.output -test_expect_success 'git diff' 'cmp diff.expect diff.output' - -tree=$(git write-tree 2>/dev/null) -test_expect_success 'tree' "test 8988da15d077d4829fc51d8544c097def6644dbb = $tree" +test_expect_success 'git diff-files -p' ' + git diff-files -p > diff.output && + cmp diff.expect diff.output +' -output="$(echo "Initial commit" | git commit-tree $(git write-tree) 2>&1 > .git/refs/heads/master)" +test_expect_success 'git diff' ' + git diff > diff.output && + cmp diff.expect diff.output +' -git diff-index -p HEAD > diff.output -test_expect_success 'git diff-index -p HEAD' 'cmp diff.expect diff.output' +test_expect_success 'tree' ' + tree=$(git write-tree 2>/dev/null) + test 8988da15d077d4829fc51d8544c097def6644dbb = $tree +' -git diff HEAD > diff.output -test_expect_success 'git diff HEAD' 'cmp diff.expect diff.output' +test_expect_success 'git diff-index -p HEAD' ' + echo "Initial commit" | \ + git commit-tree $(git write-tree) 2>&1 > .git/refs/heads/master && + git diff-index -p HEAD > diff.output && + cmp diff.expect diff.output +' -#rm hello -#test_expect_success 'git read-tree --reset HEAD' "git read-tree --reset HEAD ; test \"hello: needs update\" = \"$(git update-index --refresh)\"" +test_expect_success 'git diff HEAD' ' + git diff HEAD > diff.output && + cmp diff.expect diff.output +' cat > whatchanged.expect << EOF commit VARIABLE @@ -69,39 +81,45 @@ index 0000000..557db03 +Hello World EOF -git whatchanged -p --root | \ - sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \ +test_expect_success 'git whatchanged -p --root' ' + git whatchanged -p --root | \ + sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \ -e "2,3s/^\(.\{8\}\).*$/\1VARIABLE/" \ -> whatchanged.output -test_expect_success 'git whatchanged -p --root' 'cmp whatchanged.expect whatchanged.output' - -git tag my-first-tag -test_expect_success 'git tag my-first-tag' 'cmp .git/refs/heads/master .git/refs/tags/my-first-tag' + > whatchanged.output && + cmp whatchanged.expect whatchanged.output +' -# TODO: test git clone +test_expect_success 'git tag my-first-tag' ' + git tag my-first-tag && + cmp .git/refs/heads/master .git/refs/tags/my-first-tag +' -git checkout -b mybranch -test_expect_success 'git checkout -b mybranch' 'cmp .git/refs/heads/master .git/refs/heads/mybranch' +test_expect_success 'git checkout -b mybranch' ' + git checkout -b mybranch && + cmp .git/refs/heads/master .git/refs/heads/mybranch +' cat > branch.expect <<EOF master * mybranch EOF -git branch > branch.output -test_expect_success 'git branch' 'cmp branch.expect branch.output' +test_expect_success 'git branch' ' + git branch > branch.output && + cmp branch.expect branch.output +' -git checkout mybranch -echo "Work, work, work" >>hello -git commit -m 'Some work.' -i hello +test_expect_success 'git resolve now fails' ' + git checkout mybranch && + echo "Work, work, work" >>hello && + git commit -m "Some work." -i hello && -git checkout master + git checkout master && -echo "Play, play, play" >>hello -echo "Lots of fun" >>example -git commit -m 'Some fun.' -i hello example + echo "Play, play, play" >>hello && + echo "Lots of fun" >>example && + git commit -m "Some fun." -i hello example && -test_expect_success 'git resolve now fails' ' test_must_fail git merge -m "Merge work in mybranch" mybranch ' @@ -112,10 +130,6 @@ Play, play, play Work, work, work EOF -git commit -m 'Merged "mybranch" changes.' -i hello - -test_done - cat > show-branch.expect << EOF * [master] Merged "mybranch" changes. ! [mybranch] Some work. @@ -124,21 +138,26 @@ cat > show-branch.expect << EOF *+ [mybranch] Some work. EOF -git show-branch --topo-order master mybranch > show-branch.output -test_expect_success 'git show-branch' 'cmp show-branch.expect show-branch.output' - -git checkout mybranch +test_expect_success 'git show-branch' ' + git commit -m "Merged \"mybranch\" changes." -i hello && + git show-branch --topo-order master mybranch > show-branch.output && + cmp show-branch.expect show-branch.output +' cat > resolve.expect << EOF -Updating from VARIABLE to VARIABLE +Updating VARIABLE..VARIABLE +Fast forward example | 1 + hello | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) EOF -git merge -s "Merge upstream changes." master | \ - sed -e "1s/[0-9a-f]\{40\}/VARIABLE/g" >resolve.output -test_expect_success 'git resolve' 'cmp resolve.expect resolve.output' +test_expect_success 'git resolve' ' + git checkout mybranch && + git merge -s resolve master | \ + sed -e "1s/[0-9a-f]\{7\}/VARIABLE/g" >resolve.output && + cmp resolve.expect resolve.output +' cat > show-branch2.expect << EOF ! [master] Merged "mybranch" changes. @@ -147,12 +166,10 @@ cat > show-branch2.expect << EOF -- [master] Merged "mybranch" changes. EOF -git show-branch --topo-order master mybranch > show-branch2.output -test_expect_success 'git show-branch' 'cmp show-branch2.expect show-branch2.output' - -# TODO: test git fetch - -# TODO: test git push +test_expect_success 'git show-branch' ' + git show-branch --topo-order master mybranch > show-branch2.output && + cmp show-branch2.expect show-branch2.output +' test_expect_success 'git repack' 'git repack' test_expect_success 'git prune-packed' 'git prune-packed' -- 1.6.5.2.181.gd6f41 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [hidden email] More majordomo info at http://vger.kernel.org/majordomo-info.html |
||||||||||||||||
|
Junio C Hamano
|
Stephen Boyd <[hidden email]> writes:
> Many parts of the tests in t1200 are run outside the test harness, > circumventing the usefulness of -v and spewing messages to stdout when > -v isn't used. Fix these problems by modernizing the test a bit. > > An extra test_done has existed since commit 6a74642 (git-commit --amend: > two fixes., 2006-04-20) leading to the last 6 tests never being run. > Remove it and teach the resolve merge test about fast-forward merges. > > Finally, we remove the TODO notes, because fetch, push, and clone have > their own tests since t1200 was introduced and we're not going to add > them here 4 years later. > > Signed-off-by: Stephen Boyd <[hidden email]> > --- > > I saw some output when running this test and thought it could be modernized a > bit. Thanks. The sequence of commands are suppopsed to match what the user manual teaches, and I suspect we have had quite a many updates to the manual since this test script was last touched. Do you happen to know if they still match the manual? > t/t1200-tutorial.sh | 131 +++++++++++++++++++++++++++++---------------------- > 1 files changed, 74 insertions(+), 57 deletions(-) > > diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh > index 67e637b..16c5b6d 100755 > --- a/t/t1200-tutorial.sh > +++ b/t/t1200-tutorial.sh > @@ -7,14 +7,18 @@ test_description='A simple turial in the form of a test case' > > . ./test-lib.sh > > -echo "Hello World" > hello > -echo "Silly example" > example > +test_expect_success 'blob' ' > + echo "Hello World" > hello && > + echo "Silly example" > example && > > -git update-index --add hello example > + git update-index --add hello example && > > -test_expect_success 'blob' "test blob = \"$(git cat-file -t 557db03)\"" > + test blob = "$(git cat-file -t 557db03)" > +' > > -test_expect_success 'blob 557db03' "test \"Hello World\" = \"$(git cat-file blob 557db03)\"" > +test_expect_success 'blob 557db03' ' > + test "Hello World" = "$(git cat-file blob 557db03)" > +' > > echo "It's a new day for git" >>hello > cat > diff.expect << EOF > @@ -26,25 +30,33 @@ index 557db03..263414f 100644 > Hello World > +It's a new day for git > EOF > -git diff-files -p > diff.output > -test_expect_success 'git diff-files -p' 'cmp diff.expect diff.output' > -git diff > diff.output > -test_expect_success 'git diff' 'cmp diff.expect diff.output' > - > -tree=$(git write-tree 2>/dev/null) > > -test_expect_success 'tree' "test 8988da15d077d4829fc51d8544c097def6644dbb = $tree" > +test_expect_success 'git diff-files -p' ' > + git diff-files -p > diff.output && > + cmp diff.expect diff.output > +' > > -output="$(echo "Initial commit" | git commit-tree $(git write-tree) 2>&1 > .git/refs/heads/master)" > +test_expect_success 'git diff' ' > + git diff > diff.output && > + cmp diff.expect diff.output > +' > > -git diff-index -p HEAD > diff.output > -test_expect_success 'git diff-index -p HEAD' 'cmp diff.expect diff.output' > +test_expect_success 'tree' ' > + tree=$(git write-tree 2>/dev/null) > + test 8988da15d077d4829fc51d8544c097def6644dbb = $tree > +' > > -git diff HEAD > diff.output > -test_expect_success 'git diff HEAD' 'cmp diff.expect diff.output' > +test_expect_success 'git diff-index -p HEAD' ' > + echo "Initial commit" | \ > + git commit-tree $(git write-tree) 2>&1 > .git/refs/heads/master && > + git diff-index -p HEAD > diff.output && > + cmp diff.expect diff.output > +' > > -#rm hello > -#test_expect_success 'git read-tree --reset HEAD' "git read-tree --reset HEAD ; test \"hello: needs update\" = \"$(git update-index --refresh)\"" > +test_expect_success 'git diff HEAD' ' > + git diff HEAD > diff.output && > + cmp diff.expect diff.output > +' > > cat > whatchanged.expect << EOF > commit VARIABLE > @@ -69,39 +81,45 @@ index 0000000..557db03 > +Hello World > EOF > > -git whatchanged -p --root | \ > - sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \ > +test_expect_success 'git whatchanged -p --root' ' > + git whatchanged -p --root | \ > + sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \ > -e "2,3s/^\(.\{8\}\).*$/\1VARIABLE/" \ > -> whatchanged.output > -test_expect_success 'git whatchanged -p --root' 'cmp whatchanged.expect whatchanged.output' > - > -git tag my-first-tag > -test_expect_success 'git tag my-first-tag' 'cmp .git/refs/heads/master .git/refs/tags/my-first-tag' > + > whatchanged.output && > + cmp whatchanged.expect whatchanged.output > +' > > -# TODO: test git clone > +test_expect_success 'git tag my-first-tag' ' > + git tag my-first-tag && > + cmp .git/refs/heads/master .git/refs/tags/my-first-tag > +' > > -git checkout -b mybranch > -test_expect_success 'git checkout -b mybranch' 'cmp .git/refs/heads/master .git/refs/heads/mybranch' > +test_expect_success 'git checkout -b mybranch' ' > + git checkout -b mybranch && > + cmp .git/refs/heads/master .git/refs/heads/mybranch > +' > > cat > branch.expect <<EOF > master > * mybranch > EOF > > -git branch > branch.output > -test_expect_success 'git branch' 'cmp branch.expect branch.output' > +test_expect_success 'git branch' ' > + git branch > branch.output && > + cmp branch.expect branch.output > +' > > -git checkout mybranch > -echo "Work, work, work" >>hello > -git commit -m 'Some work.' -i hello > +test_expect_success 'git resolve now fails' ' > + git checkout mybranch && > + echo "Work, work, work" >>hello && > + git commit -m "Some work." -i hello && > > -git checkout master > + git checkout master && > > -echo "Play, play, play" >>hello > -echo "Lots of fun" >>example > -git commit -m 'Some fun.' -i hello example > + echo "Play, play, play" >>hello && > + echo "Lots of fun" >>example && > + git commit -m "Some fun." -i hello example && > > -test_expect_success 'git resolve now fails' ' > test_must_fail git merge -m "Merge work in mybranch" mybranch > ' > > @@ -112,10 +130,6 @@ Play, play, play > Work, work, work > EOF > > -git commit -m 'Merged "mybranch" changes.' -i hello > - > -test_done > - > cat > show-branch.expect << EOF > * [master] Merged "mybranch" changes. > ! [mybranch] Some work. > @@ -124,21 +138,26 @@ cat > show-branch.expect << EOF > *+ [mybranch] Some work. > EOF > > -git show-branch --topo-order master mybranch > show-branch.output > -test_expect_success 'git show-branch' 'cmp show-branch.expect show-branch.output' > - > -git checkout mybranch > +test_expect_success 'git show-branch' ' > + git commit -m "Merged \"mybranch\" changes." -i hello && > + git show-branch --topo-order master mybranch > show-branch.output && > + cmp show-branch.expect show-branch.output > +' > > cat > resolve.expect << EOF > -Updating from VARIABLE to VARIABLE > +Updating VARIABLE..VARIABLE > +Fast forward > example | 1 + > hello | 1 + > 2 files changed, 2 insertions(+), 0 deletions(-) > EOF > > -git merge -s "Merge upstream changes." master | \ > - sed -e "1s/[0-9a-f]\{40\}/VARIABLE/g" >resolve.output > -test_expect_success 'git resolve' 'cmp resolve.expect resolve.output' > +test_expect_success 'git resolve' ' > + git checkout mybranch && > + git merge -s resolve master | \ > + sed -e "1s/[0-9a-f]\{7\}/VARIABLE/g" >resolve.output && > + cmp resolve.expect resolve.output > +' > > cat > show-branch2.expect << EOF > ! [master] Merged "mybranch" changes. > @@ -147,12 +166,10 @@ cat > show-branch2.expect << EOF > -- [master] Merged "mybranch" changes. > EOF > > -git show-branch --topo-order master mybranch > show-branch2.output > -test_expect_success 'git show-branch' 'cmp show-branch2.expect show-branch2.output' > - > -# TODO: test git fetch > - > -# TODO: test git push > +test_expect_success 'git show-branch' ' > + git show-branch --topo-order master mybranch > show-branch2.output && > + cmp show-branch2.expect show-branch2.output > +' > > test_expect_success 'git repack' 'git repack' > test_expect_success 'git prune-packed' 'git prune-packed' > -- > 1.6.5.2.181.gd6f41 To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [hidden email] More majordomo info at http://vger.kernel.org/majordomo-info.html |
||||||||||||||||
|
Stephen Boyd
|
Junio C Hamano wrote:
> Thanks. > > The sequence of commands are suppopsed to match what the user manual > teaches, and I suspect we have had quite a many updates to the manual > since this test script was last touched. Do you happen to know if they > still match the manual? I just read through it and it's different. I'm ignoring the cloning, fetching, pushing, and gitk parts too. There is a whole section on merging which isn't really covered. I'll resend sometime soon (the last test is broken too, sorry). -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [hidden email] More majordomo info at http://vger.kernel.org/majordomo-info.html |
||||||||||||||||
|
Stephen Boyd
|
In reply to this post
by Stephen Boyd
Many parts of the tests in t1200 are run outside the test harness,
circumventing the usefulness of -v and spewing messages to stdout when -v isn't used. Fix these problems by modernizing the test a bit. An extra test_done has existed since commit 6a74642 (git-commit --amend: two fixes., 2006-04-20) leading to the last 6 tests never being run. Remove it and teach the resolve merge test about fast-forward merges. Also fix the last test's incorrect find command and prune before checking for unpacked objects so we remove the unreachable conflict-marked blob. Finally, we remove the TODO notes, because fetch, push, and clone have their own tests since t1200 was introduced and we're not going to add them here 4 years later. Signed-off-by: Stephen Boyd <[hidden email]> --- Since v1: * Fixed the last test t/t1200-tutorial.sh | 134 +++++++++++++++++++++++++++++---------------------- 1 files changed, 76 insertions(+), 58 deletions(-) diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh index 67e637b..c57c9d5 100755 --- a/t/t1200-tutorial.sh +++ b/t/t1200-tutorial.sh @@ -7,14 +7,18 @@ test_description='A simple turial in the form of a test case' . ./test-lib.sh -echo "Hello World" > hello -echo "Silly example" > example +test_expect_success 'blob' ' + echo "Hello World" > hello && + echo "Silly example" > example && -git update-index --add hello example + git update-index --add hello example && -test_expect_success 'blob' "test blob = \"$(git cat-file -t 557db03)\"" + test blob = "$(git cat-file -t 557db03)" +' -test_expect_success 'blob 557db03' "test \"Hello World\" = \"$(git cat-file blob 557db03)\"" +test_expect_success 'blob 557db03' ' + test "Hello World" = "$(git cat-file blob 557db03)" +' echo "It's a new day for git" >>hello cat > diff.expect << EOF @@ -26,25 +30,33 @@ index 557db03..263414f 100644 Hello World +It's a new day for git EOF -git diff-files -p > diff.output -test_expect_success 'git diff-files -p' 'cmp diff.expect diff.output' -git diff > diff.output -test_expect_success 'git diff' 'cmp diff.expect diff.output' - -tree=$(git write-tree 2>/dev/null) -test_expect_success 'tree' "test 8988da15d077d4829fc51d8544c097def6644dbb = $tree" +test_expect_success 'git diff-files -p' ' + git diff-files -p > diff.output && + cmp diff.expect diff.output +' -output="$(echo "Initial commit" | git commit-tree $(git write-tree) 2>&1 > .git/refs/heads/master)" +test_expect_success 'git diff' ' + git diff > diff.output && + cmp diff.expect diff.output +' -git diff-index -p HEAD > diff.output -test_expect_success 'git diff-index -p HEAD' 'cmp diff.expect diff.output' +test_expect_success 'tree' ' + tree=$(git write-tree 2>/dev/null) + test 8988da15d077d4829fc51d8544c097def6644dbb = $tree +' -git diff HEAD > diff.output -test_expect_success 'git diff HEAD' 'cmp diff.expect diff.output' +test_expect_success 'git diff-index -p HEAD' ' + echo "Initial commit" | \ + git commit-tree $(git write-tree) 2>&1 > .git/refs/heads/master && + git diff-index -p HEAD > diff.output && + cmp diff.expect diff.output +' -#rm hello -#test_expect_success 'git read-tree --reset HEAD' "git read-tree --reset HEAD ; test \"hello: needs update\" = \"$(git update-index --refresh)\"" +test_expect_success 'git diff HEAD' ' + git diff HEAD > diff.output && + cmp diff.expect diff.output +' cat > whatchanged.expect << EOF commit VARIABLE @@ -69,39 +81,45 @@ index 0000000..557db03 +Hello World EOF -git whatchanged -p --root | \ - sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \ +test_expect_success 'git whatchanged -p --root' ' + git whatchanged -p --root | \ + sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \ -e "2,3s/^\(.\{8\}\).*$/\1VARIABLE/" \ -> whatchanged.output -test_expect_success 'git whatchanged -p --root' 'cmp whatchanged.expect whatchanged.output' - -git tag my-first-tag -test_expect_success 'git tag my-first-tag' 'cmp .git/refs/heads/master .git/refs/tags/my-first-tag' + > whatchanged.output && + cmp whatchanged.expect whatchanged.output +' -# TODO: test git clone +test_expect_success 'git tag my-first-tag' ' + git tag my-first-tag && + cmp .git/refs/heads/master .git/refs/tags/my-first-tag +' -git checkout -b mybranch -test_expect_success 'git checkout -b mybranch' 'cmp .git/refs/heads/master .git/refs/heads/mybranch' +test_expect_success 'git checkout -b mybranch' ' + git checkout -b mybranch && + cmp .git/refs/heads/master .git/refs/heads/mybranch +' cat > branch.expect <<EOF master * mybranch EOF -git branch > branch.output -test_expect_success 'git branch' 'cmp branch.expect branch.output' +test_expect_success 'git branch' ' + git branch > branch.output && + cmp branch.expect branch.output +' -git checkout mybranch -echo "Work, work, work" >>hello -git commit -m 'Some work.' -i hello +test_expect_success 'git resolve now fails' ' + git checkout mybranch && + echo "Work, work, work" >>hello && + git commit -m "Some work." -i hello && -git checkout master + git checkout master && -echo "Play, play, play" >>hello -echo "Lots of fun" >>example -git commit -m 'Some fun.' -i hello example + echo "Play, play, play" >>hello && + echo "Lots of fun" >>example && + git commit -m "Some fun." -i hello example && -test_expect_success 'git resolve now fails' ' test_must_fail git merge -m "Merge work in mybranch" mybranch ' @@ -112,10 +130,6 @@ Play, play, play Work, work, work EOF -git commit -m 'Merged "mybranch" changes.' -i hello - -test_done - cat > show-branch.expect << EOF * [master] Merged "mybranch" changes. ! [mybranch] Some work. @@ -124,21 +138,26 @@ cat > show-branch.expect << EOF *+ [mybranch] Some work. EOF -git show-branch --topo-order master mybranch > show-branch.output -test_expect_success 'git show-branch' 'cmp show-branch.expect show-branch.output' - -git checkout mybranch +test_expect_success 'git show-branch' ' + git commit -m "Merged \"mybranch\" changes." -i hello && + git show-branch --topo-order master mybranch > show-branch.output && + cmp show-branch.expect show-branch.output +' cat > resolve.expect << EOF -Updating from VARIABLE to VARIABLE +Updating VARIABLE..VARIABLE +Fast forward (no commit created; -m option ignored) example | 1 + hello | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) EOF -git merge -s "Merge upstream changes." master | \ - sed -e "1s/[0-9a-f]\{40\}/VARIABLE/g" >resolve.output -test_expect_success 'git resolve' 'cmp resolve.expect resolve.output' +test_expect_success 'git resolve' ' + git checkout mybranch && + git merge -m "Merge upstream changes." master | \ + sed -e "1s/[0-9a-f]\{7\}/VARIABLE/g" >resolve.output && + cmp resolve.expect resolve.output +' cat > show-branch2.expect << EOF ! [master] Merged "mybranch" changes. @@ -147,17 +166,16 @@ cat > show-branch2.expect << EOF -- [master] Merged "mybranch" changes. EOF -git show-branch --topo-order master mybranch > show-branch2.output -test_expect_success 'git show-branch' 'cmp show-branch2.expect show-branch2.output' - -# TODO: test git fetch - -# TODO: test git push +test_expect_success 'git show-branch (part 2)' ' + git show-branch --topo-order master mybranch > show-branch2.output && + cmp show-branch2.expect show-branch2.output +' test_expect_success 'git repack' 'git repack' test_expect_success 'git prune-packed' 'git prune-packed' test_expect_success '-> only packed objects' ' - ! find -type f .git/objects/[0-9a-f][0-9a-f] + git prune && # Remove conflict marked blobs + ! find .git/objects/[0-9a-f][0-9a-f] -type f ' test_done -- 1.6.5.2.143.g8cc62 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [hidden email] More majordomo info at http://vger.kernel.org/majordomo-info.html |
||||||||||||||||
|
Stephen Boyd
|
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 <[hidden email]> --- This is all new since v1 Documentation/gitcore-tutorial.txt | 20 ++++---- t/t1200-tutorial.sh | 97 ++++++++++++++++++++++++++++++++--- 2 files changed, 98 insertions(+), 19 deletions(-) diff --git a/Documentation/gitcore-tutorial.txt b/Documentation/gitcore-tutorial.txt index b3640c4..7bdf090 100644 --- a/Documentation/gitcore-tutorial.txt +++ b/Documentation/gitcore-tutorial.txt @@ -185,7 +185,7 @@ object is. git will tell you that you have a "blob" object (i.e., just a regular file), and you can see the contents with ---------------- -$ git cat-file "blob" 557db03 +$ git cat-file blob 557db03 ---------------- which will print out "Hello World". The object `557db03` is nothing @@ -1188,7 +1188,7 @@ $ git show-branch -- + [mybranch] Some work. * [master] Some fun. -*+ [mybranch^] New day. +*+ [mybranch^] Initial commit ------------ Now we are ready to experiment with the merge by hand. @@ -1204,11 +1204,11 @@ $ mb=$(git merge-base HEAD mybranch) The command writes the commit object name of the common ancestor to the standard output, so we captured its output to a variable, because we will be using it in the next step. By the way, the common -ancestor commit is the "New day." commit in this case. You can +ancestor commit is the "Initial commit" commit in this case. You can tell it by: ------------ -$ git name-rev $mb +$ git name-rev --name-only --tags $mb my-first-tag ------------ @@ -1237,8 +1237,8 @@ inspect the index file with this command: ------------ $ git ls-files --stage 100644 7f8b141b65fdcee47321e399a2598a235a032422 0 example -100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello -100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello +100644 557db03de997c86a4a028e1ebd3a1ceb225be238 1 hello +100644 ba42a2a96e3027f3333e13ede4ccf4498c3ae942 2 hello 100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello ------------ @@ -1253,8 +1253,8 @@ To look at only non-zero stages, use `\--unmerged` flag: ------------ $ git ls-files --unmerged -100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello -100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello +100644 557db03de997c86a4a028e1ebd3a1ceb225be238 1 hello +100644 ba42a2a96e3027f3333e13ede4ccf4498c3ae942 2 hello 100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello ------------ @@ -1283,8 +1283,8 @@ the working tree.. This can be seen if you run `ls-files ------------ $ git ls-files --stage 100644 7f8b141b65fdcee47321e399a2598a235a032422 0 example -100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello -100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello +100644 557db03de997c86a4a028e1ebd3a1ceb225be238 1 hello +100644 ba42a2a96e3027f3333e13ede4ccf4498c3ae942 2 hello 100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello ------------ diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh index c57c9d5..299e724 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' ' -- 1.6.5.2.143.g8cc62 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [hidden email] More majordomo info at http://vger.kernel.org/majordomo-info.html |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |