@matheusbsbs / matheus-bagliano / commits / 27c6000b28
Fork 0

git-p4: test sync new branch

Add two new unit tests. One to test the feature that that was added in e32e00d, and another to test the regression that was fixed in the parent to this commit. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pete Wyckoff committed Mar 16, 2011 at 16:53 UTC 27c6000b28c89cad7af23df90d52bf33e205f61f
1 file changed +23
t/t9800-git-p4.sh
+23
@@ -61,6 +61,29 @@ test_expect_success 'git-p4 clone @all' '
61 rm -rf "$git" && mkdir "$git"
62 '
63
64 +test_expect_success 'git-p4 sync uninitialized repo' '
65 + test_create_repo "$git" &&
66 + cd "$git" &&
67 + test_must_fail "$GITP4" sync &&
68 + rm -rf "$git" && mkdir "$git"
69 +'
70 +
71 +#
72 +# Create a git repo by hand. Add a commit so that HEAD is valid.
73 +# Test imports a new p4 repository into a new git branch.
74 +#
75 +test_expect_success 'git-p4 sync new branch' '
76 + test_create_repo "$git" &&
77 + cd "$git" &&
78 + test_commit head &&
79 + "$GITP4" sync --branch=refs/remotes/p4/depot //depot@all &&
80 + git log --oneline p4/depot >lines &&
81 + cat lines &&
82 + test_line_count = 2 lines &&
83 + cd .. &&
84 + rm -rf "$git" && mkdir "$git"
85 +'
86 +
87 test_expect_success 'exit when p4 fails to produce marshaled output' '
88 badp4dir="$TRASH_DIRECTORY/badp4dir" &&
89 mkdir -p "$badp4dir" &&