Make sure file paths from git diff are relative to django_path instead of git repos root path

Currently, the git diff command return file paths which are relative to git repos root path, which will cause invalid migration file path if git repos root path is different from django_path
This commit is contained in:
Dat Hoang authored and David Wobrock committed 2019-01-20 11:43:33 +01:00
1 parent c14f9aef37
commit dca50b3afb
1 file changed
+1 -1
+1 -1
View File
@@ -219,7 +219,7 @@ class MigrationLinter(object):
git_root = self._get_git_root()
# Get changes since specified commit
git_diff_command = (
"cd {0} && git diff --name-only --diff-filter=A {1}"
"cd {0} && git diff --relative --name-only --diff-filter=A {1}"
).format(self.django_path, git_commit_id)
logger.info("Executing {0}".format(git_diff_command))
diff_process = Popen(git_diff_command, shell=True, stdout=PIPE, stderr=PIPE)