|
3 | 3 | importos
|
4 | 4 | importtempfile
|
5 | 5 | fromconfigparserimportParsingError
|
6 |
| -fromutilsimportis_expected_exception_message |
| 6 | +fromutilsimportis_expected_exception_message,get_max_filename_length |
7 | 7 |
|
8 | 8 | ifgetattr(sys,"frozen",False)andhasattr(sys,"_MEIPASS"):
|
9 | 9 | path_to_bundled_git_binary=os.path.abspath(os.path.join(os.path.dirname(__file__),"git"))
|
@@ -42,12 +42,12 @@ def TestOneInput(data):
|
42 | 42 | writer.release()
|
43 | 43 |
|
44 | 44 | submodule.update(init=fdp.ConsumeBool(),dry_run=fdp.ConsumeBool(),force=fdp.ConsumeBool())
|
45 |
| - |
46 | 45 | submodule_repo=submodule.module()
|
47 |
| -new_file_path=os.path.join( |
48 |
| -submodule_repo.working_tree_dir, |
49 |
| -f"new_file_{fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(1,512))}", |
| 46 | + |
| 47 | +new_file_name=fdp.ConsumeUnicodeNoSurrogates( |
| 48 | +fdp.ConsumeIntInRange(1,max(1,get_max_filename_length(submodule_repo.working_tree_dir))) |
50 | 49 | )
|
| 50 | +new_file_path=os.path.join(submodule_repo.working_tree_dir,new_file_name) |
51 | 51 | withopen(new_file_path,"wb")asnew_file:
|
52 | 52 | new_file.write(fdp.ConsumeBytes(fdp.ConsumeIntInRange(1,512)))
|
53 | 53 | submodule_repo.index.add([new_file_path])
|
@@ -77,14 +77,13 @@ def TestOneInput(data):
|
77 | 77 | BrokenPipeError,
|
78 | 78 | ):
|
79 | 79 | return-1
|
80 |
| -except(ValueError,OSError)ase: |
| 80 | +exceptValueErrorase: |
81 | 81 | expected_messages= [
|
82 | 82 | "SHA is empty",
|
83 | 83 | "Reference at",
|
84 | 84 | "embedded null byte",
|
85 | 85 | "This submodule instance does not exist anymore",
|
86 | 86 | "cmd stdin was empty",
|
87 |
| -"File name too long", |
88 | 87 | ]
|
89 | 88 | ifis_expected_exception_message(e,expected_messages):
|
90 | 89 | return-1
|
|