Skip to content

Commit 1d5cb45

Browse files
committed
Merge branch 'gv/p4-multi-path-commit-fix' into maint
"git p4" that tracks multile p4 paths imported a single changelist that touches files in these multiple paths as one commit, followed by many empty commits. This has been fixed. * gv/p4-multi-path-commit-fix: git-p4: fix multi-path changelist empty commits
2 parents a558332 + 9943e5b commit 1d5cb45

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

git-p4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize):
823823
die("cannot use --changes-block-size with non-numeric revisions")
824824
block_size = None
825825

826-
changes = []
826+
changes = set()
827827

828828
# Retrieve changes a block at a time, to prevent running
829829
# into a MaxResults/MaxScanRows error from the server.
@@ -842,7 +842,7 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize):
842842

843843
# Insert changes in chronological order
844844
for line in reversed(p4_read_pipe_lines(cmd)):
845-
changes.append(int(line.split(" ")[1]))
845+
changes.add(int(line.split(" ")[1]))
846846

847847
if not block_size:
848848
break

t/t9800-git-p4-basic.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,26 @@ test_expect_success 'clone two dirs, @all, conflicting files' '
131131
)
132132
'
133133

134+
test_expect_success 'clone two dirs, each edited by submit, single git commit' '
135+
(
136+
cd "$cli" &&
137+
echo sub1/f4 >sub1/f4 &&
138+
p4 add sub1/f4 &&
139+
echo sub2/f4 >sub2/f4 &&
140+
p4 add sub2/f4 &&
141+
p4 submit -d "sub1/f4 and sub2/f4"
142+
) &&
143+
git p4 clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
144+
test_when_finished cleanup_git &&
145+
(
146+
cd "$git" &&
147+
git ls-files >lines &&
148+
test_line_count = 4 lines &&
149+
git log --oneline p4/master >lines &&
150+
test_line_count = 5 lines
151+
)
152+
'
153+
134154
revision_ranges="2000/01/01,#head \
135155
1,2080/01/01 \
136156
2000/01/01,2080/01/01 \
@@ -147,7 +167,7 @@ test_expect_success 'clone using non-numeric revision ranges' '
147167
(
148168
cd "$git" &&
149169
git ls-files >lines &&
150-
test_line_count = 6 lines
170+
test_line_count = 8 lines
151171
)
152172
done
153173
'

0 commit comments

Comments
 (0)