summaryrefslogtreecommitdiff
path: root/t/t9800-git-p4-basic.sh
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2012-11-23 17:35:36 -0500
committerJunio C Hamano <gitster@pobox.com>2012-11-26 11:00:34 -0800
commit78189bead3f5fde22ae651d66208a0e0a375a819 (patch)
tree127cfe1cb8c2997710be0676446773c2c33c1325 /t/t9800-git-p4-basic.sh
parent249da4c0dcd0534f416e2d5da0a9923c6068e492 (diff)
downloadgit-78189bead3f5fde22ae651d66208a0e0a375a819.tar.gz
git p4: catch p4 errors when streaming file contents
Error messages that arise during the "p4 print" phase of generating commits were silently ignored. Catch them, abort the fast-import, and exit. Without this fix, the sync/clone appears to work, but files that are inaccessible by the p4d server will still be imported to git, although without the proper contents. Instead the errant files will contain a p4 error message, such as "Librarian checkout //depot/path failed". Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9800-git-p4-basic.sh')
-rwxr-xr-xt/t9800-git-p4-basic.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/t/t9800-git-p4-basic.sh b/t/t9800-git-p4-basic.sh
index b7ad716b09..05797c31d1 100755
--- a/t/t9800-git-p4-basic.sh
+++ b/t/t9800-git-p4-basic.sh
@@ -143,7 +143,18 @@ test_expect_success 'exit when p4 fails to produce marshaled output' '
! test_i18ngrep Traceback errs
'
-test_expect_success 'clone bare' '
+# Hide a file from p4d, make sure we catch its complaint. This won't fail in
+# p4 changes, files, or describe; just in p4 print. If P4CLIENT is unset, the
+# message will include "Librarian checkout".
+test_expect_success 'exit gracefully for p4 server errors' '
+ test_when_finished "mv \"$db\"/depot/file1,v,hidden \"$db\"/depot/file1,v" &&
+ mv "$db"/depot/file1,v "$db"/depot/file1,v,hidden &&
+ test_when_finished cleanup_git &&
+ test_expect_code 1 git p4 clone --dest="$git" //depot@1 >out 2>err &&
+ test_i18ngrep "Error from p4 print" err
+'
+
+test_expect_success 'clone --bare should make a bare repository' '
rm -rf "$git" &&
git p4 clone --dest="$git" --bare //depot &&
test_when_finished cleanup_git &&