truncate diff if longer than 60k #111

Merged
ahuston-0 merged 1 commits from feature/trunc-diff into main 2025-05-27 11:21:34 -04:00

View File

@ -12,13 +12,15 @@ def inject_diff():
out = []
with open(source_file,'r') as src:
src_content = src.read()
if len(src_content) > 60000:
logging.warning(f"{source_file} is longer than 60k characters, truncating")
src_content = src_content[:60000]
with open(target_file,'r') as tgt:
for line in tgt.readlines():
if placeholder in line:
out.append(line.replace(placeholder,src_content))
else:
out.append(line)
logging.info(out)
with open(target_file,'w') as tgt:
tgt.writelines(out)