-
-
Notifications
You must be signed in to change notification settings - Fork 966
Closed
Description
I am trying to use this library to get the file changes by looking at diff.diff, but it's not working, while running what I think is the same command via a subprocess, works.
Code:
# Using this library
uncommitted_diff = repo.index.diff(None, paths=paths)
committed_diff = repo.index.diff(base[0], paths=paths)
for diff in [*uncommitted_diff, *committed_diff]:
print(f"diff: {diff.diff}")
# Using subprocess and running git directly
process1 = subprocess.exec(["git", "diff", paths], capture_output=True)
process2 = subprocess.exec(["git", "diff", base[0].hexsha], capture_output=True)
print("using subprocess:")
print(process1.stdout.decode("utf-8"))subprocess
print(process2.stdout.decode("utf-8"))
Output (with some omiting of info) is:
diff:
using subprocess:
diff --git a******.py
index ******
--- a******.py
+++ b******.py
@@ -1,9 +1,11 @@
from pathlib import Path
-from typing import Any
+from typing import Any, Optional, Tuple, Union
.....
Any ideas what is going on here and why the two results are different?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels