diff options
author | Tao Klerks <tao@klerks.biz> | 2022-04-04 08:10:54 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-04-06 22:59:40 +0300 |
commit | 17f273ffbad8724278e0fa4da592a7ec7c6abc83 (patch) | |
tree | b39f9ab97061355d831922507c2001ccb1342c97 /t/t9801-git-p4-branch.sh | |
parent | faa21c10d44184f616d391c158dcbb13b9c72ef3 (diff) |
git-p4: support explicit sync of arbitrary existing git-p4 refs
With the --branch argument of the "sync" subcommand, git-p4 enables
you to import a perforce branch/path to an arbitrary git ref, using
a full ref path, or to refs/remotes/p4/* or refs/heads/p4/*,
depending on --import-local, using a short ref name.
However, when you later want to explicitly sync such a given ref to
pick up subsequent p4 changes, it only works if the ref was placed
in the p4 path *and* has only one path component (no "/").
This limitation results from a bad assumption in the
existing-branch sync logic, and also means you cannot individually
sync branches detected by --detect-branches, as these also get a
"/" in their names.
Fix "git p4 sync --branch", when called with an existing ref, so
that it works correctly regardless of whether the ref is in the p4
path or not, and (in the case of refs in the p4 path) regardless of
whether it has a "/" in its short name or not.
Also add tests to validate that these branch-specific syncs work
as expected.
Signed-off-by: Tao Klerks <tao@klerks.biz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9801-git-p4-branch.sh')
-rwxr-xr-x | t/t9801-git-p4-branch.sh | 10 |
1 files changed, 10 insertions, 0 deletions
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" && |