GitGuardian / src-fingerprint

Extract git related information (file shas, commit shas) from your hosted source version control system
MIT License
21 stars 10 forks source link

feat(provider): Repository provider infers the repo name when omitted #44

Closed Walz closed 2 years ago

Walz commented 2 years ago

With the repository provider, if the name of the repository is omitted, it will be infer from the URL/path.

Now, src-fingerprint --provider repository --object "https://github.com/GitGuardian/src-fingerprint" will produce:

{
  "repository_name": "src-fingerprint",
  "private": false,
  "sha": "a0c16efce5e767f04ba0c6988d121147099a17df",
  "type": "blob",
  "filepath": ".env.example",
  "size": "31"
}
...

closes https://github.com/GitGuardian/src-fingerprint/issues/26

pierrelalanne commented 2 years ago

A more general remark, I believe you can update the test integration_test.py:test_local_repository with something like :
args=["--object", "../src-fingerprint"] and add assert repos=={"src-fingerprint"}. I did not write the test in the first place because of this missing feature.

Note : The test will not run in your PR since it needs access to a repo secret.