git p4: fix sync --branch when no master branch

It is legal to sync a branch with a different name than
refs/remotes/p4/master, and to do so even when master does
not exist.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Pete Wyckoff
2013-01-14 19:47:06 -05:00
committed by Junio C Hamano
parent 5a8e84cde3
commit 8c9e8b6e75
3 changed files with 20 additions and 7 deletions

View File

@ -88,14 +88,14 @@ test_expect_success 'sync when two branches but no master should noop' '
)
'
test_expect_failure 'sync --branch updates specified branch' '
test_expect_success 'sync --branch updates specific branch, no detection' '
test_when_finished cleanup_git &&
(
cd "$git" &&
git init &&
git p4 sync --branch=refs/remotes/p4/b1 //depot@2 &&
git p4 sync --branch=refs/remotes/p4/b2 //depot@2 &&
git p4 sync --branch=refs/remotes/p4/b2 &&
git p4 sync --branch=b1 //depot@2 &&
git p4 sync --branch=b2 //depot@2 &&
git p4 sync --branch=b2 &&
git show -s --format=%s refs/remotes/p4/b1 >show &&
grep "Initial import" show &&
git show -s --format=%s refs/remotes/p4/b2 >show &&