Repository: argoproj-labs/gordian

Issue:
Fetching of all files
It appears gordian is fetching all the files of a repo even if you only need 1.

Discussion:
kaosx5s: Waiting for #41 to be merged so I can rebase 😄 
codecov-commenter: ## [Codecov](https://app.codecov.io/gh/argoproj-labs/gordian/pull/42?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=argoproj-labs) Report
> Merging [#42](https://app.codecov.io/gh/argoproj-labs/gordian/pull/42?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=argoproj-labs) (bb08453) into [master](https://app.codecov.io/gh/argoproj-labs/gordian/commit/e8dd5ad4befaf302a1bbcd014a3909512d414e87?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=argoproj-labs) (e8dd5ad) will **not change** coverage.
> The diff coverage is `100.00%`.

```diff
@@           Coverage Diff           @@
##           master      #42   +/-   ##
=======================================
  Coverage   81.13%   81.13%           
=======================================
  Files          11       11           
  Lines         493      493           
  Branches       77       77           
=======================================
  Hits          400      400           
  Misses         76       76           
  Partials       17       17           
```


| [Files](https://app.codecov.io/gh/argoproj-labs/gordian/pull/42?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=argoproj-labs) | Coverage Δ | |
|---|---|---|
| [gordian/repo.py](https://app.codecov.io/gh/argoproj-labs/gordian/pull/42?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=argoproj-labs#diff-Z29yZGlhbi9yZXBvLnB5) | `78.36% <100.00%> (ø)` | |

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=argoproj-labs)


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cab46c1..eafba89 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com),
 and this project adheres to [Semantic Versioning](https://semver.org).
 
+
+## [3.7.0] - 2023-10-18
+### Added
+- Added support to pass in a path when calling get_files(), resolves issue #34
+
 ## [3.6.0] - 2023-10-06
 ### Fix
 - Fetch repo content from target branch
diff --git a/gordian/repo.py b/gordian/repo.py
index ae72642..0c53a0b 100644
--- a/gordian/repo.py
+++ b/gordian/repo.py
@@ -77,9 +77,9 @@ class Repo:
 
         return PlainTextFile(file, self)
 
-    def get_files(self):
+    def get_files(self, path=''):
         if not self.files:
-            contents = self._get_repo_contents('')
+            contents = self._get_repo_contents(path)
 
             while contents:
                 file = contents.pop(0)


Test patch:
diff --git a/tests/test_repo.py b/tests/test_repo.py
index 4398ec0..a341ea1 100644
--- a/tests/test_repo.py
+++ b/tests/test_repo.py
@@ -191,6 +191,16 @@ class TestRepo(unittest.TestCase):
         repo._source_repo.delete_file.assert_called_once()
         self.assertTrue(repo.dirty)
 
+    def test_get_files_with_path(self):
+        self.repo._set_target_branch('target')
+        self.repo.files = []
+        self.repo._source_repo = MagicMock()
+        repository_file = MagicMock(path='test/afile.txt', type='not_dir')
+        self.repo._source_repo.get_contents.side_effect = [[MagicMock(path='directory', type='dir')],[repository_file]]
+        self.repo.get_files('test')
+        self.repo._source_repo.get_contents.assert_has_calls([call('test', 'target'), call('directory', 'target')])
+        self.assertEquals(self.repo.files, [repository_file])
+
     def test__get_github_client(self):
         repo = Repo('test_repo', branch='', github=self.mock_git)