From dca50b3afb3975dcfffd2602cc7b816544838d42 Mon Sep 17 00:00:00 2001 From: Dat Hoang Date: Tue, 15 Jan 2019 20:52:26 +0700 Subject: [PATCH] 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 --- django_migration_linter/migration_linter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_migration_linter/migration_linter.py b/django_migration_linter/migration_linter.py index 6e71e53..ff2d726 100644 --- a/django_migration_linter/migration_linter.py +++ b/django_migration_linter/migration_linter.py @@ -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)