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

Improve docs for when Darker can't overwrite files #799

Open
akaihola opened this issue Jan 3, 2025 · 0 comments
Open

Improve docs for when Darker can't overwrite files #799

akaihola opened this issue Jan 3, 2025 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@akaihola
Copy link
Owner

akaihola commented Jan 3, 2025

In #778, @haohu321 wondered why --revision=HEAD^..HEAD won't overwrite reformatted Python source files.

I answered:

This is intentional. It only makes sense to modify files on disk when comparing old revisions to the working tree (--revision=<old>..:WORKTREE:, shorthand --revision=<old>).

If you're comparing already committed revisions (--revision=<older>..<old>), and some lines were modified and not properly formatted between those revisions, it's not safe to reformat the files on disk in the working tree since there may have been later modifications either in commits after <old> or in the working tree.

So it's important to be aware that HEAD is different from :WORKTREE:.

Let's improve the documentation and/or error messages to make this clear.

Originally posted by @akaihola in #778 (comment)

@akaihola akaihola self-assigned this Jan 3, 2025
@akaihola akaihola added the documentation Improvements or additions to documentation label Jan 3, 2025
@akaihola akaihola added this to the Darker 3.1.0 milestone Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Development

No branches or pull requests

1 participant