Skip to content

Commit 5a92a6c

Browse files
Pete Wyckoffgitster
authored andcommitted
git-p4: document and test --import-local
Explain that it is needed on future syncs to find p4 branches in refs/heads. Test this behavior. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 58c8bc7 commit 5a92a6c

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

Documentation/git-p4.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ git repository:
211211
By default, p4 branches are stored in 'refs/remotes/p4/',
212212
where they will be treated as remote-tracking branches by
213213
linkgit:git-branch[1] and other commands. This option instead
214-
puts p4 branches in 'refs/heads/p4/'.
214+
puts p4 branches in 'refs/heads/p4/'. Note that future
215+
sync operations must specify '--import-local' as well so that
216+
they can find the p4 branches in refs/heads.
215217

216218
--max-changes <n>::
217219
Limit the number of imported changes to 'n'. Useful to

t/t9806-git-p4-options.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,28 @@ test_expect_success 'clone --changesfile, @all' '
6161
test_must_fail "$GITP4" clone --changesfile="$cf" --dest="$git" //depot@all
6262
'
6363

64+
# imports both master and p4/master in refs/heads
65+
# requires --import-local on sync to find p4 refs/heads
66+
# does not update master on sync, just p4/master
67+
test_expect_success 'clone/sync --import-local' '
68+
"$GITP4" clone --import-local --dest="$git" //depot@1,2 &&
69+
test_when_finished cleanup_git &&
70+
(
71+
cd "$git" &&
72+
git log --oneline refs/heads/master >lines &&
73+
test_line_count = 2 lines &&
74+
git log --oneline refs/heads/p4/master >lines &&
75+
test_line_count = 2 lines &&
76+
test_must_fail "$GITP4" sync &&
77+
78+
"$GITP4" sync --import-local &&
79+
git log --oneline refs/heads/master >lines &&
80+
test_line_count = 2 lines &&
81+
git log --oneline refs/heads/p4/master >lines &&
82+
test_line_count = 3 lines
83+
)
84+
'
85+
6486
test_expect_success 'kill p4d' '
6587
kill_p4d
6688
'

0 commit comments

Comments
 (0)