diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-11-06 21:21:57 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-11-06 21:21:57 -0800 |
commit | de263479506066f240cf629aa3aac50c94668d89 (patch) | |
tree | 2cb3992abf176354aed9cef273aa73932ea523e5 | |
parent | ee6dfb2d83ba1b057943e705f707fa27e34e47f9 (diff) | |
parent | 9f7ef0eaf2e54609128add5e8f9b506bdbb81dff (diff) | |
download | git-de263479506066f240cf629aa3aac50c94668d89.tar.gz |
Merge branch 'pw/p4-appledouble-fix'
* pw/p4-appledouble-fix:
git-p4: ignore apple filetype
-rwxr-xr-x | contrib/fast-import/git-p4 | 13 | ||||
-rwxr-xr-x | t/t9802-git-p4-filetype.sh | 31 |
2 files changed, 44 insertions, 0 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index f885d707c4..b975d67fca 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -1318,6 +1318,19 @@ class P4Sync(Command, P4UserMap): text = p4_read_pipe(['print', '-q', '-o', '-', file['depotFile']]) contents = [ text ] + if type_base == "apple": + # Apple filetype files will be streamed as a concatenation of + # its appledouble header and the contents. This is useless + # on both macs and non-macs. If using "print -q -o xx", it + # will create "xx" with the data, and "%xx" with the header. + # This is also not very useful. + # + # Ideally, someday, this script can learn how to generate + # appledouble files directly and import those to git, but + # non-mac machines can never find a use for apple filetype. + print "\nIgnoring apple filetype file %s" % file['depotFile'] + return + # Perhaps windows wants unicode, utf16 newlines translated too; # but this is not doing it. if self.isWindows and type_base == "text": diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh index 3b358ef8d8..992bb8cf0b 100755 --- a/t/t9802-git-p4-filetype.sh +++ b/t/t9802-git-p4-filetype.sh @@ -101,6 +101,37 @@ test_expect_success 'keyword file test' ' ) ' +build_gendouble() { + cat >gendouble.py <<-\EOF + import sys + import struct + import array + + s = array.array("c", '\0' * 26) + struct.pack_into(">L", s, 0, 0x00051607) # AppleDouble + struct.pack_into(">L", s, 4, 0x00020000) # version 2 + s.tofile(sys.stdout) + EOF +} + +test_expect_success 'ignore apple' ' + test_when_finished rm -f gendouble.py && + build_gendouble && + ( + cd "$cli" && + test-genrandom apple 1024 >double.png && + "$PYTHON_PATH" "$TRASH_DIRECTORY/gendouble.py" >%double.png && + p4 add -t apple double.png && + p4 submit -d appledouble + ) && + test_when_finished cleanup_git && + "$GITP4" clone --dest="$git" //depot@all && + ( + cd "$git" && + test ! -f double.png + ) +' + test_expect_success 'kill p4d' ' kill_p4d ' |