File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ def get_first_latest_modification(filepath, main_directory="./"):
1616 repo = Repository (main_directory + ".git" )
1717 latest = None
1818 first = None
19+ from pathlib import Path
20+ fp = Path (filepath )
21+ if fp .is_absolute ():
22+ workdir = Path (repo .workdir ).resolve ()
23+ filepath = str (fp .resolve ().relative_to (workdir ))
1924 blame = repo .blame (filepath , flags = GIT_BLAME_TRACK_COPIES_SAME_FILE )
2025 for b in blame :
2126 commit = repo .get (b .final_commit_id )
@@ -35,6 +40,11 @@ def get_modification_list(filepath, main_directory="./"):
3540 repo = Repository (main_directory + ".git" )
3641 latest = None
3742 first = None
43+ from pathlib import Path
44+ fp = Path (filepath )
45+ if fp .is_absolute ():
46+ workdir = Path (repo .workdir ).resolve ()
47+ filepath = str (fp .resolve ().relative_to (workdir ))
3848 blame = repo .blame (filepath , flags = GIT_BLAME_TRACK_COPIES_SAME_FILE )
3949 modifications = list ()
4050 for b in blame :
You can’t perform that action at this time.
0 commit comments