diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-05-21 01:26:55 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-05-21 01:26:55 +0300 |
commit | af3a3205d14561e1683ca86b894888f9f1fc0176 (patch) | |
tree | 5cf53769536a482db62a7a015eccadecd87a37d3 /t | |
parent | 804ec0301fddb68d5170939084d79e2c0c672028 (diff) | |
parent | 17f273ffbad8724278e0fa4da592a7ec7c6abc83 (diff) |
Merge branch 'tk/p4-with-explicity-sync'
"git p4" update.
* tk/p4-with-explicity-sync:
git-p4: support explicit sync of arbitrary existing git-p4 refs
Diffstat (limited to 't')
-rwxr-xr-x | t/t9800-git-p4-basic.sh | 85 | ||||
-rwxr-xr-x | t/t9801-git-p4-branch.sh | 10 |
2 files changed, 95 insertions, 0 deletions
diff --git a/t/t9800-git-p4-basic.sh b/t/t9800-git-p4-basic.sh index 8b30062c0c..dc88d0e064 100755 --- a/t/t9800-git-p4-basic.sh +++ b/t/t9800-git-p4-basic.sh @@ -74,6 +74,91 @@ test_expect_success 'git p4 sync new branch' ' ) ' +# +# Setup as before, and then explicitly sync imported branch, using a +# different ref format. +# +test_expect_success 'git p4 sync existing branch without changes' ' + test_create_repo "$git" && + test_when_finished cleanup_git && + ( + cd "$git" && + test_commit head && + git p4 sync --branch=depot //depot@all && + git p4 sync --branch=refs/remotes/p4/depot >out && + test_i18ngrep "No changes to import!" out + ) +' + +# +# Same as before, relative branch name. +# +test_expect_success 'git p4 sync existing branch with relative name' ' + test_create_repo "$git" && + test_when_finished cleanup_git && + ( + cd "$git" && + test_commit head && + git p4 sync --branch=branch1 //depot@all && + git p4 sync --branch=p4/branch1 >out && + test_i18ngrep "No changes to import!" out + ) +' + +# +# Same as before, with a nested branch path, referenced different ways. +# +test_expect_success 'git p4 sync existing branch with nested path' ' + test_create_repo "$git" && + test_when_finished cleanup_git && + ( + cd "$git" && + test_commit head && + git p4 sync --branch=p4/some/path //depot@all && + git p4 sync --branch=some/path >out && + test_i18ngrep "No changes to import!" out + ) +' + +# +# Same as before, with a full ref path outside the p4/* namespace. +# +test_expect_success 'git p4 sync branch explicit ref without p4 in path' ' + test_create_repo "$git" && + test_when_finished cleanup_git && + ( + cd "$git" && + test_commit head && + git p4 sync --branch=refs/remotes/someremote/depot //depot@all && + git p4 sync --branch=refs/remotes/someremote/depot >out && + test_i18ngrep "No changes to import!" out + ) +' + +test_expect_success 'git p4 sync nonexistent ref' ' + test_create_repo "$git" && + test_when_finished cleanup_git && + ( + cd "$git" && + test_commit head && + git p4 sync --branch=depot //depot@all && + test_must_fail git p4 sync --branch=depot2 2>errs && + test_i18ngrep "Perhaps you never did" errs + ) +' + +test_expect_success 'git p4 sync existing non-p4-imported ref' ' + test_create_repo "$git" && + test_when_finished cleanup_git && + ( + cd "$git" && + test_commit head && + git p4 sync --branch=depot //depot@all && + test_must_fail git p4 sync --branch=refs/heads/master 2>errs && + test_i18ngrep "Perhaps you never did" errs + ) +' + test_expect_success 'clone two dirs' ' ( cd "$cli" && diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh index 50a6f8bad5..759a14fa87 100755 --- a/t/t9801-git-p4-branch.sh +++ b/t/t9801-git-p4-branch.sh @@ -129,6 +129,16 @@ test_expect_success 'import depot, branch detection' ' ) ' +test_expect_success 'sync specific detected branch' ' + test_when_finished cleanup_git && + git p4 clone --dest="$git" --detect-branches //depot@all && + ( + cd "$git" && + git p4 sync --branch=depot/branch2 >out && + test_i18ngrep "No changes to import!" out + ) +' + test_expect_success 'import depot, branch detection, branchList branch definition' ' test_when_finished cleanup_git && test_create_repo "$git" && |