Skip to content

Commit de26347

Browse files
committed
Merge branch 'pw/p4-appledouble-fix'
* pw/p4-appledouble-fix: git-p4: ignore apple filetype
2 parents ee6dfb2 + 9f7ef0e commit de26347

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

contrib/fast-import/git-p4

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,19 @@ class P4Sync(Command, P4UserMap):
13181318
text = p4_read_pipe(['print', '-q', '-o', '-', file['depotFile']])
13191319
contents = [ text ]
13201320

1321+
if type_base == "apple":
1322+
# Apple filetype files will be streamed as a concatenation of
1323+
# its appledouble header and the contents. This is useless
1324+
# on both macs and non-macs. If using "print -q -o xx", it
1325+
# will create "xx" with the data, and "%xx" with the header.
1326+
# This is also not very useful.
1327+
#
1328+
# Ideally, someday, this script can learn how to generate
1329+
# appledouble files directly and import those to git, but
1330+
# non-mac machines can never find a use for apple filetype.
1331+
print "\nIgnoring apple filetype file %s" % file['depotFile']
1332+
return
1333+
13211334
# Perhaps windows wants unicode, utf16 newlines translated too;
13221335
# but this is not doing it.
13231336
if self.isWindows and type_base == "text":

t/t9802-git-p4-filetype.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,37 @@ test_expect_success 'keyword file test' '
101101
)
102102
'
103103

104+
build_gendouble() {
105+
cat >gendouble.py <<-\EOF
106+
import sys
107+
import struct
108+
import array
109+
110+
s = array.array("c", '\0' * 26)
111+
struct.pack_into(">L", s, 0, 0x00051607) # AppleDouble
112+
struct.pack_into(">L", s, 4, 0x00020000) # version 2
113+
s.tofile(sys.stdout)
114+
EOF
115+
}
116+
117+
test_expect_success 'ignore apple' '
118+
test_when_finished rm -f gendouble.py &&
119+
build_gendouble &&
120+
(
121+
cd "$cli" &&
122+
test-genrandom apple 1024 >double.png &&
123+
"$PYTHON_PATH" "$TRASH_DIRECTORY/gendouble.py" >%double.png &&
124+
p4 add -t apple double.png &&
125+
p4 submit -d appledouble
126+
) &&
127+
test_when_finished cleanup_git &&
128+
"$GITP4" clone --dest="$git" //depot@all &&
129+
(
130+
cd "$git" &&
131+
test ! -f double.png
132+
)
133+
'
134+
104135
test_expect_success 'kill p4d' '
105136
kill_p4d
106137
'

0 commit comments

Comments
 (0)