summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-06-18 17:18:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-18 17:18:41 (GMT)
commite638899470621738f32ef75dc0a092f6475a4a6e (patch)
tree473aaab90ad34dc216ae843b2b4df254e3aa753c /t
parentd676cc512a7aa17f6c7db53792c1e21c4ddfea42 (diff)
parent3deed5e078f2998573589b1ca03d89f41ea346e9 (diff)
downloadgit-e638899470621738f32ef75dc0a092f6475a4a6e.zip
git-e638899470621738f32ef75dc0a092f6475a4a6e.tar.gz
git-e638899470621738f32ef75dc0a092f6475a4a6e.tar.bz2
Merge branch 'ld/git-p4-updates'
"git p4" updates. * ld/git-p4-updates: git-p4: auto-size the block git-p4: narrow the scope of exceptions caught when parsing an int git-p4: raise exceptions from p4CmdList based on error from p4 server git-p4: better error reporting when p4 fails git-p4: add option to disable syncing of p4/master with p4 git-p4: disable-rebase: allow setting this via configuration git-p4: add options --commit and --disable-rebase
Diffstat (limited to 't')
-rwxr-xr-xt/t9807-git-p4-submit.sh40
-rwxr-xr-xt/t9818-git-p4-block.sh8
-rwxr-xr-xt/t9833-errors.sh78
3 files changed, 126 insertions, 0 deletions
diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh
index 71cae28..2325599 100755
--- a/t/t9807-git-p4-submit.sh
+++ b/t/t9807-git-p4-submit.sh
@@ -155,6 +155,46 @@ test_expect_success 'allow submit from branch with same revision but different n
)
'
+# make two commits, but tell it to apply only one
+
+test_expect_success 'submit --commit one' '
+ test_when_finished cleanup_git &&
+ git p4 clone --dest="$git" //depot &&
+ (
+ cd "$git" &&
+ test_commit "file9" &&
+ test_commit "file10" &&
+ git config git-p4.skipSubmitEdit true &&
+ git p4 submit --commit HEAD
+ ) &&
+ (
+ cd "$cli" &&
+ test_path_is_missing "file9.t" &&
+ test_path_is_file "file10.t"
+ )
+'
+
+# make three commits, but tell it to apply only range
+
+test_expect_success 'submit --commit range' '
+ test_when_finished cleanup_git &&
+ git p4 clone --dest="$git" //depot &&
+ (
+ cd "$git" &&
+ test_commit "file11" &&
+ test_commit "file12" &&
+ test_commit "file13" &&
+ git config git-p4.skipSubmitEdit true &&
+ git p4 submit --commit HEAD~2..HEAD
+ ) &&
+ (
+ cd "$cli" &&
+ test_path_is_missing "file11.t" &&
+ test_path_is_file "file12.t" &&
+ test_path_is_file "file13.t"
+ )
+'
+
#
# Basic submit tests, the five handled cases
#
diff --git a/t/t9818-git-p4-block.sh b/t/t9818-git-p4-block.sh
index 8840a18..ce7cb22 100755
--- a/t/t9818-git-p4-block.sh
+++ b/t/t9818-git-p4-block.sh
@@ -129,6 +129,7 @@ test_expect_success 'Create a repo with multiple depot paths' '
'
test_expect_success 'Clone repo with multiple depot paths' '
+ test_when_finished cleanup_git &&
(
cd "$git" &&
git p4 clone --changes-block-size=4 //depot/pathA@all //depot/pathB@all \
@@ -138,6 +139,13 @@ test_expect_success 'Clone repo with multiple depot paths' '
)
'
+test_expect_success 'Clone repo with self-sizing block size' '
+ test_when_finished cleanup_git &&
+ git p4 clone --changes-block-size=1000000 //depot@all --destination="$git" &&
+ git -C "$git" log --oneline >log &&
+ test_line_count \> 10 log
+'
+
test_expect_success 'kill p4d' '
kill_p4d
'
diff --git a/t/t9833-errors.sh b/t/t9833-errors.sh
new file mode 100755
index 0000000..9ba892d
--- /dev/null
+++ b/t/t9833-errors.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+test_description='git p4 errors'
+
+. ./lib-git-p4.sh
+
+test_expect_success 'start p4d' '
+ start_p4d
+'
+
+test_expect_success 'add p4 files' '
+ (
+ cd "$cli" &&
+ echo file1 >file1 &&
+ p4 add file1 &&
+ p4 submit -d "file1"
+ )
+'
+
+# after this test, the default user requires a password
+test_expect_success 'error handling' '
+ git p4 clone --dest="$git" //depot@all &&
+ (
+ cd "$git" &&
+ P4PORT=: test_must_fail git p4 submit 2>errmsg
+ ) &&
+ p4 passwd -P newpassword &&
+ (
+ P4PASSWD=badpassword test_must_fail git p4 clone //depot/foo 2>errmsg &&
+ grep -q "failure accessing depot.*P4PASSWD" errmsg
+ )
+'
+
+test_expect_success 'ticket logged out' '
+ P4TICKETS="$cli/tickets" &&
+ echo "newpassword" | p4 login &&
+ (
+ cd "$git" &&
+ test_commit "ticket-auth-check" &&
+ p4 logout &&
+ test_must_fail git p4 submit 2>errmsg &&
+ grep -q "failure accessing depot" errmsg
+ )
+'
+
+test_expect_success 'create group with short ticket expiry' '
+ P4TICKETS="$cli/tickets" &&
+ echo "newpassword" | p4 login &&
+ p4_add_user short_expiry_user &&
+ p4 -u short_expiry_user passwd -P password &&
+ p4 group -i <<-EOF &&
+ Group: testgroup
+ Timeout: 3
+ Users: short_expiry_user
+ EOF
+
+ p4 users | grep short_expiry_user
+'
+
+test_expect_success 'git operation with expired ticket' '
+ P4TICKETS="$cli/tickets" &&
+ P4USER=short_expiry_user &&
+ echo "password" | p4 login &&
+ (
+ cd "$git" &&
+ git p4 sync &&
+ sleep 5 &&
+ test_must_fail git p4 sync 2>errmsg &&
+ grep "failure accessing depot" errmsg
+ )
+'
+
+test_expect_success 'kill p4d' '
+ kill_p4d
+'
+
+
+test_done