Skip to content

Commit

Permalink
fix: avoid duplicate .pdm-python in .gitignore. (#1802)
Browse files Browse the repository at this point in the history
* fix: avoid duplicate .pdm-python in .gitignore.
fixes #1800

* refactor: remove else block
  • Loading branch information
oedokumaci authored Apr 3, 2023
1 parent d39a8e5 commit 80098ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/1800.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid duplicate .pdm-python in .gitignore.
5 changes: 3 additions & 2 deletions src/pdm/cli/commands/fix/fixers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ def _fix_gitignore(self) -> None:
if not gitignore.exists():
return
content = gitignore.read_text("utf8")
content = re.sub(r"^\.pdm\.toml$", ".pdm-python", content, flags=re.M)
gitignore.write_text(content, "utf8")
if ".pdm-python" not in content:
content = re.sub(r"^\.pdm\.toml$", ".pdm-python", content, flags=re.M)
gitignore.write_text(content, "utf8")

def fix(self) -> None:
old_file = self.project.root.joinpath(".pdm.toml")
Expand Down

0 comments on commit 80098ee

Please sign in to comment.