Merge pull request 'truncate diff if longer than 60k' (#111) from feature/trunc-diff into main
Some checks failed
Check flake.lock / Check health of `flake.lock` (push) Successful in 41s
Check Nix formatting / Perform Nix format checks (push) Successful in 3m19s
Check Nix flake / Perform Nix flake checks (push) Successful in 5m58s
Update flakes / update_lockfile (push) Has been cancelled

Reviewed-on: #111
This commit is contained in:
ahuston-0 2025-05-27 11:21:34 -04:00
commit fbe2ccf445

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)