Skip to content

Commit 7b5bd1a

Browse files
authored
clean up resolved directory (#202)
1 parent bdec6e4 commit 7b5bd1a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

webdiff/dirdiff.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def make_resolved_dir(dir: str) -> str:
4242
return temp_dir
4343

4444

45-
def gitdiff(a_dir, b_dir, webdiff_config):
45+
def gitdiff(a_dir: str, b_dir: str, webdiff_config):
4646
extra_args = webdiff_config['extraDirDiffArgs']
4747
cmd = 'git diff --raw -z --no-index'
4848
if extra_args:
@@ -62,9 +62,12 @@ def gitdiff(a_dir, b_dir, webdiff_config):
6262
# TODO: how to distinguish these cases?
6363
diff_stdout = diff_output.stdout.decode('utf8')
6464
# Make it look like the diff was between directories containing symlinks.
65+
# After this point, the resolved directories are no longer needed.
6566
if a_dir != a_dir_nosym:
6667
diff_stdout = diff_stdout.replace(a_dir_nosym, a_dir)
68+
shutil.rmtree(a_dir_nosym)
6769
if b_dir != b_dir_nosym:
6870
diff_stdout = diff_stdout.replace(b_dir_nosym, b_dir)
71+
shutil.rmtree(b_dir_nosym)
6972
lines = parse_raw_diff(diff_stdout)
7073
return [LocalFileDiff.from_diff_raw_line(line, a_dir, b_dir) for line in lines]

0 commit comments

Comments
 (0)