Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option --git-commit-id fails to detect changes #168

Open
tned73 opened this issue Oct 14, 2021 · 4 comments
Open

option --git-commit-id fails to detect changes #168

tned73 opened this issue Oct 14, 2021 · 4 comments

Comments

@tned73
Copy link

tned73 commented Oct 14, 2021

Dear 3YOURMIND,

thanks for the great work! I think I found a small issue:

when using the following statement

./manage.py lintmigrations --git-commit-id `git rev-parse master` 

It will not find the migrations in the diff, due to setting the internal settings_path to the settings folder, where the git-diff functionality expects it to be the project root folder

./manage.py lintmigrations --git-commit-id `git rev-parse master` --project-root-path '.'

is a work around for this issue.

If this is an issue I would happily supply a PR for this issue. all tough it is a bit unclear, that the argument is called project-root-path, but the internal variable name is settings_path, which are different in nature

@David-Wobrock
Copy link
Collaborator

Hi @tned73

Sorry for the delay for answering the issue. I'm not 100% sure to understand the issue.

Yes, the linter will cd into the current Django settings path and execute the git diff there in order to only lint some migrations.
This path is either the project_root_path option or the env DJANGO_SETTINGS_MODULE option.

 14             settings_path = options["project_root_path"]
 15         else:
 16             settings_path = os.path.dirname(
 17                 import_module(os.getenv("DJANGO_SETTINGS_MODULE")).__file__
 18             )

I'm not sure to understand what is the problem in the described scenario 🤔 Can you provide the current output, the expected output, and maybe a gross summary of what your project folder hierarchy looks like? Thanks!

Would a solution be to provide two different options, one to specify the Django project root, and one for the git root path? Or am I misunderstanding the issue?

@David-Wobrock
Copy link
Collaborator

Does it related to #141?

@sheenobu
Copy link

sheenobu commented Mar 28, 2022

Even --git-commit-id did not find any new (committed) migrations unless I also used --project-root-path '.' so I think the issue is not just on uncommitted?

@bmrobin
Copy link

bmrobin commented Jun 4, 2024

confirmed that adding --project-root-path '.' fixed the issue for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants