(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'Clone repositories and store files in Git LFS'>)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./lib-git-p4.sh)})
    (AndOr
      children: [
        (SimpleCommand
          words: [{(git)} {(lfs)} {(help)}]
          redirects: [
            (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[21])
            (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[24])
          ]
        )
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:skip_all)
                  op: Equal
                  rhs: {(SQ <'skipping git p4 Git LFS tests; Git LFS not found'>)}
                  spids: [32]
                )
              ]
              spids: [32]
            )
            (C {(test_done)})
          ]
          spids: [29]
        )
      ]
      op_id: Op_DPipe
    )
    (FuncDef
      name: test_file_in_lfs
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:FILE)
                      op: Equal
                      rhs: {(DQ ($ VSub_Number '$1'))}
                      spids: [51]
                    )
                  ]
                  spids: [51]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:SIZE)
                          op: Equal
                          rhs: {(DQ ($ VSub_Number '$2'))}
                          spids: [59]
                        )
                      ]
                      spids: [59]
                    )
                    (AndOr
                      children: [
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:EXPECTED_CONTENT)
                              op: Equal
                              rhs: {(DQ ($ VSub_Number '$3'))}
                              spids: [67]
                            )
                          ]
                          spids: [67]
                        )
                        (AndOr
                          children: [
                            (Pipeline
                              children: [
                                (C {(sed)} {(-n)} {(SQ <'1,1 p'>)} {(DQ ($ VSub_Name '$FILE'))})
                                (C {(grep)} {(DQ ('^version '))})
                              ]
                              negated: False
                            )
                            (AndOr
                              children: [
                                (Pipeline
                                  children: [
                                    (C {(sed)} {(-n)} {(SQ <'2,2 p'>)} {(DQ ($ VSub_Name '$FILE'))})
                                    (C {(grep)} {(DQ ('^oid '))})
                                  ]
                                  negated: False
                                )
                                (AndOr
                                  children: [
                                    (Pipeline
                                      children: [
                                        (C {(sed)} {(-n)} {(SQ <'3,3 p'>)} {(DQ ($ VSub_Name '$FILE'))})
                                        (C {(grep)} {(DQ ('^size '))})
                                      ]
                                      negated: False
                                    )
                                    (AndOr
                                      children: [
                                        (C {(test_line_count)} {(Lit_Other '=')} {(3)} 
                                          {(DQ ($ VSub_Name '$FILE'))}
                                        )
                                        (AndOr
                                          children: [
                                            (Pipeline
                                              children: [
                                                (C {(cat)} {(DQ ($ VSub_Name '$FILE'))})
                                                (C {(grep)} {(DQ ('size ') ($ VSub_Name '$SIZE'))})
                                              ]
                                              negated: False
                                            )
                                            (AndOr
                                              children: [
                                                (Assignment
                                                  keyword: Assign_None
                                                  pairs: [
                                                    (assign_pair
                                                      lhs: (LhsName name:HASH)
                                                      op: Equal
                                                      rhs: 
                                                        {
                                                          (CommandSubPart
                                                            command_list: 
                                                              (CommandList
                                                                children: [
                                                                  (Pipeline
                                                                    children: [
                                                                      (C {(cat)} 
                                                                        {(DQ ($ VSub_Name '$FILE'))}
                                                                      )
                                                                      (C {(grep)} {(DQ ('oid sha256:'))})
                                                                      (C {(sed)} {(-e)} 
                                                                        {(DQ ('s/oid sha256://g'))}
                                                                      )
                                                                    ]
                                                                    negated: False
                                                                  )
                                                                ]
                                                              )
                                                            left_token: <Left_CommandSub '$('>
                                                            spids: [176 200]
                                                          )
                                                        }
                                                      spids: [175]
                                                    )
                                                  ]
                                                  spids: [175]
                                                )
                                                (AndOr
                                                  children: [
                                                    (Assignment
                                                      keyword: Assign_None
                                                      pairs: [
                                                        (assign_pair
                                                          lhs: (LhsName name:LFS_FILE)
                                                          op: Equal
                                                          rhs: 
                                                            {
                                                              (DQ (.git/lfs/objects/) 
                                                                (CommandSubPart
                                                                  command_list: 
                                                                    (CommandList
                                                                      children: [
                                                                        (Pipeline
                                                                          children: [
                                                                            (C {(echo)} 
                                                                              {
                                                                                (DQ 
                                                                                  ($ VSub_Name 
'$HASH'
                                                                                  )
                                                                                )
                                                                              }
                                                                            )
                                                                            (C {(cut)} {(-c1-2)})
                                                                          ]
                                                                          negated: False
                                                                        )
                                                                      ]
                                                                    )
                                                                  left_token: <Left_CommandSub '$('>
                                                                  spids: [208 220]
                                                                ) (/) 
                                                                (CommandSubPart
                                                                  command_list: 
                                                                    (CommandList
                                                                      children: [
                                                                        (Pipeline
                                                                          children: [
                                                                            (C {(echo)} 
                                                                              {
                                                                                (DQ 
                                                                                  ($ VSub_Name 
'$HASH'
                                                                                  )
                                                                                )
                                                                              }
                                                                            )
                                                                            (C {(cut)} {(-c3-4)})
                                                                          ]
                                                                          negated: False
                                                                        )
                                                                      ]
                                                                    )
                                                                  left_token: <Left_CommandSub '$('>
                                                                  spids: [222 234]
                                                                ) (/) ($ VSub_Name '$HASH')
                                                              )
                                                            }
                                                          spids: [205]
                                                        )
                                                      ]
                                                      spids: [205]
                                                    )
                                                    (AndOr
                                                      children: [
                                                        (SimpleCommand
                                                          words: [
                                                            {(echo)}
                                                            {($ VSub_Name '$EXPECTED_CONTENT')}
                                                          ]
                                                          redirects: [
                                                            (Redir
                                                              op_id: Redir_Great
                                                              fd: -1
                                                              arg_word: {(expect)}
                                                              spids: [246]
                                                            )
                                                          ]
                                                        )
                                                        (AndOr
                                                          children: [
                                                            (C {(test_path_is_file)} 
                                                              {(DQ ($ VSub_Name '$FILE'))}
                                                            )
                                                            (AndOr
                                                              children: [
                                                                (C {(test_path_is_file)} 
                                                                  {(DQ ($ VSub_Name '$LFS_FILE'))}
                                                                )
                                                                (C {(test_cmp)} {(expect)} 
                                                                  {(DQ ($ VSub_Name '$LFS_FILE'))}
                                                                )
                                                              ]
                                                              op_id: Op_DAmp
                                                            )
                                                          ]
                                                          op_id: Op_DAmp
                                                        )
                                                      ]
                                                      op_id: Op_DAmp
                                                    )
                                                  ]
                                                  op_id: Op_DAmp
                                                )
                                              ]
                                              op_id: Op_DAmp
                                            )
                                          ]
                                          op_id: Op_DAmp
                                        )
                                      ]
                                      op_id: Op_DAmp
                                    )
                                  ]
                                  op_id: Op_DAmp
                                )
                              ]
                              op_id: Op_DAmp
                            )
                          ]
                          op_id: Op_DAmp
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [48]
        )
      spids: [43 47]
    )
    (FuncDef
      name: test_file_count_in_dir
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:DIR)
                      op: Equal
                      rhs: {(DQ ($ VSub_Number '$1'))}
                      spids: [289]
                    )
                  ]
                  spids: [289]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:EXPECTED_COUNT)
                          op: Equal
                          rhs: {(DQ ($ VSub_Number '$2'))}
                          spids: [297]
                        )
                      ]
                      spids: [297]
                    )
                    (AndOr
                      children: [
                        (SimpleCommand
                          words: [{(find)} {(DQ ($ VSub_Name '$DIR'))} {(-type)} {(f)}]
                          redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(actual)} spids:[315])]
                        )
                        (C {(test_line_count)} {(Lit_Other '=')} {($ VSub_Name '$EXPECTED_COUNT')} 
                          {(actual)}
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [286]
        )
      spids: [281 285]
    )
    (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)})
  ]
)