You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using darker on a repo with as of yet untracked files raises eg.: fatal: path 'new.py' exists on disk, but not in 'HEAD'
Steps to reproduce
$ mkdir /tmp/test
$ cd /tmp/test
$ git init
$ echo "print('legacy!')" > legacy.py
$ git add .
$ git commit -m 'initial commit'
$ echo "print('new stuff!')" > new.py
$ darker .
fatal: path 'new.py' exists on disk, but not in 'HEAD'
I guess this might be known and intended behavior, but it would be super useful if in a legacy codebase we could just use the same formatting/linting command also for new files added.
Are there any plans to support this usecase?
The text was updated successfully, but these errors were encountered:
The error message fatal: path 'new.py' exists on disk, but not in 'HEAD' comes from Git when Darker runs
git show HEAD:./new.py
If you run darker -vv --diff . you'll see in more detail what happens behind the scenes. Darker will also output a diff of the reformattings instead of modifying the files, so it's easier to see that it actually still works despite the Git error.
It would probably be a good idea for Darker to look at Git output, and detect and suppress this particular message since it is in fact expected. Or what do you think?
By the way, there's also a somewhat related pull request #55 which fixes Darker when linter output refers to files which don't currently exist on disk.
As a side note, we have multiple pull requests which could use a review. Since current contributors are really busy, we'd appreciate help reviewing the PRs. Let me know if you're willing to join us!
Using
darker
on a repo with as of yet untracked files raises eg.:fatal: path 'new.py' exists on disk, but not in 'HEAD'
Steps to reproduce
I guess this might be known and intended behavior, but it would be super useful if in a legacy codebase we could just use the same formatting/linting command also for new files added.
Are there any plans to support this usecase?
The text was updated successfully, but these errors were encountered: