git-p4: test cloning with two dirs, clarify doc
Document how git-p4 currently works when specifying multiple depot paths: 1. No branches or directories are named. 2. Conflicting files are silently ignored---the last change wins. 2. Option --destination is required, else the last path is construed to be a directory. 3. Revision specifiers must be the same on all paths for them to take effect. Test this behavior. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pete Wyckoff committed
Dec 24, 2011 at 21:07 UTC
da191d15bfd690e679a9626cba527465e0aafabb
2 files changed
+69
-2
Documentation/git-p4.txt
+9
-2
@@ -276,8 +276,15 @@ p4 revision specifier on the end:
276
"//depot/my/project@1,6"::
277
Import only changes 1 through 6.
278
279
-"//depot/proj1 //depot/proj2@all"::
280
- Import all changes from both named depot paths.
279
+"//depot/proj1@all //depot/proj2@all"::
280
+ Import all changes from both named depot paths into a single
281
+ repository. Only files below these directories are included.
282
+ There is not a subdirectory in git for each "proj1" and "proj2".
283
+ You must use the '--destination' option when specifying more
284
+ than one depot path. The revision specifier must be specified
285
+ identically on each depot path. If there are files in the
286
+ depot paths with the same name, the path with the most recently
287
+ updated version of the file is the one that appears in git.
288
289
See 'p4 help revisions' for the full syntax of p4 revision specifiers.
290
t/t9800-git-p4-basic.sh
+60
@@ -65,6 +65,66 @@ test_expect_success 'git-p4 sync new branch' '
65
)
66
'
67
68
+test_expect_success 'clone two dirs' '
69
+ (
70
+ cd "$cli" &&
71
+ mkdir sub1 sub2 &&
72
+ echo sub1/f1 >sub1/f1 &&
73
+ echo sub2/f2 >sub2/f2 &&
74
+ p4 add sub1/f1 &&
75
+ p4 submit -d "sub1/f1" &&
76
+ p4 add sub2/f2 &&
77
+ p4 submit -d "sub2/f2"
78
+ ) &&
79
+ "$GITP4" clone --dest="$git" //depot/sub1 //depot/sub2 &&
80
+ test_when_finished cleanup_git &&
81
+ (
82
+ cd "$git" &&
83
+ git ls-files >lines &&
84
+ test_line_count = 2 lines &&
85
+ git log --oneline p4/master >lines &&
86
+ test_line_count = 1 lines
87
+ )
88
+'
89
+
90
+test_expect_success 'clone two dirs, @all' '
91
+ (
92
+ cd "$cli" &&
93
+ echo sub1/f3 >sub1/f3 &&
94
+ p4 add sub1/f3 &&
95
+ p4 submit -d "sub1/f3"
96
+ ) &&
97
+ "$GITP4" clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
98
+ test_when_finished cleanup_git &&
99
+ (
100
+ cd "$git" &&
101
+ git ls-files >lines &&
102
+ test_line_count = 3 lines &&
103
+ git log --oneline p4/master >lines &&
104
+ test_line_count = 3 lines
105
+ )
106
+'
107
+
108
+test_expect_success 'clone two dirs, @all, conflicting files' '
109
+ (
110
+ cd "$cli" &&
111
+ echo sub2/f3 >sub2/f3 &&
112
+ p4 add sub2/f3 &&
113
+ p4 submit -d "sub2/f3"
114
+ ) &&
115
+ "$GITP4" clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
116
+ test_when_finished cleanup_git &&
117
+ (
118
+ cd "$git" &&
119
+ git ls-files >lines &&
120
+ test_line_count = 3 lines &&
121
+ git log --oneline p4/master >lines &&
122
+ test_line_count = 4 lines &&
123
+ echo sub2/f3 >expected &&
124
+ test_cmp expected f3
125
+ )
126
+'
127
+
128
test_expect_success 'exit when p4 fails to produce marshaled output' '
129
badp4dir="$TRASH_DIRECTORY/badp4dir" &&
130
mkdir "$badp4dir" &&