| Conditions | 3 |
| Total Lines | 14 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # SPDX-FileCopyrightText: 2020 Peter Bittner <[email protected]> |
||
| 23 | def execute_git_clean(directory, args): |
||
| 24 | log.info('Executing git clean...') |
||
| 25 | cmd = build_git_clean_command(args.ignore, dry_run=args.dry_run, force=args.yes) |
||
| 26 | |||
| 27 | log.debug('Run: %s', ' '.join(cmd)) |
||
| 28 | result = subprocess.run(cmd, cwd=directory, check=False) # noqa: S603 |
||
| 29 | |||
| 30 | if result.returncode == GIT_FATAL_ERROR: |
||
| 31 | log.warning( |
||
| 32 | 'Directory %s is not under version control. Skipping git clean.', |
||
| 33 | directory, |
||
| 34 | ) |
||
| 35 | elif result.returncode: |
||
| 36 | raise SystemExit(result.returncode) |
||
| 37 |