Skip to content

Commit 9f7ef0e

Browse files
Pete Wyckoffgitster
authored andcommitted
git-p4: ignore apple filetype
Revert 97a21ca (git-p4: stop ignoring apple filetype, 2011-10-16) and add a test case. Reported-by: Michael Wookey <[email protected]> Signed-off-by: Pete Wyckoff <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 97a21ca commit 9f7ef0e

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
@@ -1272,6 +1272,19 @@ class P4Sync(Command, P4UserMap):
12721272
text = p4_read_pipe('print -q -o - "%s"' % file['depotFile'])
12731273
contents = [ text ]
12741274

1275+
if type_base == "apple":
1276+
# Apple filetype files will be streamed as a concatenation of
1277+
# its appledouble header and the contents. This is useless
1278+
# on both macs and non-macs. If using "print -q -o xx", it
1279+
# will create "xx" with the data, and "%xx" with the header.
1280+
# This is also not very useful.
1281+
#
1282+
# Ideally, someday, this script can learn how to generate
1283+
# appledouble files directly and import those to git, but
1284+
# non-mac machines can never find a use for apple filetype.
1285+
print "\nIgnoring apple filetype file %s" % file['depotFile']
1286+
return
1287+
12751288
# Perhaps windows wants unicode, utf16 newlines translated too;
12761289
# but this is not doing it.
12771290
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)