-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid dubious ownership errors with newer versions of git
Related: ansible/ansible-lint-action#138
- Loading branch information
Showing
5 changed files
with
23 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
import sys | ||
from pathlib import Path | ||
|
||
from ansiblelint.constants import GIT_CMD | ||
from ansiblelint.file_utils import cwd | ||
|
||
FAULTY_PLAYBOOK = """--- | ||
|
@@ -29,16 +30,16 @@ | |
|
||
def git_init() -> None: | ||
"""Init temporary git repository.""" | ||
subprocess.run(["git", "init", "--initial-branch=main"], check=True) | ||
subprocess.run(["git", "config", "user.email", "[email protected]"], check=True) | ||
subprocess.run(["git", "config", "user.name", "test"], check=True) | ||
subprocess.run([*GIT_CMD, "init", "--initial-branch=main"], check=True) | ||
subprocess.run([*GIT_CMD, "config", "user.email", "[email protected]"], check=True) | ||
subprocess.run([*GIT_CMD, "config", "user.name", "test"], check=True) | ||
|
||
|
||
def git_commit(filename: Path, content: str) -> None: | ||
"""Create and commit a file.""" | ||
filename.write_text(content) | ||
subprocess.run(["git", "add", filename], check=True) | ||
subprocess.run(["git", "commit", "-a", "-m", f"Commit {filename}"], check=True) | ||
subprocess.run([*GIT_CMD, "add", filename], check=True) | ||
subprocess.run([*GIT_CMD, "commit", "-a", "-m", f"Commit {filename}"], check=True) | ||
|
||
|
||
def run_lint(cmd: list[str]) -> subprocess.CompletedProcess[str]: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters