Skip to content

Commit c198e38

Browse files
authored
Fix compatibility on non-git project folders when git is installed on the system (#399)
* fix readme typo * Only use GitVersioningSystem if we can find a .git folder
1 parent ff1c300 commit c198e38

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Codecov-cli supports user input. These inputs, along with their descriptions and
124124
| `get-report-results` | Used for local upload. It asks codecov to provide you the report results you calculated with the previous command.
125125
| `pr-base-picking` | Tells codecov that you want to explicitly define a base for your PR
126126
| `upload-process` | A wrapper for 3 commands. Create-commit, create-report and do-upload. You can use this command to upload to codecov instead of using the previosly mentioned commands.
127-
| `send-notification` | A command that tells Codecov that you finished uploading and you want to be sent notifications. To disable automatically sent notifications please consider adding manual_trigger to your codecov.yml, so it will look like codecov: notify: manual_trigger: true.
127+
| `send-notifications` | A command that tells Codecov that you finished uploading and you want to be sent notifications. To disable automatically sent notifications please consider adding manual_trigger to your codecov.yml, so it will look like codecov: notify: manual_trigger: true.
128128
>**Note**: Every command has its own different options that will be mentioned later in this doc. Codecov will try to load these options from your CI environment variables, if not, it will try to load them from git, if not found, you may need to add them manually.
129129
130130

codecov_cli/helpers/versioning_systems.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ def get_versioning_system() -> VersioningSystemInterface:
3838
class GitVersioningSystem(VersioningSystemInterface):
3939
@classmethod
4040
def is_available(cls):
41-
return which("git") is not None
41+
if which("git") is not None:
42+
p = subprocess.run(
43+
["git", "rev-parse", "--show-toplevel"], capture_output=True
44+
)
45+
if p.stdout:
46+
return True
47+
return False
4248

4349
def get_fallback_value(self, fallback_field: FallbackFieldEnum):
4450
if fallback_field == FallbackFieldEnum.commit_sha:

0 commit comments

Comments
 (0)