(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'Clone repositories and store files in Git LFS'>)} ) ] ) (C {(.)} {(./lib-git-p4.sh)}) (command.AndOr ops: [Op_DPipe] children: [ (command.SimpleCommand words: [{(git)} {(lfs)} {(help)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)}) (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)}) ] ) (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:skip_all) op: Equal rhs: {(SQ <'skipping git p4 Git LFS tests; Git LFS not found'>)} ) ] ) (C {(test_done)}) ] ) ] ) (command.FuncDef name: test_file_in_lfs body: (command.BraceGroup children: [ (command.AndOr ops: [ Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp ] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:FILE) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:SIZE) op: Equal rhs: {(DQ ($ VSub_Number '$2'))} ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:EXPECTED_CONTENT) op: Equal rhs: {(DQ ($ VSub_Number '$3'))} ) ] ) (command.Pipeline children: [ (C {(sed)} {(-n)} {(SQ <'1,1 p'>)} {(DQ ($ VSub_DollarName '$FILE'))}) (C {(grep)} {(DQ ('^version '))}) ] negated: F ) (command.Pipeline children: [ (C {(sed)} {(-n)} {(SQ <'2,2 p'>)} {(DQ ($ VSub_DollarName '$FILE'))}) (C {(grep)} {(DQ ('^oid '))}) ] negated: F ) (command.Pipeline children: [ (C {(sed)} {(-n)} {(SQ <'3,3 p'>)} {(DQ ($ VSub_DollarName '$FILE'))}) (C {(grep)} {(DQ ('^size '))}) ] negated: F ) (C {(test_line_count)} {(Lit_Other '=')} {(3)} {(DQ ($ VSub_DollarName '$FILE'))}) (command.Pipeline children: [ (C {(cat)} {(DQ ($ VSub_DollarName '$FILE'))}) (C {(grep)} {(DQ ('size ') ($ VSub_DollarName '$SIZE'))}) ] negated: F ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:HASH) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(cat)} {(DQ ($ VSub_DollarName '$FILE'))}) (C {(grep)} {(DQ ('oid sha256:'))}) (C {(sed)} {(-e)} {(DQ ('s/oid sha256://g'))}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:LFS_FILE) op: Equal rhs: { (DQ (.git/lfs/objects/) (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {(DQ ($ VSub_DollarName '$HASH'))}) (C {(cut)} {(-c1-2)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) (/) (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {(DQ ($ VSub_DollarName '$HASH'))}) (C {(cut)} {(-c3-4)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) (/) ($ VSub_DollarName '$HASH') ) } ) ] ) (command.SimpleCommand words: [{(echo)} {($ VSub_DollarName '$EXPECTED_CONTENT')}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)})] ) (C {(test_path_is_file)} {(DQ ($ VSub_DollarName '$FILE'))}) (C {(test_path_is_file)} {(DQ ($ VSub_DollarName '$LFS_FILE'))}) (C {(test_cmp)} {(expect)} {(DQ ($ VSub_DollarName '$LFS_FILE'))}) ] ) ] ) ) (command.FuncDef name: test_file_count_in_dir body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:DIR) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:EXPECTED_COUNT) op: Equal rhs: {(DQ ($ VSub_Number '$2'))} ) ] ) (command.SimpleCommand words: [{(find)} {(DQ ($ VSub_DollarName '$DIR'))} {(-type)} {(f)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})] ) (C {(test_line_count)} {(Lit_Other '=')} {($ VSub_DollarName '$EXPECTED_COUNT')} {(actual)} ) ] ) ] ) ) (C {(test_expect_success)} {(SQ <'start p4d'>)} {(SQ <'\n'> <'\tstart_p4d\n'>)}) (C {(test_expect_success)} {(SQ <'Create repo with binary files'>)} { (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\t(\n'> <'\t\tcd "$cli" &&\n'> <'\n'> <'\t\techo "content 1 txt 23 bytes" >file1.txt &&\n'> <'\t\tp4 add file1.txt &&\n'> <'\t\techo "content 2-3 bin 25 bytes" >file2.dat &&\n'> <'\t\tp4 add file2.dat &&\n'> <'\t\tp4 submit -d "Add text and binary file" &&\n'> <'\n'> <'\t\tmkdir "path with spaces" &&\n'> <'\t\techo "content 2-3 bin 25 bytes" >"path with spaces/file3.bin" &&\n'> <'\t\tp4 add "path with spaces/file3.bin" &&\n'> <'\t\tp4 submit -d "Add another binary file with same content and spaces in path" &&\n'> <'\n'> <'\t\techo "content 4 bin 26 bytes XX" >file4.bin &&\n'> <'\t\tp4 add file4.bin &&\n'> <'\t\tp4 submit -d "Add another binary file with different content"\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'Store files in LFS based on size (>24 bytes)'>)} { (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem GitLFS &&\n'> <'\t\tgit config git-p4.largeFileThreshold 24 &&\n'> <'\t\tgit p4 clone --destination="$git" //depot@all &&\n'> <'\n'> <'\t\ttest_file_in_lfs file2.dat 25 "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_file_in_lfs "path with spaces/file3.bin" 25 "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_file_in_lfs file4.bin 26 "content 4 bin 26 bytes XX" &&\n'> <'\n'> <'\t\ttest_file_count_in_dir ".git/lfs/objects" 2 &&\n'> <'\n'> <'\t\tcat >expect <<-\\EOF &&\n'> <'\n'> <'\t\t#\n'> <'\t\t# Git LFS (see https://git-lfs.github.com/)\n'> <'\t\t#\n'> <'\t\t/file2.dat filter=lfs -text\n'> <'\t\t/file4.bin filter=lfs -text\n'> <'\t\t/path[[:space:]]with[[:space:]]spaces/file3.bin filter=lfs -text\n'> <'\t\tEOF\n'> <'\t\ttest_path_is_file .gitattributes &&\n'> <'\t\ttest_cmp expect .gitattributes\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'Store files in LFS based on size (>25 bytes)'>)} { (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem GitLFS &&\n'> <'\t\tgit config git-p4.largeFileThreshold 25 &&\n'> <'\t\tgit p4 clone --destination="$git" //depot@all &&\n'> <'\n'> <'\t\ttest_file_in_lfs file4.bin 26 "content 4 bin 26 bytes XX" &&\n'> <'\t\ttest_file_count_in_dir ".git/lfs/objects" 1 &&\n'> <'\n'> <'\t\tcat >expect <<-\\EOF &&\n'> <'\n'> <'\t\t#\n'> <'\t\t# Git LFS (see https://git-lfs.github.com/)\n'> <'\t\t#\n'> <'\t\t/file4.bin filter=lfs -text\n'> <'\t\tEOF\n'> <'\t\ttest_path_is_file .gitattributes &&\n'> <'\t\ttest_cmp expect .gitattributes\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'Store files in LFS based on extension (dat)'>)} { (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem GitLFS &&\n'> <'\t\tgit config git-p4.largeFileExtensions dat &&\n'> <'\t\tgit p4 clone --destination="$git" //depot@all &&\n'> <'\n'> <'\t\ttest_file_in_lfs file2.dat 25 "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_file_count_in_dir ".git/lfs/objects" 1 &&\n'> <'\n'> <'\t\tcat >expect <<-\\EOF &&\n'> <'\n'> <'\t\t#\n'> <'\t\t# Git LFS (see https://git-lfs.github.com/)\n'> <'\t\t#\n'> <'\t\t*.dat filter=lfs -text\n'> <'\t\tEOF\n'> <'\t\ttest_path_is_file .gitattributes &&\n'> <'\t\ttest_cmp expect .gitattributes\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'Store files in LFS based on size (>25 bytes) and extension (dat)'>)} { (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem GitLFS &&\n'> <'\t\tgit config git-p4.largeFileExtensions dat &&\n'> <'\t\tgit config git-p4.largeFileThreshold 25 &&\n'> <'\t\tgit p4 clone --destination="$git" //depot@all &&\n'> <'\n'> <'\t\ttest_file_in_lfs file2.dat 25 "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_file_in_lfs file4.bin 26 "content 4 bin 26 bytes XX" &&\n'> <'\t\ttest_file_count_in_dir ".git/lfs/objects" 2 &&\n'> <'\n'> <'\t\tcat >expect <<-\\EOF &&\n'> <'\n'> <'\t\t#\n'> <'\t\t# Git LFS (see https://git-lfs.github.com/)\n'> <'\t\t#\n'> <'\t\t*.dat filter=lfs -text\n'> <'\t\t/file4.bin filter=lfs -text\n'> <'\t\tEOF\n'> <'\t\ttest_path_is_file .gitattributes &&\n'> <'\t\ttest_cmp expect .gitattributes\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'Remove file from repo and store files in LFS based on size (>24 bytes)'>)} { (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\t(\n'> <'\t\tcd "$cli" &&\n'> <'\t\tp4 delete file4.bin &&\n'> <'\t\tp4 submit -d "Remove file"\n'> <'\t) &&\n'> <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem GitLFS &&\n'> <'\t\tgit config git-p4.largeFileThreshold 24 &&\n'> <'\t\tgit p4 clone --destination="$git" //depot@all &&\n'> <'\n'> <'\t\ttest_file_in_lfs file2.dat 25 "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_file_in_lfs "path with spaces/file3.bin" 25 "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_path_is_missing file4.bin &&\n'> <'\t\ttest_file_count_in_dir ".git/lfs/objects" 2 &&\n'> <'\n'> <'\t\tcat >expect <<-\\EOF &&\n'> <'\n'> <'\t\t#\n'> <'\t\t# Git LFS (see https://git-lfs.github.com/)\n'> <'\t\t#\n'> <'\t\t/file2.dat filter=lfs -text\n'> <'\t\t/path[[:space:]]with[[:space:]]spaces/file3.bin filter=lfs -text\n'> <'\t\tEOF\n'> <'\t\ttest_path_is_file .gitattributes &&\n'> <'\t\ttest_cmp expect .gitattributes\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'Add .gitattributes and store files in LFS based on size (>24 bytes)'>)} { (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\t(\n'> <'\t\tcd "$cli" &&\n'> <'\t\techo "*.txt text" >.gitattributes &&\n'> <'\t\tp4 add .gitattributes &&\n'> <'\t\tp4 submit -d "Add .gitattributes"\n'> <'\t) &&\n'> <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem GitLFS &&\n'> <'\t\tgit config git-p4.largeFileThreshold 24 &&\n'> <'\t\tgit p4 clone --destination="$git" //depot@all &&\n'> <'\n'> <'\t\ttest_file_in_lfs file2.dat 25 "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_file_in_lfs "path with spaces/file3.bin" 25 "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_path_is_missing file4.bin &&\n'> <'\t\ttest_file_count_in_dir ".git/lfs/objects" 2 &&\n'> <'\n'> <'\t\tcat >expect <<-\\EOF &&\n'> <'\t\t*.txt text\n'> <'\n'> <'\t\t#\n'> <'\t\t# Git LFS (see https://git-lfs.github.com/)\n'> <'\t\t#\n'> <'\t\t/file2.dat filter=lfs -text\n'> <'\t\t/path[[:space:]]with[[:space:]]spaces/file3.bin filter=lfs -text\n'> <'\t\tEOF\n'> <'\t\ttest_path_is_file .gitattributes &&\n'> <'\t\ttest_cmp expect .gitattributes\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'Add big files to repo and store files in LFS based on compressed size (>28 bytes)'>)} { (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\t(\n'> <'\t\tcd "$cli" &&\n'> <'\t\techo "content 5 bin 40 bytes XXXXXXXXXXXXXXXX" >file5.bin &&\n'> <'\t\tp4 add file5.bin &&\n'> <'\t\tp4 submit -d "Add file with small footprint after compression" &&\n'> <'\n'> <'\t\techo "content 6 bin 39 bytes XXXXXYYYYYZZZZZ" >file6.bin &&\n'> <'\t\tp4 add file6.bin &&\n'> <'\t\tp4 submit -d "Add file with large footprint after compression"\n'> <'\t) &&\n'> <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem GitLFS &&\n'> <'\t\tgit config git-p4.largeFileCompressedThreshold 28 &&\n'> <'\t\t# We only import HEAD here ("@all" is missing!)\n'> <'\t\tgit p4 clone --destination="$git" //depot &&\n'> <'\n'> <'\t\ttest_file_in_lfs file6.bin 39 "content 6 bin 39 bytes XXXXXYYYYYZZZZZ" &&\n'> <'\t\ttest_file_count_in_dir ".git/lfs/objects" 1 &&\n'> <'\n'> <'\t\tcat >expect <<-\\EOF &&\n'> <'\t\t*.txt text\n'> <'\n'> <'\t\t#\n'> <'\t\t# Git LFS (see https://git-lfs.github.com/)\n'> <'\t\t#\n'> <'\t\t/file6.bin filter=lfs -text\n'> <'\t\tEOF\n'> <'\t\ttest_path_is_file .gitattributes &&\n'> <'\t\ttest_cmp expect .gitattributes\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'kill p4d'>)} {(SQ <'\n'> <'\tkill_p4d\n'>)}) (C {(test_done)}) ] )