Fix pofiles discovering logic in '--modified' option when files are renamed. (#86)

This commit is contained in:
Álvaro Mondéjar 2020-10-14 13:27:13 +02:00 committed by GitHub
parent bed7e11f1e
commit 6eff8b9160
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -121,14 +121,16 @@ def main():
"""Powrap main entrypoint (parsing command line and all)."""
args = parse_args()
if args.modified:
git_status = check_output(["git", "status", "--porcelain"], encoding="utf-8")
git_status = check_output(
["git", "status", "--porcelain", "--no-renames"], encoding="utf-8"
)
git_status_lines = [
line.split(maxsplit=2) for line in git_status.split("\n") if line
]
args.po_files.extend(
Path(filename)
for status, filename in git_status_lines
if filename.endswith(".po")
if filename.endswith(".po") and status != "D"
)
if not args.po_files:
print("Nothing to do, exiting.")